00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: PMSelection.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 Purpose: Defines the software Selection object. 00019 00020 /-*/ 00021 #ifndef PMSelection_h 00022 #define PMSelection_h 00023 00024 #include <iosfwd> 00025 #include <string> 00026 00027 #include <y2pm/PMSelectionDataProvider.h> // should introduce all attribute data types. 00028 00029 #include <y2pm/PMSelectionPtr.h> 00030 #include <y2pm/PMPackagePtr.h> 00031 00032 #include <y2pm/PMObject.h> 00033 #include <y2pm/PkgArch.h> 00034 #include <y2pm/PMTypes.h> 00035 00037 // 00038 // CLASS NAME : PMSelection 00042 class PMSelection : public PMObject { 00043 REP_BODY(PMSelection); 00044 00045 public: 00046 00051 std::string summary ( const LangCode& locale ) const; 00052 std::list<std::string> description( const LangCode& locale ) const; 00053 std::list<std::string> insnotify ( const LangCode& locale ) const; 00054 std::list<std::string> delnotify ( const LangCode& locale ) const; 00055 00056 virtual std::string summary() const { return summary( LangCode("") ); } 00057 virtual std::list<std::string> description() const { return description( LangCode("") ); } 00058 virtual std::list<std::string> insnotify() const { return insnotify( LangCode("") ); } 00059 virtual std::list<std::string> delnotify() const { return delnotify( LangCode("") ); } 00060 virtual FSize size() const; 00061 virtual bool providesSources() const; 00062 00063 virtual std::string instSrcLabel() const; 00064 virtual Vendor instSrcVendor() const; 00065 virtual unsigned instSrcRank() const; 00066 00071 std::string category() const; 00072 bool visible() const; 00073 std::list<std::string> suggests() const; 00074 std::list<PMSelectionPtr> suggests_ptrs(); 00075 std::list<std::string> recommends() const; 00076 std::list<PMSelectionPtr> recommends_ptrs(); 00077 std::list<std::string> inspacks ( const LangCode& locale = LangCode("") ) const; 00078 std::list<std::string> delpacks ( const LangCode& locale = LangCode("") ) const; 00079 FSize archivesize() const; 00080 std::string order() const; 00081 00082 const bool isBase() const; 00083 00089 std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & locale ); 00090 std::set<PMSelectablePtr> inspacks_ptrs( const PM::LocaleSet & locales ); 00096 std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & locale ); 00097 std::set<PMSelectablePtr> delpacks_ptrs( const PM::LocaleSet & locales ); 00098 00099 00100 // physical access to the sel file. 00101 PMError provideSelToInstall( Pathname & ) const; 00102 00103 protected: 00104 00109 friend class InstSrcData; 00110 00111 PMSelectionDataProviderPtr _dataProvider; 00112 00113 public: 00114 00115 PMSelection (const PkgName & name_r, 00116 const PkgEdition & edition_r, 00117 const PkgArch & arch_r, 00118 PMSelectionDataProviderPtr dataProvider_r ); 00119 00120 virtual ~PMSelection(); 00121 00127 std::set<PMSelectablePtr> inspacks_ptrs(); 00128 00134 std::set<PMSelectablePtr> delpacks_ptrs(); 00135 00136 public: 00137 00141 static int compareByOrder( constPMSelectionPtr lhs, constPMSelectionPtr rhs ) { 00142 if ( lhs == rhs ) 00143 return 0; 00144 if ( ! ( lhs && rhs ) ) 00145 return( rhs ? -1 : 1 ); 00146 int res = lhs->order().compare( rhs->order() ); 00147 if ( res ) 00148 return res; 00149 return lhs->name()->compare( rhs->name() ); 00150 } 00151 00155 static bool lessByOrder( constPMSelectionPtr lhs, constPMSelectionPtr rhs ) { 00156 return( compareByOrder( lhs, rhs ) < 0 ); 00157 } 00158 00159 public: 00160 00161 virtual std::ostream & dumpOn( std::ostream & str ) const; 00162 }; 00163 00165 00166 #endif // PMSelection_h