Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

PMYouPatchInfo.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       PMYouPatchInfo.h
00014 
00015   Author:     Cornelius Schumacher <cschum@suse.de>
00016   Maintainer: Cornelius Schumacher <cschum@suse.de>
00017 
00018   Purpose: Utility class for reading the patch information
00019 
00020 /-*/
00021 #ifndef PMYouPatchInfo_h
00022 #define PMYouPatchInfo_h
00023 
00024 #include <list>
00025 #include <string>
00026 #include <map>
00027 
00028 #include <y2util/Url.h>
00029 #include <y2util/Pathname.h>
00030 #include <y2util/LangCode.h>
00031 #include <y2util/FSize.h>
00032 
00033 #include <y2pm/PMError.h>
00034 #include <y2pm/MediaAccess.h>
00035 
00036 #include <y2pm/PMYouPatchPtr.h>
00037 #include <y2pm/PMYouPackageDataProviderPtr.h>
00038 #include <y2pm/PMYouPatchTags.h>
00039 #include <y2pm/PMYouSettings.h>
00040 
00041 #include <y2pm/PMYouPatchInfoPtr.h>
00042 
00044 //
00045 //      CLASS NAME : PMYouPatchInfo
00049 class PMYouPatchInfo : public CountedRep {
00050   REP_BODY(PMYouPatchInfo);
00051 
00052   public:
00058     PMYouPatchInfo( PMYouSettingsPtr settings );
00059 
00063     ~PMYouPatchInfo();
00064 
00068     PMError getDirectory( bool useMediaDir );
00069 
00078     PMError getPatches( std::vector<PMYouPatchPtr> &patches );
00079     
00088     PMError readDir( std::vector<PMYouPatchPtr> &patches,
00089                      bool useMediaDir = true );
00090 
00098     PMError readFile( const Pathname &path, const std::string &fileName,
00099                       PMYouPatchPtr &patch );
00100 
00107     PMError parsePackages( const std::string &packages,
00108                            const PMYouPatchPtr &patch );
00109 
00113     PMError parseFiles( const std::string &files, const PMYouPatchPtr &patch );
00114 
00115     PMYouPackageDataProviderPtr packageDataProvider() const;
00116 
00117     PMError readDirectoryFile( const Pathname &,
00118                                std::list<std::string> &patchFiles );
00119 
00120     PMError processMediaDir();
00121 
00122     int mediaNumber( const PMYouPatchPtr & );
00123 
00124   protected:
00125     std::string tagValueLocale ( YOUPatchTagSet::Tags tagIndex,
00126                                  std::istream &input );
00127 
00128     std::string tagValue( YOUPatchTagSet::Tags tagIndex, std::istream &input,
00129                           const std::string &locale = "" );
00130     std::string tagMultiValue( YOUPatchTagSet::Tags tagIndex, 
00131                                std::istream& input );
00132 
00133     std::string tagValue( YOUPackageTagSet::Tags tag );
00134 
00135     PMError createPackage( const PMYouPatchPtr &patch );
00136 
00137     void readMediaMap( const Pathname &file );
00138 
00139   private:
00140     YOUPatchTagSet _patchTagSet;
00141     YOUPackageTagSet _packageTagSet;
00142     
00143     PMYouSettingsPtr _settings;
00144 
00145     MediaAccess _media;
00146 
00147     PMYouPackageDataProviderPtr _packageDataProvider;
00148     
00149     bool _doneMediaDir;
00150     bool _doneDirectory;
00151 
00152     int _totalPatchFileCount;
00153 
00154     std::map<std::string,int> _mediaMap;
00155 };
00156 
00158 
00159 #endif // PMYouPatchInfo_h

Generated on Fri Nov 9 14:30:31 2007 for yast2-packagemanager by doxygen 1.3.6