00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: UpdateInfParser.h 00014 00015 Author: Klaus Kaempf <kkaempf@suse.de> 00016 Maintainer: Klaus Kaempf <kkaempf@suse.de> 00017 00018 Purpose: Parse /var/lib/YaST/update.inf 00019 /-*/ 00020 #ifndef UpdateInfParser_h 00021 #define UpdateInfParser_h 00022 00023 #include <string> 00024 #include <fstream> 00025 00026 #include <y2util/Pathname.h> 00027 #include <y2util/TaggedParser.h> 00028 #include <y2util/TaggedFile.h> 00029 00030 #include <y2pm/PMError.h> 00031 #include <y2pm/MediaAccessPtr.h> 00032 00033 class UpdateInfParser { 00034 private: 00035 00036 // tag ids for the TaggedParser 00037 enum Tags { 00038 BASESYSTEM, DISTNAME, DISTVERSION, DISTRELEASE, 00039 FTPPATCH, FTPSOURCES, 00040 NUM_TAGS 00041 }; 00042 00043 00044 // our parser 00045 TaggedParser _parser; 00046 // our set of tags, initialized in constructor 00047 TaggedFile::TagSet _tagset; 00048 00049 std::string _basesystem; 00050 std::string _distname; 00051 std::string _distversion; 00052 std::string _distrelease; 00053 std::string _ftppatch; 00054 std::list<std::string> _ftpsources; 00055 00056 public: 00057 UpdateInfParser (); 00058 ~UpdateInfParser(); 00059 00060 // parse 'update.inf' from path to attributes 00061 // localepath is only for initialization of the dataprovider 00062 // fromPathLocale() does the parsing of the locale file 00063 PMError fromPath (const Pathname& path); 00064 00065 const std::string& basesystem() { return _basesystem; } 00066 const std::string& distname() { return _distname; } 00067 const std::string& distversion() { return _distversion; } 00068 const std::string& distrelease() { return _distrelease; } 00069 const std::string& ftppatch() { return _ftppatch; } 00070 const std::list<std::string>& ftpsources() { return _ftpsources; } 00071 }; 00072 00073 #endif //UpdateInfParser_h