libzypp 17.32.5
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/ResObject.h>
19
21namespace zypp
22{
23
25
27 //
28 // CLASS NAME : Product
29 //
32 class Product : public ResObject
33 {
34 public:
35 using Self = Product;
37 using Ptr = TraitsType::PtrType;
38 using constPtr = TraitsType::constPtrType;
39
40 public:
45
49 std::string referenceFilename() const;
50
69 CapabilitySet droplist() const;
70
71 public:
72 /***/
73 using ReplacedProducts = std::vector<constPtr>;
74
79
81 std::string productLine() const;
82
83 public:
85 std::string shortName() const;
86
88 std::string flavor() const;
89
95 std::string type() const;
96
98 std::list<std::string> flags() const;
99
104 Date endOfLife() const;
105
111 bool hasEndOfLife() const;
117 bool hasEndOfLife( Date & value ) const;
118
120 std::vector<Repository::ContentIdentifier> updateContentIdentifier() const;
121
124
126 template <class TIterator>
127 bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
128 {
129 for_( it, begin, end )
131 return true;
132 return false;
133 }
134
135 public:
139 bool isTargetDistribution() const;
140
144 std::string registerTarget() const;
145
149 std::string registerRelease() const;
150
154 std::string registerFlavor() const;
155
156 public:
157 /***/
158 class UrlList;
159
166 UrlList urls( const std::string & key_r ) const;
167
169 UrlList releaseNotesUrls() const;
170
172 UrlList registerUrls() const;
173
175 UrlList smoltUrls() const;
176
181 UrlList updateUrls() const;
182
187 UrlList extraUrls() const;
188
194 UrlList optionalUrls() const;
195
196 protected:
197 friend Ptr make<Self>( const sat::Solvable & solvable_r );
201 ~Product() override;
202 };
203
209 {
210 private:
212 using ListType = std::list<Url>;
213
214 public:
215 using value_type = ListType::value_type;
216 using size_type = ListType::size_type;
217 using const_iterator = ListType::const_iterator;
218
219 bool empty() const
220 { return _list.empty(); }
221
223 { return _list.size(); }
224
226 { return _list.begin(); }
227
229 { return _list.end(); }
230
232 Url first() const
233 { return empty() ? value_type() : _list.front(); }
234
235 public:
237 std::string key() const
238 { return _key; }
239
240 private:
241 friend class Product;
243 std::string _key;
245 };
246
248 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
249
251} // namespace zypp
253#endif // ZYPP_PRODUCT_H
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
Store and operate on date (time_t).
Definition Date.h:33
Helper to iterate a products URL lists.
Definition Product.h:209
ListType::size_type size_type
Definition Product.h:216
const_iterator end() const
Definition Product.h:228
ListType::const_iterator const_iterator
Definition Product.h:217
size_type size() const
Definition Product.h:222
Url first() const
The first Url or an empty Url.
Definition Product.h:232
bool empty() const
Definition Product.h:219
std::list< Url > ListType
Definition Product.h:212
std::string key() const
The key used to retrieve this list (for debug)
Definition Product.h:237
ListType::value_type value_type
Definition Product.h:215
const_iterator begin() const
Definition Product.h:225
std::string _key
Change to directly iterate the .solv.
Definition Product.h:243
Product interface.
Definition Product.h:33
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
UrlList extraUrls() const
Additional software for the product They are complementary, not alternatives.
Definition Product.cc:287
TraitsType::PtrType Ptr
Definition Product.h:37
std::string flavor() const
The product flavor (LiveCD Demo, FTP edition,...).
Definition Product.cc:162
bool isTargetDistribution() const
This is the installed product that is also targeted by the /etc/products.d/baseproduct symlink.
Definition Product.cc:241
UrlList releaseNotesUrls() const
The URL to download the release notes for this product.
Definition Product.cc:283
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
UrlList registerUrls() const
The URL for registration.
Definition Product.cc:284
std::string registerTarget() const
This is register.target attribute of a product.
Definition Product.cc:244
Product(const sat::Solvable &solvable_r)
Ctor.
Definition Product.cc:50
~Product() override
Dtor.
Definition Product.cc:59
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
UrlList updateUrls() const
Online updates for the product.
Definition Product.cc:286
sat::Solvable referencePackage() const
The reference package providing the product metadata, if such a package exists.
Definition Product.cc:64
UrlList urls(const std::string &key_r) const
Retrieve URLs flagged with key_r for this product.
Definition Product.cc:255
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:73
std::string registerFlavor() const
This is register.flavor attribute of a product.
Definition Product.cc:250
std::string registerRelease() const
This is register.release attribute of an installed product.
Definition Product.cc:247
UrlList smoltUrls() const
The URL for SMOLT.
Definition Product.cc:285
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition Product.h:127
std::string productLine() const
Vendor specific string denoting the product line.
Definition Product.cc:149
TraitsType::constPtrType constPtr
Definition Product.h:38
UrlList optionalUrls() const
Optional software for the product.
Definition Product.cc:288
std::string ContentIdentifier
Definition Repository.h:49
Base for resolvable objects.
Definition ResObject.h:38
Url manipulation class.
Definition Url.h:92
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.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:28
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:638