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;
48 typedef std::vector<constPtr> ReplacedProducts;
50 /** Array of \b installed Products that would be replaced by
51 * installing this one.
53 ReplacedProducts replacedProducts() const;
55 /** Vendor specific string denoting the product line. */
56 std::string productLine() const;
59 /** Untranslated short name like <tt>SLES 10</tt>*/
60 std::string shortName() const;
62 /** The product flavor (LiveCD Demo, FTP edition,...). */
63 std::string flavor() const;
65 /** Get the product type (base, add-on)
66 * Well, in an ideal world there is only one base product.
67 * It's the installed product denoted by a symlink in
69 * \deprecated Use isTargetDistribution to test for the installed base product,
70 * other wise type is empty for almost all products.
72 std::string type() const ZYPP_DEPRECATED;
74 /** The product flags */
75 std::list<std::string> flags() const;
78 /** This is the \b installed product that is also targeted by the
79 * \c /etc/products.d/baseproduct symlink.
81 bool isTargetDistribution() const;
83 /** This is \c register.target attribute of an \b installed product.
84 * Used for registration.
86 std::string registerTarget() const;
88 /** This is \c register.release attribute of an \b installed product.
89 * Used for registration.
91 std::string registerRelease() const;
97 /** Rerieve urls flagged with \c key_r for this product.
99 * This is the most common interface. There are convenience methods for
100 * wellknown flags like \c "releasenotes", \c "register", \c "updateurls",
101 * \c "extraurls", \c "optionalurls" and \c "smolt" below.
103 UrlList urls( const std::string & key_r ) const;
105 /** The URL to download the release notes for this product. */
106 UrlList releaseNotesUrls() const;
108 /** The URL for registration. */
109 UrlList registerUrls() const;
111 /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */
112 UrlList smoltUrls() const;
115 * Online updates for the product.
116 * They are complementary, not alternatives. #163192
118 UrlList updateUrls() const;
121 * Additional software for the product
122 * They are complementary, not alternatives.
124 UrlList extraUrls() const;
127 * Optional software for the product.
128 * (for example. Non OSS repositories)
129 * They are complementary, not alternatives.
131 UrlList optionalUrls() const;
134 friend Ptr make<Self>( const sat::Solvable & solvable_r );
136 Product( const sat::Solvable & solvable_r );
141 /** Helper to iterate a products URL lists.
142 * \ref first is a convenience for 'lists' with just
143 * one entry (e.g. releaseNotesUrls)
145 class Product::UrlList
148 /** \todo Change to directly iterate the .solv */
149 typedef std::list<Url> ListType;
152 typedef ListType::value_type value_type;
153 typedef ListType::size_type size_type;
154 typedef ListType::const_iterator const_iterator;
157 { return _list.empty(); }
159 size_type size() const
160 { return _list.size(); }
162 const_iterator begin() const
163 { return _list.begin(); }
165 const_iterator end() const
166 { return _list.end(); }
168 /** The first Url or an empty Url. */
170 { return empty() ? value_type() : _list.front(); }
173 /** The key used to retrieve this list (for debug) */
174 std::string key() const
178 friend class Product;
179 /** Change to directly iterate the .solv */
184 /** \relates Product::UrlList Stream output. */
185 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
187 /////////////////////////////////////////////////////////////////
189 ///////////////////////////////////////////////////////////////////
190 #endif // ZYPP_PRODUCT_H