libzypp  15.28.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/ResObject.h"
19 
21 namespace zypp
22 {
23 
24  DEFINE_PTR_TYPE(Product);
25 
27  //
28  // CLASS NAME : Product
29  //
32  class Product : public ResObject
33  {
34  public:
35  typedef Product Self;
39 
40  public:
45 
49  std::string referenceFilename() const;
50 
69  CapabilitySet droplist() const;
70 
71  public:
72  /***/
73  typedef std::vector<constPtr> ReplacedProducts;
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 
101  Date endOfLife() const;
102 
104  std::vector<Repository::ContentIdentifier> updateContentIdentifier() const;
105 
107  bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const;
108 
110  template <class TIterator>
111  bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
112  {
113  for_( it, begin, end )
114  if ( hasUpdateContentIdentifier( *it ) )
115  return true;
116  return false;
117  }
118 
119  public:
123  bool isTargetDistribution() const;
124 
128  std::string registerTarget() const;
129 
133  std::string registerRelease() const;
134 
138  std::string registerFlavor() const;
139 
140  public:
141  /***/
142  class UrlList;
143 
150  UrlList urls( const std::string & key_r ) const;
151 
153  UrlList releaseNotesUrls() const;
154 
156  UrlList registerUrls() const;
157 
159  UrlList smoltUrls() const;
160 
165  UrlList updateUrls() const;
166 
171  UrlList extraUrls() const;
172 
178  UrlList optionalUrls() const;
179 
180  protected:
181  friend Ptr make<Self>( const sat::Solvable & solvable_r );
183  Product( const sat::Solvable & solvable_r );
185  virtual ~Product();
186  };
187 
193  {
194  private:
196  typedef std::list<Url> ListType;
197 
198  public:
199  typedef ListType::value_type value_type;
201  typedef ListType::const_iterator const_iterator;
202 
203  bool empty() const
204  { return _list.empty(); }
205 
206  size_type size() const
207  { return _list.size(); }
208 
210  { return _list.begin(); }
211 
213  { return _list.end(); }
214 
216  Url first() const
217  { return empty() ? value_type() : _list.front(); }
218 
219  public:
221  std::string key() const
222  { return _key; }
223 
224  private:
225  friend class Product;
227  std::string _key;
229  };
230 
232  std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
233 
235 } // namespace zypp
237 #endif // ZYPP_PRODUCT_H
Product(const sat::Solvable &solvable_r)
Ctor.
Definition: Product.cc:63
std::list< Url > ListType
Definition: Product.h:196
Product interface.
Definition: Product.h:32
const_iterator end() const
Definition: Product.h:212
A Solvable object within the sat Pool.
Definition: Solvable.h:53
size_type size() const
Definition: Product.h:206
UrlList releaseNotesUrls() const
The URL to download the release notes for this product.
Definition: Product.cc:283
intrusive_ptr< const TRes > constPtrType
Definition: ResTraits.h:83
bool empty() const
Definition: Product.h:203
Helper to iterate a products URL lists.
Definition: Product.h:192
std::string key() const
The key used to retrieve this list (for debug)
Definition: Product.h:221
Product Self
Definition: Product.h:35
UrlList registerUrls() const
The URL for registration.
Definition: Product.cc:284
UrlList optionalUrls() const
Optional software for the product.
Definition: Product.cc:288
const_iterator begin() const
Definition: Product.h:209
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
ListType::size_type size_type
Definition: Product.h:200
Date endOfLife() const
The date when this Product goes out of support as indicated by it's medadata.
Definition: Product.cc:214
UrlList extraUrls() const
Additional software for the product They are complementary, not alternatives.
Definition: Product.cc:287
ResTraits.
Definition: ResTraits.h:79
TraitsType::constPtrType constPtr
Definition: Product.h:38
std::string registerRelease() const
This is register.release attribute of an installed product.
Definition: Product.cc:247
std::string registerFlavor() const
This is register.flavor attribute of a product.
Definition: Product.cc:250
ListType::value_type value_type
Definition: Product.h:199
Url first() const
The first Url or an empty Url.
Definition: Product.h:216
Store and operate on date (time_t).
Definition: Date.h:32
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
std::string flavor() const
The product flavor (LiveCD Demo, FTP edition,...).
Definition: Product.cc:175
ListType::const_iterator const_iterator
Definition: Product.h:201
DEFINE_PTR_TYPE(Application)
sat::Solvable referencePackage() const
The reference package providing the product metadata, if such a package exists.
Definition: Product.cc:77
Base for resolvable objects.
Definition: ResObject.h:38
std::vector< Repository::ContentIdentifier > updateContentIdentifier() const
ContentIdentifier of required update repositories.
Definition: Product.cc:217
std::string type() const
Get the product type Well, in an ideal world there is only one base product.
Definition: Product.cc:204
UrlList updateUrls() const
Online updates for the product.
Definition: Product.cc:286
ReplacedProducts replacedProducts() const
Array of installed Products that would be replaced by installing this one.
Definition: Product.cc:133
SolvableIdType size_type
Definition: PoolMember.h:152
intrusive_ptr< TRes > PtrType
Definition: ResTraits.h:82
std::string ContentIdentifier
Definition: Repository.h:49
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
std::vector< constPtr > ReplacedProducts
Definition: Product.h:73
std::string shortName() const
Untranslated short name like SLES 10 (fallback: name)
Definition: Product.cc:167
CapabilitySet droplist() const
List of packages included in older versions of this product and now dropped.
Definition: Product.cc:159
bool isTargetDistribution() const
This is the installed product that is also targeted by the /etc/products.d/baseproduct symlink...
Definition: Product.cc:241
std::string productLine() const
Vendor specific string denoting the product line.
Definition: Product.cc:162
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition: Product.h:111
std::string _key
Change to directly iterate the .solv.
Definition: Product.h:227
std::string referenceFilename() const
For installed products the name of the coddesponding /etc/products.d entry.
Definition: Product.cc:130
std::list< std::string > flags() const
The product flags.
Definition: Product.cc:207
bool hasUpdateContentIdentifier(const Repository::ContentIdentifier &cident_r) const
Whether cident_r is listed as required update repository.
Definition: Product.cc:230
virtual ~Product()
Dtor.
Definition: Product.cc:72
std::string registerTarget() const
This is register.target attribute of a product.
Definition: Product.cc:244
UrlList urls(const std::string &key_r) const
Rerieve urls flagged with key_r for this product.
Definition: Product.cc:255
Url manipulation class.
Definition: Url.h:87
TraitsType::PtrType Ptr
Definition: Product.h:37
ResTraits< Self > TraitsType
Definition: Product.h:36
UrlList smoltUrls() const
The URL for SMOLT.
Definition: Product.cc:285