00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: PMObject.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef PMObject_h 00020 #define PMObject_h 00021 00022 #include <iosfwd> 00023 #include <string> 00024 00025 #include <y2util/FSize.h> 00026 #include <y2util/Vendor.h> 00027 00028 #include <y2pm/PMObjectPtr.h> 00029 #include <y2pm/PMSolvable.h> 00030 00031 #include <y2pm/PMSelectablePtr.h> 00032 00033 #include <y2pm/InstSrcPtr.h> 00034 00036 // 00037 // CLASS NAME : PMObject 00041 class PMObject : public PMSolvable { 00042 REP_BODY(PMObject); 00043 00044 private: 00045 00046 friend class PMManager; 00047 friend class PMSelectable; 00048 00049 // back pointer to selectable if this object is managed 00050 PMSelectablePtr _selectable; 00051 00052 private: 00053 00058 virtual bool prefererCandidate() const { return false; } 00059 00060 public: 00061 00068 virtual std::string summary() const = 0; 00069 virtual std::list<std::string> description() const = 0; 00070 virtual std::list<std::string> insnotify() const = 0; 00071 virtual std::list<std::string> delnotify() const = 0; 00072 virtual FSize size() const = 0; 00073 virtual bool providesSources() const = 0; 00074 00075 virtual std::string instSrcLabel() const = 0; 00076 virtual Vendor instSrcVendor() const = 0; 00077 virtual unsigned instSrcRank() const = 0; // rank == 0 is highest! 00078 00079 public: 00080 00081 PMObject( const PkgName & name_r, 00082 const PkgEdition & edition_r, 00083 const PkgArch & arch_r ); 00084 00085 virtual ~PMObject(); 00086 00087 public: 00088 00090 // Shortcuts that tell about the Objects status within 00091 // the managing Selectable. 00093 00098 bool hasSelectable() const { return( _selectable != 0 ); } 00099 00103 PMSelectablePtr getSelectable() const { return _selectable; } 00104 00110 bool isInstalledObj() const; 00111 00118 bool isCandidateObj() const; 00119 00125 bool isAvailableOnly() const; 00126 00133 PMObjectPtr getInstalledObj() const; 00134 00141 PMObjectPtr getCandidateObj() const; 00142 00148 bool hasInstalledObj() const; 00149 00155 bool hasCandidateObj() const; 00156 00157 00158 public: 00159 00163 virtual std::ostream & dumpOn( std::ostream & str ) const; 00164 }; 00165 00167 00168 #endif // PMObject_h