libzypp 9.41.1
|
Simple INI-file parser. More...
#include <IniParser.h>
Public Member Functions | |
IniParser () | |
Default ctor. | |
virtual | ~IniParser () |
Dtor. | |
void | parse (const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
Parse the stream. | |
virtual void | beginParse () |
Called when start parsing. | |
virtual void | consume (const std::string §ion) |
Called when a section is found. | |
virtual void | consume (const std::string §ion, const std::string &key, const std::string &value) |
Called when a key value is found. | |
virtual void | endParse () |
Called when the parse is done. | |
const std::string & | inputname () const |
Name of the current InputStream. | |
Private Attributes | |
std::string | _inputname |
std::string | _current_section |
int | _line_nr |
Simple INI-file parser.
Lines staring with ; or
#
are treated as comment. Section names are enclosed by []
. Key and value are separated by =
.
Lines without =
or with a key containing any of ":/?|,\\"
are reported as value with an empty key (maybe multiline entries). Section lines without closing ] are considered garbage.
Definition at line 42 of file IniParser.h.
zypp::parser::IniParser::IniParser | ( | ) |
Default ctor.
Definition at line 46 of file IniParser.cc.
zypp::parser::IniParser::~IniParser | ( | ) | [virtual] |
Dtor.
Definition at line 55 of file IniParser.cc.
void zypp::parser::IniParser::parse | ( | const InputStream & | imput_r, |
const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() |
||
) |
Parse the stream.
ParseException | on errors. Invoke consume for each tag. consume might throw other exceptions as well. |
Definition at line 75 of file IniParser.cc.
References _current_section, _inputname, _line_nr, beginParse(), consume(), endParse(), zypp::str::form(), zypp::iostr::EachLine::lineNo(), zypp::str::ltrim(), zypp::makeProgressData(), MIL, zypp::InputStream::name(), zypp::iostr::EachLine::next(), zypp::str::rtrim(), zypp::ProgressData::sendTo(), zypp::ProgressData::set(), zypp::InputStream::stream(), zypp::ProgressData::toMax(), zypp::ProgressData::toMin(), zypp::str::trim(), and ZYPP_THROW.
void zypp::parser::IniParser::beginParse | ( | ) | [virtual] |
void zypp::parser::IniParser::consume | ( | const std::string & | section | ) | [virtual] |
Called when a section is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 64 of file IniParser.cc.
Referenced by parse().
void zypp::parser::IniParser::consume | ( | const std::string & | section, |
const std::string & | key, | ||
const std::string & | value | ||
) | [virtual] |
Called when a key value is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 61 of file IniParser.cc.
void zypp::parser::IniParser::endParse | ( | ) | [virtual] |
const std::string& zypp::parser::IniParser::inputname | ( | ) | const [inline] |
std::string zypp::parser::IniParser::_inputname [private] |
Definition at line 74 of file IniParser.h.
Referenced by inputname(), and parse().
std::string zypp::parser::IniParser::_current_section [private] |
Definition at line 75 of file IniParser.h.
Referenced by parse().
int zypp::parser::IniParser::_line_nr [private] |
Definition at line 76 of file IniParser.h.
Referenced by parse().