00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_PARSER_INIDICT_H 00013 #define ZYPP_PARSER_INIDICT_H 00014 00015 #include <iosfwd> 00016 #include <map> 00017 #include <string> 00018 00019 #include "zypp/base/PtrTypes.h" 00020 #include "zypp/base/InputStream.h" 00021 #include "zypp/base/Iterator.h" 00022 #include "zypp/parser/IniParser.h" 00023 00025 namespace zypp 00026 { 00027 00028 namespace parser 00029 { 00030 00032 // 00033 // CLASS NAME : IniDict 00034 // 00040 class IniDict : public IniParser 00041 { 00042 friend std::ostream & operator<<( std::ostream & str, const IniDict & obj ); 00043 public: 00044 typedef std::map<std::string, std::string> EntrySet; 00045 typedef std::map<std::string, EntrySet> SectionSet; 00046 typedef MapKVIteratorTraits<SectionSet>::Key_const_iterator section_const_iterator; 00047 typedef EntrySet::const_iterator entry_const_iterator; 00048 00062 section_const_iterator sectionsBegin() const; 00063 section_const_iterator sectionsEnd() const; 00065 00080 entry_const_iterator entriesBegin(const std::string §ion) const; 00081 entry_const_iterator entriesEnd(const std::string §ion) const; 00083 00088 IniDict( const InputStream &is ); 00089 00093 IniDict(); 00094 00096 ~IniDict(); 00097 00102 void read( const InputStream &is ); 00103 00110 void insertEntry( const std::string §ion, 00111 const std::string &key, 00112 const std::string &value ); 00113 00120 void deleteSection( const std::string §ion ); 00121 00126 bool hasSection( const std::string §ion ) const; 00127 00136 bool hasEntry( const std::string §ion, 00137 const std::string &entry ) const; 00138 public: 00139 00141 virtual void consume( const std::string §ion ); 00143 virtual void consume( const std::string §ion, 00144 const std::string &key, 00145 const std::string &value ); 00146 00147 private: 00148 SectionSet _dict; 00154 EntrySet _empty_map; 00155 }; 00157 00159 std::ostream & operator<<( std::ostream & str, const IniDict & obj ); 00160 00162 } // namespace parser 00165 } // namespace zypp 00167 #endif // ZYPP_PARSER_INIDICT_H
1.4.6