libzypp: zypp/Product.h Source File

libzypp 17.38.6

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-core/Globals.h>
19#include <zypp/ResObject.h>
20
22namespace zypp
23{
24
25 DEFINE_PTR_TYPE(Product);
26
28 //
29 // CLASS NAME : Product
30 //
33 class ZYPP_API Product : public ResObject
34 {
35 public:
36 using Self = Product;
37 using TraitsType = ResTraits<Self>;
38 using Ptr = TraitsType::PtrType;
39 using constPtr = TraitsType::constPtrType;
40
41 public:
45 sat::Solvable referencePackage() const;
46
50 std::string referenceFilename() const;
51
70 CapabilitySet droplist() const;
71
72 public:
73 /***/
74 using ReplacedProducts = std::vector<constPtr>;
75
79 ReplacedProducts replacedProducts() const;
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
209 class Product::UrlList
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
223 size_type size() const
224 { return _list.size(); }
225
226 const_iterator begin() const
227 { return _list.begin(); }
228
229 const_iterator end() const
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;
245 ListType _list;
246 };
247
249 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
250
252} // namespace zypp
254#endif // ZYPP_PRODUCT_H
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
Globals.h
Provides API related macros.
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
ResObject.h
zypp::Date
Store and operate on date (time_t).
Definition Date.h:33
zypp::Product::UrlList
Helper to iterate a products URL lists.
Definition Product.h:210
zypp::Product::UrlList::size_type
ListType::size_type size_type
Definition Product.h:217
zypp::Product::UrlList::end
const_iterator end() const
Definition Product.h:229
zypp::Product::UrlList::const_iterator
ListType::const_iterator const_iterator
Definition Product.h:218
zypp::Product::UrlList::Product
friend class Product
Definition Product.h:242
zypp::Product::UrlList::_list
ListType _list
Definition Product.h:245
zypp::Product::UrlList::size
size_type size() const
Definition Product.h:223
zypp::Product::UrlList::first
Url first() const
The first Url or an empty Url.
Definition Product.h:233
zypp::Product::UrlList::empty
bool empty() const
Definition Product.h:220
zypp::Product::UrlList::ListType
std::list< Url > ListType
Definition Product.h:213
zypp::Product::UrlList::key
std::string key() const
The key used to retrieve this list (for debug).
Definition Product.h:238
zypp::Product::UrlList::value_type
ListType::value_type value_type
Definition Product.h:216
zypp::Product::UrlList::begin
const_iterator begin() const
Definition Product.h:226
zypp::Product::UrlList::_key
std::string _key
Change to directly iterate the .solv.
Definition Product.h:244
zypp::Product
Product interface.
Definition Product.h:34
zypp::Product::replacedProducts
ReplacedProducts replacedProducts() const
Array of installed Products that would be replaced by installing this one.
Definition Product.cc:138
zypp::Product::flags
std::list< std::string > flags() const
The product flags.
Definition Product.cc:212
zypp::Product::Ptr
TraitsType::PtrType Ptr
Definition Product.h:38
zypp::Product::flavor
std::string flavor() const
The product flavor (LiveCD Demo, FTP edition,...).
Definition Product.cc:180
zypp::Product::Self
Product Self
Definition Product.h:36
zypp::Product::TraitsType
ResTraits< Self > TraitsType
Definition Product.h:37
zypp::Product::shortName
std::string shortName() const
Untranslated short name like SLES 10 (fallback: name).
Definition Product.cc:172
zypp::Product::referenceFilename
std::string referenceFilename() const
For installed products the name of the corresponding /etc/products.d entry.
Definition Product.cc:135
zypp::Product::Product
Product(const sat::Solvable &solvable_r)
Ctor.
Definition Product.cc:64
zypp::Product::hasEndOfLife
bool hasEndOfLife() const
Return whether an EndOfLife value is actually defined in the metadata.
Definition Product.cc:222
zypp::Product::droplist
CapabilitySet droplist() const
List of packages included in older versions of this product and now dropped.
Definition Product.cc:164
zypp::Product::hasUpdateContentIdentifier
bool hasUpdateContentIdentifier(const Repository::ContentIdentifier &cident_r) const
Whether cident_r is listed as required update repository.
Definition Product.cc:248
zypp::Product::endOfLife
Date endOfLife() const
The date when this Product goes out of support as indicated by its medadata.
Definition Product.cc:219
zypp::Product::referencePackage
sat::Solvable referencePackage() const
The reference package providing the product metadata, if such a package exists.
Definition Product.cc:78
zypp::Product::type
std::string type() const
Get the product type Well, in an ideal world there is only one base product.
Definition Product.cc:209
zypp::Product::updateContentIdentifier
std::vector< Repository::ContentIdentifier > updateContentIdentifier() const
ContentIdentifier of required update repositories.
Definition Product.cc:235
zypp::Product::ReplacedProducts
std::vector< constPtr > ReplacedProducts
Definition Product.h:74
zypp::Product::hasUpdateContentIdentifier
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition Product.h:128
zypp::Product::productLine
std::string productLine() const
Vendor specific string denoting the product line.
Definition Product.cc:167
zypp::Product::constPtr
TraitsType::constPtrType constPtr
Definition Product.h:39
zypp::Repository::ContentIdentifier
std::string ContentIdentifier
Definition Repository.h:49
zypp::ResObject::ResObject
ResObject(const sat::Solvable &solvable_r)
Ctor.
Definition ResObject.cc:23
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::make
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Definition ResObject.h:118
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::ResTraits
ResTraits.
Definition ResTraits.h:80
zypp::ResTraits< Self >::PtrType
intrusive_ptr< Self > PtrType
Definition ResTraits.h:82
zypp::ResTraits< Self >::constPtrType
intrusive_ptr< const Self > constPtrType
Definition ResTraits.h:83