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/tagfile/ParseException.h" 00022 #include "zypp/Pathname.h" 00023 00025 namespace zypp 00026 { 00027 00028 namespace parser 00029 { 00030 00031 namespace tagfile 00032 { 00033 00034 void dumpRegexpResults( const boost::smatch &what ); 00035 void dumpRegexpResults2( const boost::smatch &what ); 00037 // 00038 // CLASS NAME : TagFileParser 00039 // 00041 struct TagFileParser 00042 { 00043 Pathname _file_r; 00044 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(); 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 }; 00087 } // namespace parser 00090 } // namespace tagfile 00093 } // namespace zypp 00095 // 00096 #endif // ZYPP_PARSER_TAGFILE_SelectionSelFilePPARSER_H