libzypp  13.10.6
ContentFileReader.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
13 #define ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/base/PtrTypes.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/Function.h"
20 #include "zypp/base/InputStream.h"
21 
22 #include "zypp/ProgressData.h"
23 
25 namespace zypp
26 {
27 
29  namespace parser
30  {
31  namespace susetags
33  {
34 
35  class RepoIndex;
36  DEFINE_PTR_TYPE(RepoIndex);
37 
39  //
40  // CLASS NAME : ContentFileReader
41  //
46  {
47  public:
48  typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer;
49 
50  public:
54  virtual ~ContentFileReader();
61  virtual void parse( const InputStream & imput_r,
63 
64  public:
67  { _repoIndexConsumer = fnc_r; }
68 
69  protected:
71  virtual void beginParse();
73  virtual void endParse();
74 
75  protected:
79  virtual void userRequestedAbort( unsigned lineNo_r );
80 
81  protected:
83  std::string errPrefix( unsigned lineNo_r,
84  const std::string & msg_r = std::string(),
85  const std::string & line_r = "-" ) const;
86 
87  private:
88  class Impl;
91  };
93 
95  } // namespace susetags
98  } // namespace parser
101 } // namespace zypp
103 #endif // ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
DEFINE_PTR_TYPE(RepoIndex)
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
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 errPrefix(unsigned lineNo_r, const std::string &msg_r=std::string(), const std::string &line_r="-") const
Prefix exception message with line information.
virtual void userRequestedAbort(unsigned lineNo_r)
Called when user(callback) request to abort.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
Parse repoindex part from a content file.
virtual void beginParse()
Called when start parsing.
void setRepoIndexConsumer(const RepoIndexConsumer &fnc_r)
Consumer to call when repo index was parsed.
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:265
virtual void endParse()
Called when the parse is done.
function< void(const RepoIndex_Ptr &)> RepoIndexConsumer
virtual void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
Parse the stream.