1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Product.h
12 #ifndef ZYPP_PRODUCT_H
13 #define ZYPP_PRODUCT_H
18 #include "zypp/ResObject.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 DEFINE_PTR_TYPE(Product);
26 ///////////////////////////////////////////////////////////////////
28 // CLASS NAME : Product
30 /** Product interface.
32 class Product : public ResObject
36 typedef ResTraits<Self> TraitsType;
37 typedef TraitsType::PtrType Ptr;
38 typedef TraitsType::constPtrType constPtr;
41 /** The reference package providing the product metadata,
42 * if such a package exists.
44 sat::Solvable referencePackage() const;
46 /** For installed products the name of the coddesponding
47 * \c /etc/products.d entry.
49 std::string referenceFilename() const;
53 typedef std::vector<constPtr> ReplacedProducts;
55 /** Array of \b installed Products that would be replaced by
56 * installing this one.
58 ReplacedProducts replacedProducts() const;
60 /** Vendor specific string denoting the product line. */
61 std::string productLine() const;
64 /** Untranslated short name like <tt>SLES 10</tt>*/
65 std::string shortName() const;
67 /** The product flavor (LiveCD Demo, FTP edition,...). */
68 std::string flavor() const;
70 /** Get the product type
71 * Well, in an ideal world there is only one base product.
72 * It's the installed product denoted by a symlink in
74 * \deprecated Use isTargetDistribution to test for the installed base product,
75 * other wise type is empty for almost all products.
77 std::string type() const ZYPP_DEPRECATED;
79 /** The product flags */
80 std::list<std::string> flags() const;
83 /** This is the \b installed product that is also targeted by the
84 * \c /etc/products.d/baseproduct symlink.
86 bool isTargetDistribution() const;
88 /** This is \c register.target attribute of an \b installed product.
89 * Used for registration.
91 std::string registerTarget() const;
93 /** This is \c register.release attribute of an \b installed product.
94 * Used for registration.
96 std::string registerRelease() const;
102 /** Rerieve urls flagged with \c key_r for this product.
104 * This is the most common interface. There are convenience methods for
105 * wellknown flags like \c "releasenotes", \c "register", \c "updateurls",
106 * \c "extraurls", \c "optionalurls" and \c "smolt" below.
108 UrlList urls( const std::string & key_r ) const;
110 /** The URL to download the release notes for this product. */
111 UrlList releaseNotesUrls() const;
113 /** The URL for registration. */
114 UrlList registerUrls() const;
116 /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */
117 UrlList smoltUrls() const;
120 * Online updates for the product.
121 * They are complementary, not alternatives. #163192
123 UrlList updateUrls() const;
126 * Additional software for the product
127 * They are complementary, not alternatives.
129 UrlList extraUrls() const;
132 * Optional software for the product.
133 * (for example. Non OSS repositories)
134 * They are complementary, not alternatives.
136 UrlList optionalUrls() const;
139 friend Ptr make<Self>( const sat::Solvable & solvable_r );
141 Product( const sat::Solvable & solvable_r );
146 /** Helper to iterate a products URL lists.
147 * \ref first is a convenience for 'lists' with just
148 * one entry (e.g. releaseNotesUrls)
150 class Product::UrlList
153 /** \todo Change to directly iterate the .solv */
154 typedef std::list<Url> ListType;
157 typedef ListType::value_type value_type;
158 typedef ListType::size_type size_type;
159 typedef ListType::const_iterator const_iterator;
162 { return _list.empty(); }
164 size_type size() const
165 { return _list.size(); }
167 const_iterator begin() const
168 { return _list.begin(); }
170 const_iterator end() const
171 { return _list.end(); }
173 /** The first Url or an empty Url. */
175 { return empty() ? value_type() : _list.front(); }
178 /** The key used to retrieve this list (for debug) */
179 std::string key() const
183 friend class Product;
184 /** Change to directly iterate the .solv */
189 /** \relates Product::UrlList Stream output. */
190 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
192 /////////////////////////////////////////////////////////////////
194 ///////////////////////////////////////////////////////////////////
195 #endif // ZYPP_PRODUCT_H