libzypp 9.41.1

IniParser.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_PARSER_INIPARSER_H
00013 #define ZYPP_PARSER_INIPARSER_H
00014 
00015 #include <iosfwd>
00016 #include <string>
00017 #include <list>
00018 
00019 #include "zypp/base/PtrTypes.h"
00020 #include "zypp/base/NonCopyable.h"
00021 #include "zypp/base/InputStream.h"
00022 #include "zypp/ProgressData.h"
00023 
00025 namespace zypp
00026 { 
00027 
00028 namespace parser
00029 { 
00030 
00042 class IniParser : private base::NonCopyable
00043 {
00044 public:
00046   IniParser();
00048   virtual ~IniParser();
00054   void parse( const InputStream & imput_r, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
00055 
00056 public:
00058   virtual void beginParse();
00060   virtual void consume( const std::string &section );
00062   virtual void consume( const std::string &section, const std::string &key, const std::string &value );
00064   virtual void endParse();
00065 
00066 public:
00068   const std::string & inputname() const
00069   {
00070     return _inputname;
00071   }
00072 
00073 private:
00074   std::string _inputname;
00075   std::string _current_section;
00076   int _line_nr;
00077   //ProgressData _ticks;
00078 };
00079 
00081 } // namespace parser
00084 } // namespace zypp
00086 #endif // ZYPP_PARSER_INIPARSER_H