13 #include <zypp/base/Logger.h> 66 void IniDict::consume(
const std::string §ion,
const std::string &key,
const std::string &value )
68 _dict[section][key] = value;
74 SectionSet::const_iterator secit =
_dict.find(section);
75 if ( secit ==
_dict.end() )
80 return (secit->second).begin();
85 SectionSet::const_iterator secit =
_dict.find(section);
86 if ( secit ==
_dict.end() )
91 return (secit->second).end();
96 SectionSet::const_iterator secit =
_dict.find(section);
97 if ( secit ==
_dict.end() )
102 return makeIterable( (secit->second).begin(), (secit->second).end() );
121 const std::string &key,
122 const std::string &value )
124 consume( section, key, value );
130 _dict.erase(section);
135 SectionSet::const_iterator secit =
_dict.find(section);
136 if ( secit ==
_dict.end() )
142 const std::string &entry )
const 144 SectionSet::const_iterator secit =
_dict.find(section);
145 if ( secit ==
_dict.end() )
148 EntrySet::const_iterator entryit = (secit->second).find(entry);
149 if ( entryit == (secit->second).end() )
166 str <<
"[" << *si <<
"]" << endl;
171 str << ei->first <<
" = " << ei->second << endl;
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
entry_const_iterator entriesEnd(const std::string §ion) const
EntrySet _empty_map
empty map used to simulate iteration in non existant sections
void deleteSection(const std::string §ion)
add an entry
virtual void consume(const std::string §ion)
Called when a section is found.
IniDict()
Creates a mepty dictionary.
entry_const_iterator entriesBegin(const std::string §ion) const
Iterable< entry_const_iterator > entries(const std::string §ion) const
Iterable< section_const_iterator > sections() const
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const IniDict &obj)
bool hasEntry(const std::string §ion, const std::string &entry) const
True if an entry exists in the section.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
void read(const InputStream &is, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Fill a dictionary from a InputStream containing a ini structured file.
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_begin(const TMap &map_r)
Convenience to create the key iterator from container::begin()
void insertEntry(const std::string §ion, const std::string &key, const std::string &value)
add an entry
section_const_iterator sectionsEnd() const
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_end(const TMap &map_r)
Convenience to create the key iterator from container::end()
bool hasSection(const std::string §ion) const
True if there is a section with that name.
Parses a INI file and offers its structure as a dictionary.
section_const_iterator sectionsBegin() const
EntrySet::const_iterator entry_const_iterator
Easy-to use interface to the ZYPP dependency resolver.