00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ULParsePackagesLang_h
00022 #define ULParsePackagesLang_h
00023
00024 #include <iostream>
00025 #include <fstream>
00026 #include <string>
00027
00028 #include <y2util/Pathname.h>
00029 #include <y2util/LangCode.h>
00030 #include <y2util/TaggedParser.h>
00031 #include <y2util/TaggedFile.h>
00032 #include <y2util/TagCacheRetrievalPtr.h>
00033
00034 #include <y2pm/InstSrcError.h>
00035 #include <y2pm/PkgIdent.h>
00036
00038
00039
00043 class ULParsePackagesLang {
00044
00045 friend std::ostream & operator<<( std::ostream & str, const ULParsePackagesLang & obj );
00046
00047 ULParsePackagesLang & operator=( const ULParsePackagesLang & );
00048 ULParsePackagesLang ( const ULParsePackagesLang & );
00049
00050 public:
00051
00052 typedef InstSrcError Error;
00053
00054 struct Entry : public PkgIdent {
00055 friend std::ostream & operator<<( std::ostream & str, const Entry & obj );
00056
00057 TagCacheRetrievalPtr retrieval;
00058
00059 TagRetrievalPos posSUMMARY;
00060 TagRetrievalPos posDESCRIPTION;
00061 TagRetrievalPos posINSNOTIFY;
00062 TagRetrievalPos posDELNOTIFY;
00063 TagRetrievalPos posLICENSETOCONFIRM;
00064
00065 Entry() {}
00066 Entry( const PkgIdent & pkgident_r, TagCacheRetrievalPtr retrieval_r )
00067 : PkgIdent( pkgident_r )
00068 , retrieval( retrieval_r )
00069 {}
00070 };
00071
00072 private:
00073
00074
00075 enum Tags {
00076 PACKAGE,
00077 SUMMARY,
00078 DESCRIPTION,
00079 INSNOTIFY,
00080 DELNOTIFY,
00081 LICENSETOCONFIRM,
00082
00083 NUM_TAGS
00084 };
00085
00086 private:
00087
00088 const Pathname _file;
00089 std::ifstream _stream;
00090 std::string _version;
00091
00092 TaggedParser _parser;
00093 TaggedFile::TagSet _tagset;
00094 TagCacheRetrievalPtr _retrieval;
00095
00096 private:
00097
00098 void getData( Entry & entry_r );
00099
00100 public:
00101
00102 ULParsePackagesLang( const Pathname & file_r );
00103 ~ULParsePackagesLang();
00104
00105 TagCacheRetrievalPtr getRetrieval() { return _retrieval; }
00106
00107 TaggedFile::assignstatus getEntry( Entry & entry_r );
00108
00109 Entry noEntry() const { return Entry( PkgIdent(), _retrieval ); }
00110 };
00111
00113
00114 #endif // ULParsePackagesLang_h