libzypp  10.5.0
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 
00032 //
00033 //      CLASS NAME : IniParser
00034 //
00038 class IniParser : private base::NonCopyable
00039 {
00040 public:
00042   IniParser();
00044   virtual ~IniParser();
00050   void parse( const InputStream & imput_r, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
00051 
00052 public:
00054   virtual void beginParse();
00056   virtual void consume( const std::string &section );
00058   virtual void consume( const std::string &section, const std::string &key, const std::string &value );
00060   virtual void endParse();
00061 public:
00063   const std::string & inputname() const
00064   {
00065     return _inputname;
00066   }
00067 
00068 private:
00069   std::string _inputname;
00070   std::string _current_section;
00071   int _line_nr;
00072   //ProgressData _ticks;
00073 };
00074 
00076 } // namespace parser
00079 } // namespace zypp
00081 #endif // ZYPP_PARSER_INIPARSER_H