libzypp  17.37.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/Globals.h>
19 #include <zypp/ResObject.h>
20 
22 namespace 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;
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 
210  {
211  private:
213  using ListType = std::list<Url>;
214 
215  public:
216  using value_type = ListType::value_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 
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
bool hasUpdateContentIdentifier(TIterator begin, TIterator end) const
Whether one of the ContentIdentifier is listed as required update repository.
Definition: Product.h:128
const_iterator begin() const
Definition: Product.h:226
Product interface.
Definition: Product.h:33
A Solvable object within the sat Pool.
Definition: Solvable.h:53
Helper to iterate a products URL lists.
Definition: Product.h:209
std::string key() const
The key used to retrieve this list (for debug)
Definition: Product.h:238
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
ResTraits.
Definition: ResTraits.h:79
bool empty() const
Definition: Product.h:220
intrusive_ptr< const TRes > constPtrType
Definition: ResTraits.h:83
TraitsType::constPtrType constPtr
Definition: Product.h:39
Url first() const
The first Url or an empty Url.
Definition: Product.h:233
Store and operate on date (time_t).
Definition: Date.h:32
ListType::size_type size_type
Definition: Product.h:217
const_iterator end() const
Definition: Product.h:229
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
DEFINE_PTR_TYPE(Application)
std::string ContentIdentifier
Definition: Repository.h:49
size_type size() const
Definition: Product.h:223
Base for resolvable objects.
Definition: ResObject.h:37
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:35
intrusive_ptr< TRes > PtrType
Definition: ResTraits.h:82
ListType::value_type value_type
Definition: Product.h:216
ListType::const_iterator const_iterator
Definition: Product.h:218
TraitsType::PtrType Ptr
Definition: Product.h:38
std::list< Url > ListType
Definition: Product.h:213
std::string _key
Change to directly iterate the .solv.
Definition: Product.h:244
std::vector< constPtr > ReplacedProducts
Definition: Product.h:74
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
SolvableIdType size_type
Definition: PoolMember.h:126
Url manipulation class.
Definition: Url.h:92