libzypp  17.16.0
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 
104  Date endOfLife() const;
105 
111  bool hasEndOfLife() const;
117  bool hasEndOfLife( Date & value ) const;
118 
120  std::vector<Repository::ContentIdentifier> updateContentIdentifier() const;
121 
123  bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const;
124 
126  template <class TIterator>
127  bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
128  {
129  for_( it, begin, end )
130  if ( hasUpdateContentIdentifier( *it ) )
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 );
199  Product( const sat::Solvable & solvable_r );
201  virtual ~Product();
202  };
203 
209  {
210  private:
212  typedef std::list<Url> ListType;
213 
214  public:
215  typedef ListType::value_type value_type;
217  typedef ListType::const_iterator const_iterator;
218 
219  bool empty() const
220  { return _list.empty(); }
221 
222  size_type size() const
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
Product(const sat::Solvable &solvable_r)
Ctor.
Definition: Product.cc:49
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition: Product.h:127
const_iterator begin() const
Definition: Product.h:225
std::list< Url > ListType
Definition: Product.h:212
Product interface.
Definition: Product.h:32
A Solvable object within the sat Pool.
Definition: Solvable.h:53
UrlList registerUrls() const
The URL for registration.
Definition: Product.cc:283
intrusive_ptr< const TRes > constPtrType
Definition: ResTraits.h:83
UrlList updateUrls() const
Online updates for the product.
Definition: Product.cc:285
bool isTargetDistribution() const
This is the installed product that is also targeted by the /etc/products.d/baseproduct symlink.
Definition: Product.cc:240
UrlList optionalUrls() const
Optional software for the product.
Definition: Product.cc:287
std::string productLine() const
Vendor specific string denoting the product line.
Definition: Product.cc:148
Helper to iterate a products URL lists.
Definition: Product.h:208
CapabilitySet droplist() const
List of packages included in older versions of this product and now dropped.
Definition: Product.cc:145
std::string registerRelease() const
This is register.release attribute of an installed product.
Definition: Product.cc:246
UrlList smoltUrls() const
The URL for SMOLT.
Definition: Product.cc:284
std::vector< Repository::ContentIdentifier > updateContentIdentifier() const
ContentIdentifier of required update repositories.
Definition: Product.cc:216
std::string key() const
The key used to retrieve this list (for debug)
Definition: Product.h:237
Product Self
Definition: Product.h:35
std::string registerFlavor() const
This is register.flavor attribute of a product.
Definition: Product.cc:249
String related utilities and Regular expression matching.
UrlList releaseNotesUrls() const
The URL to download the release notes for this product.
Definition: Product.cc:282
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
ListType::size_type size_type
Definition: Product.h:216
ResTraits.
Definition: ResTraits.h:79
TraitsType::constPtrType constPtr
Definition: Product.h:38
bool empty() const
Definition: Product.h:219
std::string type() const
Get the product type Well, in an ideal world there is only one base product.
Definition: Product.cc:190
ListType::value_type value_type
Definition: Product.h:215
Url first() const
The first Url or an empty Url.
Definition: Product.h:232
Store and operate on date (time_t).
Definition: Date.h:32
UrlList extraUrls() const
Additional software for the product They are complementary, not alternatives.
Definition: Product.cc:286
const_iterator end() const
Definition: Product.h:228
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
ListType::const_iterator const_iterator
Definition: Product.h:217
DEFINE_PTR_TYPE(Application)
bool hasEndOfLife() const
Return whether an EndOfLife value is actually defined in the metadata.
Definition: Product.cc:203
size_type size() const
Definition: Product.h:222
Base for resolvable objects.
Definition: ResObject.h:37
SolvableIdType size_type
Definition: PoolMember.h:126
intrusive_ptr< TRes > PtrType
Definition: ResTraits.h:82
ReplacedProducts replacedProducts() const
Array of installed Products that would be replaced by installing this one.
Definition: Product.cc:119
std::string ContentIdentifier
Definition: Repository.h:49
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
std::vector< constPtr > ReplacedProducts
Definition: Product.h:73
UrlList urls(const std::string &key_r) const
Retrieve URLs flagged with key_r for this product.
Definition: Product.cc:254
sat::Solvable referencePackage() const
The reference package providing the product metadata, if such a package exists.
Definition: Product.cc:63
std::string shortName() const
Untranslated short name like SLES 10 (fallback: name)
Definition: Product.cc:153
std::string _key
Change to directly iterate the .solv.
Definition: Product.h:243
virtual ~Product()
Dtor.
Definition: Product.cc:58
bool hasUpdateContentIdentifier(const Repository::ContentIdentifier &cident_r) const
Whether cident_r is listed as required update repository.
Definition: Product.cc:229
std::string flavor() const
The product flavor (LiveCD Demo, FTP edition,...).
Definition: Product.cc:161
Date endOfLife() const
The date when this Product goes out of support as indicated by it's medadata.
Definition: Product.cc:200
std::string registerTarget() const
This is register.target attribute of a product.
Definition: Product.cc:243
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
std::string referenceFilename() const
For installed products the name of the corresponding /etc/products.d entry.
Definition: Product.cc:116
std::list< std::string > flags() const
The product flags.
Definition: Product.cc:193
Url manipulation class.
Definition: Url.h:87
TraitsType::PtrType Ptr
Definition: Product.h:37
ResTraits< Self > TraitsType
Definition: Product.h:36