libzypp 17.37.17
ProductFileReader.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_PARSER_PRODUCTSDREADER_H
13#define ZYPP_PARSER_PRODUCTSDREADER_H
14
15#include <iosfwd>
16
17#include <zypp/base/PtrTypes.h>
18#include <zypp/base/Function.h>
19#include <utility>
20#include <zypp-core/base/InputStream>
21
22#include <zypp/Pathname.h>
23#include <zypp/IdString.h>
24#include <zypp/Edition.h>
25#include <zypp/Arch.h>
26
28namespace zypp
29{
31 namespace parser
32 {
33
35 //
36 // CLASS NAME : ProductFileData
37 //
42 {
43 public:
44 struct Impl;
46 ProductFileData( Impl * allocated_r = 0 );
47
49 bool empty() const
50 { return name().empty(); }
51
52 public:
53 IdString vendor() const;
54 IdString name() const;
55 Edition edition() const;
56 Arch arch() const;
57
58 std::string shortName() const;
59 std::string summary() const;
60
61 public:
62 std::string productline() const;
63 std::string registerTarget() const;
64 std::string registerRelease() const;
65 std::string registerFlavor() const;
66
67 public:
68 std::string updaterepokey() const;
69
70 public:
72
73 struct Upgrade
74 {
75 public:
76 struct Impl;
78 Upgrade( Impl * allocated_r = 0 );
79
80 public:
81 std::string name() const;
82 std::string summary() const;
83 std::string repository() const;
84 std::string product() const;
85 bool notify() const;
86 std::string status() const;
87
88 private:
90 };
91
92
93 using Upgrades = std::vector<Upgrade>;
94 const Upgrades & upgrades() const;
95
96 private:
98 };
99
100
102 std::ostream & operator<<( std::ostream & str, const ProductFileData & obj ) ZYPP_API;
103
105 std::ostream & operator<<( std::ostream & str, const ProductFileData::Upgrade & obj ) ZYPP_API;
106
108 //
109 // CLASS NAME : ProductFileReader
110 //
122 {
123 public:
127 using Consumer = function<bool (const ProductFileData &)>;
128
129 public:
132
134 : _consumer(std::move( consumer_r ))
135 {}
136
137 ProductFileReader( Consumer consumer_r, const InputStream & input_r )
138 : _consumer(std::move( consumer_r ))
139 { parse( input_r ); }
140
141 public:
142 const Consumer & consumer() const
143 { return _consumer; }
144
145 void setConsumer( const Consumer & consumer_r )
146 { _consumer = consumer_r; }
147
148 public:
154 bool parse( const InputStream & input_r = InputStream() ) const;
155
156 public:
162 static bool scanDir( const Consumer & consumer_r, const Pathname & dir_r );
163
166 static ProductFileData scanFile( const Pathname & file_r );
167
168 private:
170 };
171
172
174 } // namespace parser
177} // namespace zypp
179#endif // ZYPP_PARSER_PRODUCTSDREADER_H
Architecture.
Definition Arch.h:37
Edition represents [epoch:]version[-release]
Definition Edition.h:61
Access to the sat-pools string space.
Definition IdString.h:44
Helper to create and pass std::istream.
Definition inputstream.h:57
Data returned by ProductFileReader.
bool empty() const
Whether this is an empty object without valid data.
ProductFileData(Impl *allocated_r=0)
Ctor takes ownership of allocated_r.
const Upgrades & upgrades() const
std::vector< Upgrade > Upgrades
const Consumer & consumer() const
ProductFileReader(Consumer consumer_r, const InputStream &input_r)
bool parse(const InputStream &input_r=InputStream()) const
Parse the input stream and call _consumer for each parsed section.
ProductFileReader(Consumer consumer_r)
function< bool(const ProductFileData &)> Consumer
Callback being invoked for each ProductFileData parsed.
void setConsumer(const Consumer &consumer_r)
Definition Arch.h:364
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const ProductFileData &obj)
Easy-to use interface to the ZYPP dependency resolver.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
Upgrade(Impl *allocated_r=0)
Ctor takes ownership of allocated_r.