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 00084 PM::LocaleSet supportedLocales() const; 00092 std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & locale ); 00093 std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & locale ); 00094 std::set<PMSelectablePtr> inspacks_ptrs( const PM::LocaleSet & locales ); 00100 std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & locale ); 00101 std::set<PMSelectablePtr> delpacks_ptrs( const PM::LocaleSet & locales ); 00102 00103 00104 // physical access to the sel file. 00105 PMError provideSelToInstall( Pathname & ) const; 00106 00107 protected: 00108 00113 friend class InstSrcData; 00114 00115 PMSelectionDataProviderPtr _dataProvider; 00116 00117 public: 00118 00119 PMSelection (const PkgName & name_r, 00120 const PkgEdition & edition_r, 00121 const PkgArch & arch_r, 00122 PMSelectionDataProviderPtr dataProvider_r ); 00123 00124 virtual ~PMSelection(); 00125 00131 std::set<PMSelectablePtr> inspacks_ptrs(); 00132 00138 std::set<PMSelectablePtr> delpacks_ptrs(); 00139 00140 public: 00141 00145 static int compareByOrder( constPMSelectionPtr lhs, constPMSelectionPtr rhs ) { 00146 if ( lhs == rhs ) 00147 return 0; 00148 if ( ! ( lhs && rhs ) ) 00149 return( rhs ? -1 : 1 ); 00150 int res = lhs->order().compare( rhs->order() ); 00151 if ( res ) 00152 return res; 00153 return lhs->name()->compare( rhs->name() ); 00154 } 00155 00159 static bool lessByOrder( constPMSelectionPtr lhs, constPMSelectionPtr rhs ) { 00160 return( compareByOrder( lhs, rhs ) < 0 ); 00161 } 00162 00163 public: 00164 00165 virtual std::ostream & dumpOn( std::ostream & str ) const; 00166 }; 00167 00169 00170 #endif // PMSelection_h
1.4.4