19#include <zypp-core/base/Logger.h>
69 void IniDict::consume(
const std::string §ion,
const std::string &key,
const std::string &value )
71 _dict[section][key] = value;
77 SectionSet::const_iterator secit =
_dict.find(section);
78 if ( secit ==
_dict.end() )
83 return (secit->second).begin();
88 SectionSet::const_iterator secit =
_dict.find(section);
89 if ( secit ==
_dict.end() )
94 return (secit->second).end();
99 SectionSet::const_iterator secit =
_dict.find(section);
100 if ( secit ==
_dict.end() )
105 return makeIterable( (secit->second).begin(), (secit->second).end() );
124 const std::string &key,
125 const std::string &value )
127 consume( section, key, value );
133 _dict.erase(section);
138 SectionSet::const_iterator secit =
_dict.find(section);
139 if ( secit ==
_dict.end() )
145 const std::string &entry )
const
147 SectionSet::const_iterator secit =
_dict.find(section);
148 if ( secit ==
_dict.end() )
151 EntrySet::const_iterator entryit = (secit->second).find(entry);
152 if ( entryit == (secit->second).end() )
169 str <<
"[" << *si <<
"]" << endl;
174 str << ei->first <<
" = " << ei->second << endl;
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Parses a INI file and offers its structure as a dictionary.
section_const_iterator sectionsEnd() const
void read(const InputStream &is, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Fill a dictionary from a InputStream containing a ini structured file.
bool hasSection(const std::string §ion) const
True if there is a section with that name.
void deleteSection(const std::string §ion)
add an entry
EntrySet::const_iterator entry_const_iterator
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
Iterable< section_const_iterator > sections() const
entry_const_iterator entriesBegin(const std::string §ion) const
Iterable< entry_const_iterator > entries(const std::string §ion) const
void insertEntry(const std::string §ion, const std::string &key, const std::string &value)
add an entry
section_const_iterator sectionsBegin() const
bool hasEntry(const std::string §ion, const std::string &entry) const
True if an entry exists in the section.
IniDict()
Creates a mepty dictionary.
virtual void consume(const std::string §ion)
Called when a section is found.
EntrySet _empty_map
empty map used to simulate iteration in non-existent sections
entry_const_iterator entriesEnd(const std::string §ion) const
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const ProductFileData &obj)
Easy-to use interface to the ZYPP dependency resolver.
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_begin(const TMap &map_r)
Convenience to create the key iterator from container::begin()
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_end(const TMap &map_r)
Convenience to create the key iterator from container::end()