12#ifndef ZYPP_PARSER_INIDICT_H
13#define ZYPP_PARSER_INIDICT_H
20#include <zypp-core/base/InputStream>
23#include <zypp-core/parser/IniParser>
45 using EntrySet = std::map<std::string, std::string>;
125 const std::string &key,
126 const std::string &value );
140 bool hasSection(
const std::string §ion )
const;
150 bool hasEntry(
const std::string §ion,
151 const std::string &entry )
const;
155 void consume(
const std::string §ion )
override;
157 void consume(
const std::string §ion,
158 const std::string &key,
159 const std::string &value )
override;
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.
IniDict(IniDict &&)=default
Move CTor.
section_const_iterator sectionsEnd() const
friend std::ostream & operator<<(std::ostream &str, const IniDict &obj)
std::map< std::string, EntrySet > SectionSet
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
IniDict & operator=(IniDict &&)=default
IniDict(const InputStream &is, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Creates a dictionary from a InputStream containing a ini structured file.
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
std::ostream & dumpOn(std::ostream &str, const IniDict &obj)
Dump as single ini-file.
void insertEntry(const std::string §ion, const std::string &key, const std::string &value)
add an entry
void consume(const std::string §ion) override
Called when a section is found.
std::map< std::string, std::string > EntrySet
section_const_iterator sectionsBegin() const
bool hasEntry(const std::string §ion, const std::string &entry) const
True if an entry exists in the section.
std::ostream & dumpAsIniOn(std::ostream &str) const
Dump the collected iniMap as ini-file.
EntrySet _empty_map
empty map used to simulate iteration in non-existent sections
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
EntrySet::const_iterator entry_const_iterator
entry_const_iterator entriesEnd(const std::string §ion) const
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const IniDict &obj)
transform_iterator< GetPairFirst< typename MapType::value_type >, typename MapType::const_iterator > Key_const_iterator
The key iterator type.