00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PMULSelectionDataProvider_h
00022 #define PMULSelectionDataProvider_h
00023
00024 #include <iosfwd>
00025 #include <string>
00026 #include <fstream>
00027 #include <list>
00028 #include <set>
00029 #include <map>
00030
00031 #include <y2util/TaggedFile.h>
00032 #include <y2util/TagCacheRetrieval.h>
00033 #include <y2util/TagCacheRetrievalPtr.h>
00034
00035 #include <y2pm/PMULSelectionDataProviderPtr.h>
00036 #include <y2pm/PMSelectionDataProvider.h>
00037
00039
00040
00050 class PMULSelectionDataProvider : public PMSelectionDataProvider {
00051 REP_BODY(PMULSelectionDataProvider);
00052
00053 friend class ULSelectionParser;
00054
00055 private:
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 typedef TaggedFile::Tag::posmaptype::const_iterator posmapIT;
00072
00073
00074 typedef map <LangCode,std::set<PMSelectablePtr> > slcmaptype;
00075 typedef slcmaptype::const_iterator slcmapIT;
00076
00077
00078 posmapIT posmapFind (const TaggedFile::Tag::posmaptype& theMap, const LangCode& locale, bool with_empty) const;
00079
00080
00081 slcmapIT slcmapFind (const slcmaptype& theMap, const LangCode& locale, bool with_empty) const;
00082
00083
00084 std::string posmapSLookup (const TaggedFile::Tag::posmaptype& theMap, const LangCode& locale, bool with_empty) const;
00085
00086
00087 std::list<std::string> posmapLLookup (const TaggedFile::Tag::posmaptype& theMap, const LangCode& locale, bool with_empty) const;
00088
00089
00090 std::list<std::string> sellist2strlist (const std::list<PMSelectionPtr>& sellist) const;
00091
00092
00093 std::list<std::string> slclist2strlist (const std::set<PMSelectablePtr>& slclist) const;
00094
00095
00096 std::list<std::string> pkgsList (const LangCode& locale, bool is_delpacks) const;
00097
00098
00099 std::set<PMSelectablePtr> pkgsPointers (const LangCode & locale, bool is_delpacks) const;
00100
00101 protected:
00102
00103
00104 TaggedFile::Tag::posmaptype _attr_SUMMARY;
00105 TaggedFile::Tag::posmaptype _attr_DESCRIPTION;
00106 TaggedFile::Tag::posmaptype _attr_INSNOTIFY;
00107 TaggedFile::Tag::posmaptype _attr_DELNOTIFY;
00108 FSize _attr_SIZE;
00109
00110 std::string _attr_CATEGORY;
00111 bool _attr_ISBASE;
00112
00113 bool _attr_VISIBLE;
00114
00115
00116
00117 std::list<std::string> _attr_RECOMMENDS;
00118 std::list<PMSelectionPtr> _ptrs_attr_RECOMMENDS;
00119 std::list<std::string> _attr_SUGGESTS;
00120 std::list<PMSelectionPtr> _ptrs_attr_SUGGESTS;
00121
00122
00123 TaggedFile::Tag::posmaptype _attr_INSPACKS;
00124 TaggedFile::Tag::posmaptype _attr_DELPACKS;
00125 mutable slcmaptype _ptrs_attr_INSPACKS;
00126 mutable slcmaptype _ptrs_attr_DELPACKS;
00127
00128 FSize _attr_ARCHIVESIZE;
00129 std::string _attr_ORDER;
00130
00131
00132 TagCacheRetrievalPtr _selection_retrieval;
00133
00134 TagCacheRetrievalPtr getCacheRetrieval() { return _selection_retrieval; }
00135
00136 public:
00137
00138 PMULSelectionDataProvider (const Pathname& selectionname);
00139 virtual ~PMULSelectionDataProvider();
00140
00141 public:
00142
00148
00149 virtual std::string summary ( const PMSelection & sel_r, const LangCode& locale = LangCode("") ) const;
00150 virtual std::list<std::string> description ( const PMSelection & sel_r, const LangCode& locale = LangCode("") ) const;
00151 virtual std::list<std::string> insnotify ( const PMSelection & sel_r, const LangCode& locale = LangCode("") ) const;
00152 virtual std::list<std::string> delnotify ( const PMSelection & sel_r, const LangCode& locale = LangCode("") ) const;
00153 virtual FSize size ( const PMSelection & sel_r ) const;
00154
00155
00156 virtual std::string category ( const PMSelection & sel_r ) const;
00157 virtual bool visible ( const PMSelection & sel_r ) const;
00158
00159 virtual std::list<std::string> suggests ( const PMSelection & sel_r ) const;
00160 virtual std::list<PMSelectionPtr> suggests_ptrs ( const PMSelection & sel_r ) const;
00161 virtual std::list<std::string> recommends ( const PMSelection & sel_r ) const;
00162 virtual std::list<PMSelectionPtr> recommends_ptrs( const PMSelection & sel_r ) const;
00163
00164 virtual std::list<std::string> inspacks ( const PMSelection & sel_r, const LangCode & locale = LangCode("") ) const;
00165 virtual std::list<std::string> delpacks ( const PMSelection & sel_r, const LangCode & locale = LangCode("") ) const;
00166
00167
00168 virtual std::set<PMSelectablePtr> inspacks_ptrs ( const PMSelection & sel_r, const LangCode & locale ) const;
00169 virtual std::set<PMSelectablePtr> delpacks_ptrs ( const PMSelection & sel_r, const LangCode & locale ) const;
00170
00171 virtual FSize archivesize ( const PMSelection & sel_r ) const;
00172 virtual std::string order ( const PMSelection & sel_r ) const;
00173
00174 virtual bool isBase ( const PMSelection & sel_r ) const;
00175
00176
00177 virtual PMError provideSelToInstall( const PMSelection & sel_r, Pathname & path_r ) const;
00178 };
00179
00181
00182 #endif // PMULSelectionDataProvider_h