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 private: 00061 00067 bool _license_to_confirm; 00068 00069 public: 00070 00075 bool hasLicenseToConfirm () const { return _license_to_confirm; } 00079 void markLicenseConfirmed () { _license_to_confirm = false; } 00083 void markLicenseUnconfirmed () { _license_to_confirm = true; } 00084 00085 public: 00086 00093 virtual std::string summary() const = 0; 00094 virtual std::list<std::string> description() const = 0; 00095 virtual std::list<std::string> insnotify() const = 0; 00096 virtual std::list<std::string> delnotify() const = 0; 00097 virtual FSize size() const = 0; 00098 virtual bool providesSources() const = 0; 00099 00100 virtual std::string instSrcLabel() const = 0; 00101 virtual Vendor instSrcVendor() const = 0; 00102 virtual unsigned instSrcRank() const = 0; // rank == 0 is highest! 00103 00104 public: 00105 00106 PMObject( const PkgName & name_r, 00107 const PkgEdition & edition_r, 00108 const PkgArch & arch_r ); 00109 00110 virtual ~PMObject(); 00111 00112 public: 00113 00115 // Shortcuts that tell about the Objects status within 00116 // the managing Selectable. 00118 00123 bool hasSelectable() const { return( _selectable != 0 ); } 00124 00128 PMSelectablePtr getSelectable() const { return _selectable; } 00129 00135 bool isInstalledObj() const; 00136 00143 bool isCandidateObj() const; 00144 00150 bool isAvailableOnly() const; 00151 00158 PMObjectPtr getInstalledObj() const; 00159 00166 PMObjectPtr getCandidateObj() const; 00167 00173 bool hasInstalledObj() const; 00174 00180 bool hasCandidateObj() const; 00181 00182 00183 public: 00184 00188 virtual std::ostream & dumpOn( std::ostream & str ) const; 00189 }; 00190 00192 00193 #endif // PMObject_h
1.4.4