libzypp  13.10.6
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 {
27 namespace parser
29 {
30 
32 //
33 // CLASS NAME : IniParser
34 //
39 {
40 public:
42  IniParser();
44  virtual ~IniParser();
50  void parse( const InputStream & imput_r, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
51 
52 public:
54  virtual void beginParse();
56  virtual void consume( const std::string &section );
58  virtual void consume( const std::string &section, const std::string &key, const std::string &value );
60  virtual void endParse();
61 public:
63  const std::string & inputname() const
64  {
65  return _inputname;
66  }
67 
68 private:
69  std::string _inputname;
70  std::string _current_section;
71  int _line_nr;
72  //ProgressData _ticks;
73 };
74 
76 } // namespace parser
79 } // namespace zypp
81 #endif // ZYPP_PARSER_INIPARSER_H
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
Definition: IniParser.cc:67
IniParser()
Default ctor.
Definition: IniParser.cc:38
Helper to create and pass std::istream.
Definition: InputStream.h:56
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition: ProgressData.h:144
std::string _inputname
Definition: IniParser.h:69
std::string _current_section
Definition: IniParser.h:70
virtual ~IniParser()
Dtor.
Definition: IniParser.cc:47
virtual void beginParse()
Called when start parsing.
Definition: IniParser.cc:50
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
Basic SUSEtags parser.
Definition: IniParser.h:38
virtual void endParse()
Called when the parse is done.
Definition: IniParser.cc:59
const std::string & inputname() const
Name of the current InputStream.
Definition: IniParser.h:63
virtual void consume(const std::string &section)
Called when a section is found.
Definition: IniParser.cc:56