libzypp: zypp/parser/IniParser.h Source File

libzypp 17.25.10

IniParser.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_PARSER_INIPARSER_H
13 #define ZYPP_PARSER_INIPARSER_H
14
15 #include <iosfwd>
16 #include <string>
17 #include <list>
18
19 #include <zypp/base/PtrTypes.h>
20 #include <zypp/base/NonCopyable.h>
21 #include <zypp/base/InputStream.h>
22 #include <zypp/ProgressData.h>
23
25 namespace zypp
26 {
28 namespace parser
29 {
30
41 class IniParser : private base::NonCopyable
42 {
43 public:
45 IniParser();
47 virtual ~IniParser();
53 void parse( const InputStream & imput_r, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
54
55 public:
57 virtual void beginParse();
59 virtual void consume( const std::string &section );
61 virtual void consume( const std::string &section, const std::string &key, const std::string &value );
63 virtual void endParse();
64
74 virtual void garbageLine( const std::string &section, const std::string &line );
75
76 public:
78 const std::string & inputname() const
79 {
80 return _inputname;
81 }
82
83 private:
84 std::string _inputname;
85 std::string _current_section;
86 int _line_nr;
87 //ProgressData _ticks;
88 };
89
91 } // namespace parser
94 } // namespace zypp
96 #endif // ZYPP_PARSER_INIPARSER_H
InputStream.h
NonCopyable.h
ProgressData.h
PtrTypes.h
zypp::InputStream
Helper to create and pass std::istream.
Definition: InputStream.h:57
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition: ProgressData.h:139
zypp::parser::IniParser
Simple INI-file parser.
Definition: IniParser.h:42
zypp::parser::IniParser::inputname
const std::string & inputname() const
Name of the current InputStream.
Definition: IniParser.h:78
zypp::parser::IniParser::_inputname
std::string _inputname
Definition: IniParser.h:84
zypp::parser::IniParser::_line_nr
int _line_nr
Definition: IniParser.h:86
zypp::parser::IniParser::garbageLine
virtual void garbageLine(const std::string &section, const std::string &line)
Called whenever a garbage line is found.
Definition: IniParser.cc:70
zypp::parser::IniParser::~IniParser
virtual ~IniParser()
Dtor.
Definition: IniParser.cc:55
zypp::parser::IniParser::beginParse
virtual void beginParse()
Called when start parsing.
Definition: IniParser.cc:58
zypp::parser::IniParser::IniParser
IniParser()
Default ctor.
Definition: IniParser.cc:46
zypp::parser::IniParser::_current_section
std::string _current_section
Definition: IniParser.h:85
zypp::parser::IniParser::consume
virtual void consume(const std::string &section)
Called when a section is found.
Definition: IniParser.cc:64
zypp::parser::IniParser::endParse
virtual void endParse()
Called when the parse is done.
Definition: IniParser.cc:67
zypp::parser::IniParser::parse
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
Definition: IniParser.cc:82
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2