|
libzypp 17.38.1
|
Simple INI-file parser. More...
#include <zypp-core/parser/iniparser.h>

Public Member Functions | |
| IniParser () | |
| Default ctor. | |
| IniParser (IniParser &&) | |
| Being NonCopyable is a legacy but allow at least moving. | |
| IniParser & | operator= (IniParser &&) |
| 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.
| zypp::parser::IniParser::IniParser | ( | IniParser && | rhs | ) |
Being NonCopyable is a legacy but allow at least moving.
It's a design flaw that data storing classes like IniDict inherit from IniParser rather than just using it to fill their data store. But we can allow moving the parsed data around.
Definition at line 52 of file iniparser.cc.
|
virtual |
Dtor.
Definition at line 63 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 90 of file iniparser.cc.
|
virtual |
Called when start parsing.
Definition at line 66 of file iniparser.cc.
|
virtual |
Called when a section is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 72 of file iniparser.cc.
|
virtual |
Called when a key value is found.
Reimplemented in zypp::parser::IniDict.
Definition at line 69 of file iniparser.cc.
|
virtual |
Called when the parse is done.
Definition at line 75 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 78 of file iniparser.cc.
|
inline |
Name of the current InputStream.
Definition at line 88 of file iniparser.h.
|
private |
Definition at line 94 of file iniparser.h.
|
private |
Definition at line 95 of file iniparser.h.
|
private |
Definition at line 96 of file iniparser.h.