libzypp 17.37.17
Product.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_PRODUCT_H
13#define ZYPP_PRODUCT_H
14
15#include <list>
16#include <string>
17
18#include <zypp/Globals.h>
19#include <zypp/ResObject.h>
20
22namespace zypp
23{
24
26
28 //
29 // CLASS NAME : Product
30 //
33 class ZYPP_API Product : public ResObject
34 {
35 public:
36 using Self = Product;
40
41 public:
46
50 std::string referenceFilename() const;
51
70 CapabilitySet droplist() const;
71
72 public:
73 /***/
74 using ReplacedProducts = std::vector<constPtr>;
75
80
82 std::string productLine() const;
83
84 public:
86 std::string shortName() const;
87
89 std::string flavor() const;
90
96 std::string type() const;
97
99 std::list<std::string> flags() const;
100
105 Date endOfLife() const;
106
112 bool hasEndOfLife() const;
118 bool hasEndOfLife( Date & value ) const;
119
121 std::vector<Repository::ContentIdentifier> updateContentIdentifier() const;
122
124 bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const;
125
127 template <class TIterator>
128 bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
129 {
130 for_( it, begin, end )
131 if ( hasUpdateContentIdentifier( *it ) )
132 return true;
133 return false;
134 }
135
136 public:
140 bool isTargetDistribution() const;
141
145 std::string registerTarget() const;
146
150 std::string registerRelease() const;
151
155 std::string registerFlavor() const;
156
157 public:
158 /***/
159 class UrlList;
160
167 UrlList urls( const std::string & key_r ) const;
168
170 UrlList releaseNotesUrls() const;
171
173 UrlList registerUrls() const;
174
176 UrlList smoltUrls() const;
177
182 UrlList updateUrls() const;
183
188 UrlList extraUrls() const;
189
195 UrlList optionalUrls() const;
196
197 protected:
198 friend Ptr make<Self>( const sat::Solvable & solvable_r );
200 Product( const sat::Solvable & solvable_r );
202 ~Product() override;
203 };
204
210 {
211 private:
213 using ListType = std::list<Url>;
214
215 public:
216 using value_type = ListType::value_type;
217 using size_type = ListType::size_type;
218 using const_iterator = ListType::const_iterator;
219
220 bool empty() const
221 { return _list.empty(); }
222
224 { return _list.size(); }
225
227 { return _list.begin(); }
228
230 { return _list.end(); }
231
233 Url first() const
234 { return empty() ? value_type() : _list.front(); }
235
236 public:
238 std::string key() const
239 { return _key; }
240
241 private:
242 friend class Product;
244 std::string _key;
246 };
247
249 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
250
252} // namespace zypp
254#endif // ZYPP_PRODUCT_H
Store and operate on date (time_t).
Definition Date.h:33
Helper to iterate a products URL lists.
Definition Product.h:210
ListType::size_type size_type
Definition Product.h:217
const_iterator end() const
Definition Product.h:229
ListType::const_iterator const_iterator
Definition Product.h:218
friend class Product
Definition Product.h:242
size_type size() const
Definition Product.h:223
Url first() const
The first Url or an empty Url.
Definition Product.h:233
bool empty() const
Definition Product.h:220
std::list< Url > ListType
Definition Product.h:213
std::string key() const
The key used to retrieve this list (for debug)
Definition Product.h:238
ListType::value_type value_type
Definition Product.h:216
const_iterator begin() const
Definition Product.h:226
std::string _key
Change to directly iterate the .solv.
Definition Product.h:244
Product interface.
Definition Product.h:34
ReplacedProducts replacedProducts() const
Array of installed Products that would be replaced by installing this one.
Definition Product.cc:120
std::list< std::string > flags() const
The product flags.
Definition Product.cc:194
TraitsType::PtrType Ptr
Definition Product.h:38
std::string flavor() const
The product flavor (LiveCD Demo, FTP edition,...).
Definition Product.cc:162
Product Self
Definition Product.h:36
ResTraits< Self > TraitsType
Definition Product.h:37
std::string shortName() const
Untranslated short name like SLES 10 (fallback: name)
Definition Product.cc:154
std::string referenceFilename() const
For installed products the name of the corresponding /etc/products.d entry.
Definition Product.cc:117
Product(const sat::Solvable &solvable_r)
Ctor.
Definition Product.cc:50
bool hasEndOfLife() const
Return whether an EndOfLife value is actually defined in the metadata.
Definition Product.cc:204
CapabilitySet droplist() const
List of packages included in older versions of this product and now dropped.
Definition Product.cc:146
bool hasUpdateContentIdentifier(const Repository::ContentIdentifier &cident_r) const
Whether cident_r is listed as required update repository.
Definition Product.cc:230
Date endOfLife() const
The date when this Product goes out of support as indicated by its medadata.
Definition Product.cc:201
sat::Solvable referencePackage() const
The reference package providing the product metadata, if such a package exists.
Definition Product.cc:64
std::string type() const
Get the product type Well, in an ideal world there is only one base product.
Definition Product.cc:191
std::vector< Repository::ContentIdentifier > updateContentIdentifier() const
ContentIdentifier of required update repositories.
Definition Product.cc:217
std::vector< constPtr > ReplacedProducts
Definition Product.h:74
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition Product.h:128
std::string productLine() const
Vendor specific string denoting the product line.
Definition Product.cc:149
TraitsType::constPtrType constPtr
Definition Product.h:39
std::string ContentIdentifier
Definition Repository.h:49
ResObject(const sat::Solvable &solvable_r)
Ctor.
Definition ResObject.cc:23
Url manipulation class.
Definition Url.h:93
A Solvable object within the sat Pool.
Definition Solvable.h:54
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Definition ResObject.h:118
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
ResTraits.
Definition ResTraits.h:80
intrusive_ptr< Self > PtrType
Definition ResTraits.h:82
intrusive_ptr< const Self > constPtrType
Definition ResTraits.h:83
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639