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

ULParsePackagesLang.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:       ULParsePackagesLang.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose:
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 //      CLASS NAME : ULParsePackagesLang
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     // Tag ids for the TaggedParser
00075     enum Tags {
00076       PACKAGE,          // name version release arch
00077       SUMMARY,          // short summary (label)
00078       DESCRIPTION,      // long description
00079       INSNOTIFY,        // install notification
00080       DELNOTIFY,        // delete notification
00081       LICENSETOCONFIRM, // license to confirm upon install
00082       // LAST ENTRY:
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

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