00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_PARSER_TAGFILE2_H 00013 #define ZYPP_PARSER_TAGFILE2_H 00014 00015 #include <iosfwd> 00016 #include <map> 00017 #include <list> 00018 00019 #include <boost/regex.hpp> 00020 00021 #include "zypp/parser/ParserProgress.h" 00022 #include "zypp/parser/tagfile/ParseException.h" 00023 #include "zypp/Pathname.h" 00024 00026 namespace zypp 00027 { 00028 00029 namespace parser 00030 { 00031 00032 namespace tagfile 00033 { 00034 00035 void dumpRegexpResults( const boost::smatch &what ); 00036 void dumpRegexpResults2( const boost::smatch &what ); 00038 // 00039 // CLASS NAME : TagFileParser 00040 // 00042 class TagFileParser 00043 { 00044 public: 00045 struct MultiTag 00046 { 00047 std::string name; 00048 std::string modifier; 00049 std::list<std::string> values; 00050 }; 00051 00052 struct SingleTag 00053 { 00054 std::string name; 00055 std::string modifier; 00056 std::string value; 00057 }; 00058 00059 TagFileParser( ParserProgress::Ptr progress ); 00060 virtual ~TagFileParser() 00061 {} 00062 00063 /* Parse file and invoke consume on each tag found. 00064 * \throw ParseException 00065 * \todo more doc on Ecaptions. 00066 */ 00067 virtual void parse( const Pathname & file_r); 00068 00069 /* 00070 * Called when start parsing 00071 */ 00072 virtual void beginParse(); 00073 /* 00074 * Called when a single tag is found 00075 */ 00076 virtual void consume( const SingleTag &tag ); 00077 /* 00078 * Called when a multiple tag is found 00079 */ 00080 virtual void consume( const MultiTag &tag ); 00081 /* 00082 * Called when the parse is done 00083 */ 00084 virtual void endParse(); 00085 00086 protected: 00087 ParserProgress::Ptr _progress; 00088 Pathname _file_r; 00089 int _file_size; 00090 int _line_number; 00091 }; 00093 } // namespace parser 00096 } // namespace tagfile 00099 } // namespace zypp 00101 // 00102 #endif // ZYPP_PARSER_TAGFILE_SelectionSelFilePPARSER_H
1.5.0