00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PMYouPatchInfo_h
00023 #define PMYouPatchInfo_h
00024
00025 #include <list>
00026 #include <string>
00027 #include <map>
00028
00029 #include <y2util/Url.h>
00030 #include <y2util/Pathname.h>
00031 #include <y2util/LangCode.h>
00032 #include <y2util/FSize.h>
00033
00034 #include <y2pm/PMError.h>
00035 #include <y2pm/MediaAccess.h>
00036
00037 #include <y2pm/PMYouPatchPtr.h>
00038 #include <y2pm/PMYouPackageDataProviderPtr.h>
00039 #include <y2pm/PMYouPatchTags.h>
00040 #include <y2pm/PMYouSettings.h>
00041
00042 #include <y2pm/PMYouPatchInfoPtr.h>
00043
00045
00046
00057 class PMYouPatchInfo : public CountedRep {
00058 REP_BODY(PMYouPatchInfo);
00059
00060 public:
00066 PMYouPatchInfo( PMYouSettingsPtr settings );
00067
00071 ~PMYouPatchInfo();
00072
00080 PMError getDirectory( bool useMediaDir );
00081
00088 PMError getPatches( std::vector<PMYouPatchPtr> &patches );
00089
00096 PMError readDir( std::vector<PMYouPatchPtr> &patches,
00097 bool useMediaDir = true );
00098
00106 PMError readFile( const Pathname &path, const std::string &fileName,
00107 PMYouPatchPtr &patch );
00108
00115 PMError parsePackages( const std::string &packages,
00116 const PMYouPatchPtr &patch );
00117
00125 PMError parseFiles( const std::string &files, const PMYouPatchPtr &patch );
00126
00134 PMError parseDeltas( const std::string &files, const PMYouPatchPtr &patch );
00135
00136
00137 PMYouPackageDataProviderPtr packageDataProvider() const;
00138
00146 PMError readDirectoryFile( const Pathname &,
00147 std::list<std::string> &patchFiles );
00148
00153 PMError processMediaDir();
00154
00158 int mediaNumber( const PMYouPatchPtr & );
00159
00160 protected:
00161
00167 std::string tagValueLocale ( YOUPatchTagSet::Tags tagIndex,
00168 std::istream &input );
00169
00170 std::string tagValue( YOUPatchTagSet::Tags tagIndex, std::istream &input,
00171 const std::string &locale = "" );
00172 std::string tagMultiValue( YOUPatchTagSet::Tags tagIndex,
00173 std::istream& input );
00174
00175 std::string tagValue( YOUPackageTagSet::Tags tag );
00176
00183 PMError createPackage( const PMYouPatchPtr &patch, std::istream& strm );
00184
00185 void readMediaMap( const Pathname &file );
00186
00187 private:
00188 YOUPatchTagSet _patchTagSet;
00189 YOUPackageTagSet _packageTagSet;
00190
00191 PMYouSettingsPtr _settings;
00192
00193 MediaAccess _media;
00194
00195 PMYouPackageDataProviderPtr _packageDataProvider;
00196
00201 Url _mediaDirLastVisited;
00202
00203 bool _doneDirectory;
00204
00205 int _totalPatchFileCount;
00206
00207 std::map<std::string,int> _mediaMap;
00208 };
00209
00211
00212 #endif // PMYouPatchInfo_h