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 data 00030 { 00031 class Product; 00032 DEFINE_PTR_TYPE(Product); 00034 } // namespace data 00036 00038 namespace parser 00039 { 00040 00041 namespace susetags 00042 { 00043 00044 class RepoIndex; 00045 DEFINE_PTR_TYPE(RepoIndex); 00046 00048 // 00049 // CLASS NAME : ContentFileReader 00050 // 00052 class ContentFileReader : private base::NonCopyable 00053 { 00054 public: 00055 typedef function<void(const data::Product_Ptr &)> ProductConsumer; 00056 typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer; 00057 00058 public: 00060 ContentFileReader(); 00062 virtual ~ContentFileReader(); 00069 virtual void parse( const InputStream & imput_r, 00070 const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() ); 00071 00072 public: 00074 void setProductConsumer( const ProductConsumer & fnc_r ) 00075 { _productConsumer = fnc_r; } 00076 00078 void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r ) 00079 { _repoIndexConsumer = fnc_r; } 00080 00081 protected: 00083 virtual void beginParse(); 00085 virtual void endParse(); 00086 00087 protected: 00091 virtual void userRequestedAbort( unsigned lineNo_r ); 00092 00093 protected: 00095 std::string errPrefix( unsigned lineNo_r, 00096 const std::string & msg_r = std::string(), 00097 const std::string & line_r = "-" ) const; 00098 00099 private: 00100 class Impl; 00101 RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl; 00102 ProductConsumer _productConsumer; 00103 RepoIndexConsumer _repoIndexConsumer; 00104 }; 00106 00108 } // namespace susetags 00111 } // namespace parser 00114 } // namespace zypp 00116 #endif // ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
1.5.3