Main Page | Namespace List | Class Hierarchy | Class List | 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/PMYouPatchPtr.h>
00032 
00033 #include <y2pm/PMObject.h>
00034 #include <y2pm/PMPackagePtr.h>
00035 #include <y2pm/PMYouProductPtr.h>
00036 
00040 class PMYouFile
00041 {
00042   public:
00043     PMYouFile( const std::string &name, const FSize &size )
00044       : _name( name ), _size( size ) {}
00045 
00046     std::string name() const { return _name; }
00047     FSize size() const { return _size; }
00048 
00049   private:
00050     std::string _name;
00051     FSize _size;
00052 };
00053 
00057 class PMYouPatch : public PMObject
00058 {
00059   REP_BODY(PMYouPatch);
00060 
00061   public:
00062 
00066     enum Kind {
00067       kind_invalid = 0,
00068       kind_yast = 1,
00069       kind_security = 2,
00070       kind_recommended = 4,
00071       kind_optional = 8,
00072       kind_document = 16,
00073       kind_patchlevel = 32,
00074       kind_all = 63
00075     };
00079     void setKind( Kind kind ) { _kind = kind; }
00083     Kind kind() const { return _kind; }
00087     std::string kindLabel() { return kindLabel( _kind ); }
00091     static std::string kindLabel( Kind kind );
00092 
00096     void setShortDescription( const std::string &str ) { _shortDescription = str; }
00100     std::string shortDescription() const { return _shortDescription; }
00101 
00105     void setLongDescription( const std::string &str ) { _longDescription = str; }
00109     std::string longDescription() const { return _longDescription; }
00110 
00114     void setPreInformation( const std::string &str ) { _preInformation = str; }
00118     std::string preInformation() const { return _preInformation; }
00119 
00123     void setPostInformation( const std::string &str ) { _postInformation = str; }
00127     std::string postInformation() const { return _postInformation; }
00128 
00132     void setUpdateOnlyInstalled( bool v ) { _updateOnlyInstalled = v; }
00136     bool updateOnlyInstalled() const { return _updateOnlyInstalled; }
00137 
00141     void setUpdateOnlyNew( bool v ) { _updateOnlyNew = v; }
00145     bool updateOnlyNew() const { return _updateOnlyNew; }
00146 
00150     void setPreScript( const std::string &preScript ) { _preScript = preScript; }
00154     std::string preScript() const { return _preScript; }
00155 
00159     void setPostScript( const std::string &postScript ) { _postScript = postScript; }
00163     std::string postScript() const { return _postScript; }
00164 
00168     void setPackages( const std::list<PMPackagePtr> &p );
00172     std::list<PMPackagePtr> packages() const { return _packages; }
00176     void addPackage( const PMPackagePtr &pkg );
00180     void clearPackages();
00181 
00185     void setLocalFile( const Pathname &localFile ) { _localFile = localFile; }
00189     Pathname localFile() const { return _localFile; }
00190 
00194     void setPatchSize( const FSize &size );
00195 
00199     FSize patchSize() const;
00200 
00205     std::string fullName() const;
00206 
00211     void setPackagesInstalled( bool installed ) { _packagesInstalled = installed; }
00212 
00216     bool packagesInstalled() const { return _packagesInstalled; }
00217 
00218 
00222     bool installable() const;
00223 
00224 
00228     void setFiles( const std::list<PMYouFile> &files );
00229     
00233     void addFile( const PMYouFile &file );
00234 
00238     std::list<PMYouFile> files() const { return _files; }
00239 
00243     void setProduct( const PMYouProductPtr & );
00247     PMYouProductPtr product() const;
00248 
00252     void setSkipped( bool s ) { _skipped = s; }
00256     bool skipped() const { return _skipped; }
00257 
00261     bool isSelected() const;
00262 
00266     void setFileName( const std::string &n ) { _fileName = n; }
00270     std::string fileName() const { return _fileName; }
00271 
00272   public:
00273 
00278     virtual std::string            summary()     const { return shortDescription(); }
00279     virtual std::list<std::string> description() const;
00280     virtual std::list<std::string> insnotify()       const;
00281     virtual std::list<std::string> delnotify()       const { return PMObject::delnotify(); }
00282     virtual FSize                  size()            const { return patchSize(); }
00283     virtual bool                   providesSources() const { return PMObject::providesSources(); }
00284 
00285     virtual std::string            instSrcLabel()    const { return PMObject::instSrcLabel(); }
00286     virtual Vendor                 instSrcVendor()   const { return PMObject::instSrcVendor(); }
00287     virtual unsigned               instSrcRank()     const { return PMObject::instSrcRank(); }
00288 
00289   private:
00290 
00291     std::string _shortDescription, _longDescription;
00292     std::string _preInformation, _postInformation;
00293     Kind _kind;
00294     bool _updateOnlyInstalled;
00295     bool _updateOnlyNew;
00296     std::string _preScript, _postScript;
00297     FSize _patchSize;
00298 
00299     std::list<PMPackagePtr> _packages;
00300 
00301     Pathname _localFile;
00302     std::string _fileName;
00303 
00304     bool _packagesInstalled;
00305 
00306     std::list<PMYouFile> _files;
00307 
00308     PMYouProductPtr _product;
00309 
00310     bool _skipped;
00311 
00312   public:
00313 
00314     PMYouPatch( const PkgName &    name_r,
00315                 const PkgEdition & edition_r,
00316                 const PkgArch &    arch_r );
00317 
00318     virtual ~PMYouPatch();
00319 
00320   public:
00321 
00322     virtual std::ostream & dumpOn( std::ostream & str ) const;
00323 };
00324 
00326 
00327 #endif // PMYouPatch_h

Generated on Tue May 16 23:47:59 2006 for yast2-packagemanager by doxygen 1.3.6