Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PMYouPatch.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                    (C) SuSE Linux AG |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       PMYouPatch.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016               Cornelius Schumacher <cschum@suse.de>
00017   Maintainer: Cornelius Schumacher <cschum@suse.de>
00018 
00019   Purpose: Defines the YouPatch object.
00020 
00021 /-*/
00022 #ifndef PMYouPatch_h
00023 #define PMYouPatch_h
00024 
00025 #include <iosfwd>
00026 #include <string>
00027 
00028 #include <y2util/Pathname.h>
00029 #include <y2util/FSize.h>
00030 
00031 #include <y2pm/PMError.h>
00032 #include <y2pm/PMYouPatchPtr.h>
00033 
00034 #include <y2pm/PMObject.h>
00035 #include <y2pm/PMPackagePtr.h>
00036 #include <y2pm/PMYouProductPtr.h>
00037 #include <y2pm/PMPackageDelta.h>
00038 
00042 class PMYouFile
00043 {
00044   public:
00045     PMYouFile( const std::string &name, const FSize &size )
00046       : _name( name ), _size( size ) {}
00047 
00048     std::string name() const { return _name; }
00049     FSize size() const { return _size; }
00050 
00051   private:
00052     std::string _name;
00053     FSize _size;
00054 };
00055 
00059 class PMYouPatch : public PMObject
00060 {
00061   REP_BODY(PMYouPatch);
00062 
00063   public:
00064 
00068     enum Kind {
00069       kind_invalid = 0,
00070       kind_yast = 1,
00071       kind_security = 2,
00072       kind_recommended = 4,
00073       kind_optional = 8,
00074       kind_document = 16,
00075       kind_patchlevel = 32,
00076       kind_all = 63
00077     };
00081     void setKind( Kind kind ) { _kind = kind; }
00085     Kind kind() const { return _kind; }
00089     std::string kindLabel() { return kindLabel( _kind ); }
00093     static std::string kindLabel( Kind kind );
00094 
00098     void setShortDescription( const std::string &str ) { _shortDescription = str; }
00102     std::string shortDescription() const { return _shortDescription; }
00103 
00107     void setLongDescription( const std::string &str ) { _longDescription = str; }
00111     std::string longDescription() const { return _longDescription; }
00112 
00116     void setPreInformation( const std::string &str ) { _preInformation = str; }
00120     std::string preInformation() const { return _preInformation; }
00121 
00125     void setPostInformation( const std::string &str ) { _postInformation = str; }
00129     std::string postInformation() const { return _postInformation; }
00130 
00134     void setUpdateOnlyInstalled( bool v ) { _updateOnlyInstalled = v; }
00138     bool updateOnlyInstalled() const { return _updateOnlyInstalled; }
00139 
00143     void setUpdateOnlyNew( bool v ) { _updateOnlyNew = v; }
00147     bool updateOnlyNew() const { return _updateOnlyNew; }
00148 
00152     void setPreScript( const std::string &preScript ) { _preScript = preScript; }
00156     std::string preScript() const { return _preScript; }
00157 
00161     void setPostScript( const std::string &postScript ) { _postScript = postScript; }
00165     std::string postScript() const { return _postScript; }
00166 
00170     void setPackages( const std::list<PMPackagePtr> &p );
00174     std::list<PMPackagePtr> packages() const { return _packages; }
00178     void addPackage( const PMPackagePtr &pkg );
00182     void clearPackages();
00183 
00187     void setLocalFile( const Pathname &localFile ) { _localFile = localFile; }
00191     Pathname localFile() const { return _localFile; }
00192 
00196     void setPatchSize( const FSize &size );
00197 
00201     FSize patchSize() const;
00202 
00207     std::string fullName() const;
00208 
00213     void setPackagesInstalled( bool installed ) { _packagesInstalled = installed; }
00214 
00218     bool packagesInstalled() const { return _packagesInstalled; }
00219 
00220 
00224     bool installable() const;
00225 
00226 
00230     void setFiles( const std::list<PMYouFile> &files );
00231     
00235     void addFile( const PMYouFile &file );
00236 
00240     std::list<PMYouFile> files() const { return _files; }
00241 
00245     void setProduct( const PMYouProductPtr & );
00249     PMYouProductPtr product() const;
00250 
00254     void setSkipped( bool s ) { _skipped = s; }
00258     bool skipped() const { return _skipped; }
00259 
00263     bool isSelected() const;
00264 
00268     void setFileName( const std::string &n ) { _fileName = n; }
00272     std::string fileName() const { return _fileName; }
00273 
00274   public:
00275 
00280     virtual std::string            summary()     const { return shortDescription(); }
00281     virtual std::list<std::string> description() const;
00282     virtual std::list<std::string> insnotify()       const;
00283     virtual std::list<std::string> delnotify()       const { return PMObject::delnotify(); }
00284     virtual FSize                  size()            const { return patchSize(); }
00285     virtual bool                   providesSources() const { return PMObject::providesSources(); }
00286 
00287     virtual std::string            instSrcLabel()    const { return PMObject::instSrcLabel(); }
00288     virtual Vendor                 instSrcVendor()   const { return PMObject::instSrcVendor(); }
00289     virtual unsigned               instSrcRank()     const { return PMObject::instSrcRank(); }
00290 
00291   private:
00292 
00293     std::string _shortDescription, _longDescription;
00294     std::string _preInformation, _postInformation;
00295     Kind _kind;
00296     bool _updateOnlyInstalled;
00297     bool _updateOnlyNew;
00298     std::string _preScript, _postScript;
00299     FSize _patchSize;
00300 
00301     std::list<PMPackagePtr> _packages;
00302 
00303     Pathname _localFile;
00304     std::string _fileName;
00305 
00306     bool _packagesInstalled;
00307 
00308     std::list<PMYouFile> _files;
00309 
00310     PMYouProductPtr _product;
00311 
00312     bool _skipped;
00313 
00314   public:
00315 
00316     PMYouPatch( const PkgName &    name_r,
00317                 const PkgEdition & edition_r,
00318                 const PkgArch &    arch_r );
00319 
00320     virtual ~PMYouPatch();
00321 
00322   public:
00323 
00324     virtual std::ostream & dumpOn( std::ostream & str ) const;
00325 };
00326 
00328 
00329 #endif // PMYouPatch_h

Generated on Mon Sep 12 21:52:13 2005 for yast2-packagemanager by  doxygen 1.4.4