libzypp 17.37.10

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-core/base/InputStream>
21
22#include <zypp-core/ui/ProgressData>
23
25 namespace zypp
26{
27
29 namespace parser
30 {
32 namespace susetags
33 {
34
35 class RepoIndex;
36 DEFINE_PTR_TYPE(RepoIndex);
37
39 //
40 // CLASS NAME : ContentFileReader
41 //
45 class ContentFileReader : private base::NonCopyable
46 {
47 public:
48 using RepoIndexConsumer = function<void (const RepoIndex_Ptr &)>;
49
50 public:
52 ContentFileReader();
54 virtual ~ContentFileReader();
61 virtual void parse( const InputStream & imput_r,
62 const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
63
64 public:
66 void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
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 struct Impl;
89 RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
90 RepoIndexConsumer _repoIndexConsumer;
91 };
92
93
95 } // namespace susetags
98 } // namespace parser
101} // namespace zypp
103#endif // ZYPP_PARSER_SUSETAGS_CONTENTFILEREADER_H
Impl
zypp::InputStream
Helper to create and pass std::istream.
Definition inputstream.h:57
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition progressdata.h:140
zypp::parser::susetags::ContentFileReader::userRequestedAbort
virtual void userRequestedAbort(unsigned lineNo_r)
Called when user(callback) request to abort.
Definition ContentFileReader.cc:149
zypp::parser::susetags::ContentFileReader::parse
virtual void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
Parse the stream.
Definition ContentFileReader.cc:175
zypp::parser::susetags::ContentFileReader::RepoIndexConsumer
function< void(const RepoIndex_Ptr &)> RepoIndexConsumer
Definition ContentFileReader.h:48
zypp::parser::susetags::ContentFileReader::setRepoIndexConsumer
void setRepoIndexConsumer(const RepoIndexConsumer &fnc_r)
Consumer to call when repo index was parsed.
Definition ContentFileReader.h:66
zypp::parser::susetags::ContentFileReader::ContentFileReader
ContentFileReader()
Default ctor.
Definition ContentFileReader.cc:102
zypp::parser::susetags::ContentFileReader::endParse
virtual void endParse()
Called when the parse is done.
Definition ContentFileReader.cc:131
zypp::parser::susetags::ContentFileReader::errPrefix
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.
Definition ContentFileReader.cc:159
zypp::parser::susetags::ContentFileReader::_pimpl
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Definition ContentFileReader.h:89
zypp::parser::susetags::ContentFileReader::~ContentFileReader
virtual ~ContentFileReader()
Dtor.
Definition ContentFileReader.cc:110
zypp::parser::susetags::ContentFileReader::_repoIndexConsumer
RepoIndexConsumer _repoIndexConsumer
Definition ContentFileReader.h:90
zypp::parser::susetags::ContentFileReader::beginParse
virtual void beginParse()
Called when start parsing.
Definition ContentFileReader.cc:118
zypp::parser::susetags::RepoIndex
Repository content data (from /content file).
Definition RepoIndex.h:49
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::parser::susetags
Definition ContentFileReader.cc:36
zypp::parser
Definition HistoryLogReader.cc:30
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
Function.h
NonCopyable.h
PtrTypes.h