libzypp: zypp-core/parser/iniparser.h Source File

libzypp 17.38.11

iniparser.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CORE_PARSER_INIPARSER_H
13#define ZYPP_CORE_PARSER_INIPARSER_H
14
15#include <iosfwd>
16#include <string>
17#include <list>
18
19#include <zypp-core/base/PtrTypes.h>
20#include <zypp-core/base/NonCopyable.h>
21#include <zypp-core/base/InputStream>
22#include <zypp-core/ui/ProgressData>
23
25namespace zypp
26{
28namespace parser
29{
30
41 class IniParser : private base::NonCopyable
42{
43public:
45 IniParser();
46
53 IniParser( IniParser && );
54 IniParser & operator=( IniParser && );
55
57 virtual ~IniParser();
63 void parse( const InputStream & imput_r, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
64
65public:
67 virtual void beginParse();
69 virtual void consume( const std::string &section );
71 virtual void consume( const std::string &section, const std::string &key, const std::string &value );
73 virtual void endParse();
74
84 virtual void garbageLine( const std::string &section, const std::string &line );
85
86public:
88 const std::string & inputname() const
89 {
90 return _inputname;
91 }
92
93private:
94 std::string _inputname;
95 std::string _current_section;
96 int _line_nr;
97 //ProgressData _ticks;
98};
99
101} // namespace parser
104} // namespace zypp
106#endif // ZYPP_CORE_PARSER_INIPARSER_H
NonCopyable.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:140
zypp::parser::IniParser::_inputname
std::string _inputname
Definition iniparser.h:94
zypp::parser::IniParser::_line_nr
int _line_nr
Definition iniparser.h:96
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:78
zypp::parser::IniParser::~IniParser
virtual ~IniParser()
Dtor.
Definition iniparser.cc:63
zypp::parser::IniParser::beginParse
virtual void beginParse()
Called when start parsing.
Definition iniparser.cc:66
zypp::parser::IniParser::inputname
const std::string & inputname() const
Name of the current InputStream.
Definition iniparser.h:88
zypp::parser::IniParser::IniParser
IniParser()
Default ctor.
Definition iniparser.cc:48
zypp::parser::IniParser::_current_section
std::string _current_section
Definition iniparser.h:95
zypp::parser::IniParser::consume
virtual void consume(const std::string &section)
Called when a section is found.
Definition iniparser.cc:72
zypp::parser::IniParser::endParse
virtual void endParse()
Called when the parse is done.
Definition iniparser.cc:75
zypp::parser::IniParser::parse
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
Definition iniparser.cc:90
zypp::parser::IniParser::operator=
IniParser & operator=(IniParser &&)
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::parser
Definition HistoryLogReader.cc:30
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2