libzypp 17.31.23
|
Simple INI-file parser. More...
#include <parser/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. | |
virtual void | garbageLine (const std::string §ion, const std::string &line) |
Called whenever a garbage line is found. | |
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 "<tt>,|\\/</tt>" or section lines without closing ] are considered garbage.
Definition at line 41 of file iniparser.h.
zypp::parser::IniParser::IniParser | ( | ) |
Default ctor.
Definition at line 48 of file iniparser.cc.
|
virtual |
Dtor.
Definition at line 57 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 84 of file iniparser.cc.
|
virtual |
Called when start parsing.
Definition at line 60 of file iniparser.cc.
|
virtual |
Called when a section is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 66 of file iniparser.cc.
|
virtual |
Called when a key value is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 63 of file iniparser.cc.
|
virtual |
Called when the parse is done.
Definition at line 69 of file iniparser.cc.
|
virtual |
Called whenever a garbage line is found.
ParseException | if not overloaded. |
Derived parsers may overload this to examine the line and call this method to actually throw the exception.
Used by some parsers to accept multi-line entires.
Definition at line 72 of file iniparser.cc.
|
inline |
Name of the current InputStream.
Definition at line 78 of file iniparser.h.
|
private |
Definition at line 84 of file iniparser.h.
|
private |
Definition at line 85 of file iniparser.h.
|
private |
Definition at line 86 of file iniparser.h.