libzypp  11.13.5
IniDict.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_PARSER_INIDICT_H
13 #define ZYPP_PARSER_INIDICT_H
14 
15 #include <iosfwd>
16 #include <map>
17 #include <string>
18 
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/base/InputStream.h"
21 #include "zypp/base/Iterator.h"
22 #include "zypp/parser/IniParser.h"
23 
25 namespace zypp
26 {
27 
28  namespace parser
29  {
30 
32  //
33  // CLASS NAME : IniDict
34  //
40  class IniDict : public IniParser
41  {
42  friend std::ostream & operator<<( std::ostream & str, const IniDict & obj );
43  public:
44  typedef std::map<std::string, std::string> EntrySet;
45  typedef std::map<std::string, EntrySet> SectionSet;
47  typedef EntrySet::const_iterator entry_const_iterator;
48 
65 
80  entry_const_iterator entriesBegin(const std::string &section) const;
81  entry_const_iterator entriesEnd(const std::string &section) const;
83 
88  IniDict( const InputStream &is,
90 
94  IniDict();
95 
97  ~IniDict();
98 
103  void read( const InputStream &is,
105 
112  void insertEntry( const std::string &section,
113  const std::string &key,
114  const std::string &value );
115 
122  void deleteSection( const std::string &section );
123 
128  bool hasSection( const std::string &section ) const;
129 
138  bool hasEntry( const std::string &section,
139  const std::string &entry ) const;
140  public:
141 
143  virtual void consume( const std::string &section );
145  virtual void consume( const std::string &section,
146  const std::string &key,
147  const std::string &value );
148 
149  private:
157  };
159 
161  std::ostream & operator<<( std::ostream & str, const IniDict & obj );
162 
164  } // namespace parser
167 } // namespace zypp
169 #endif // ZYPP_PARSER_INIDICT_H