libzypp  10.5.0
ContentFileReader.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
00013 #define ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/base/PtrTypes.h"
00018 #include "zypp/base/NonCopyable.h"
00019 #include "zypp/base/Function.h"
00020 #include "zypp/base/InputStream.h"
00021 
00022 #include "zypp/ProgressData.h"
00023 
00025 namespace zypp
00026 { 
00027 
00029   namespace parser
00030   { 
00031 
00032     namespace susetags
00033     { 
00034 
00035       class RepoIndex;
00036       DEFINE_PTR_TYPE(RepoIndex);
00037 
00039       //
00040       //        CLASS NAME : ContentFileReader
00041       //
00045       class ContentFileReader : private base::NonCopyable
00046       {
00047         public:
00048           typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer;
00049 
00050         public:
00052           ContentFileReader();
00054           virtual ~ContentFileReader();
00061           virtual void parse( const InputStream & imput_r,
00062                               const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
00063 
00064         public:
00066           void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
00067           { _repoIndexConsumer = fnc_r; }
00068 
00069         protected:
00071           virtual void beginParse();
00073           virtual void endParse();
00074 
00075         protected:
00079           virtual void userRequestedAbort( unsigned lineNo_r );
00080 
00081         protected:
00083           std::string errPrefix( unsigned lineNo_r,
00084                                  const std::string & msg_r = std::string(),
00085                                  const std::string & line_r = "-" ) const;
00086 
00087         private:
00088           class Impl;
00089           RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
00090           RepoIndexConsumer _repoIndexConsumer;
00091       };
00093 
00095     } // namespace susetags
00098   } // namespace parser
00101 } // namespace zypp
00103 #endif // ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H