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;
56 /** Untranslated short name like <tt>SLES 10</tt>*/
57 std::string shortName() const;
59 /** The product flavor (LiveCD Demo, FTP edition,...). */
60 std::string flavor() const;
62 /** Get the product type (base, add-on)
63 * Well, in an ideal world there is only one base product.
64 * It's the installed product denoted by a symlink in
66 * \deprecated Use isTargetDistribution to test for the installed base product,
67 * other wise type is empty for almost all products.
69 std::string type() const ZYPP_DEPRECATED;
71 /** The product flags */
72 std::list<std::string> flags() const;
75 /** This is the \b installed product that is also targeted by the
76 * \c /etc/products.d/baseproduct symlink.
78 bool isTargetDistribution() const;
80 /** This is \c register.target attribute of an \b installed product.
81 * Used for registration.
83 std::string registerTarget() const;
85 /** This is \c register.release attribute of an \b installed product.
86 * Used for registration.
88 std::string registerRelease() const;
94 /** Rerieve urls flagged with \c key_r for this product.
96 * This is the most common interface. There are convenience methods for
97 * wellknown flags like \c "releasenotes", \c "register", \c "updateurls",
98 * \c "extraurls", \c "optionalurls" and \c "smolt" below.
100 UrlList urls( const std::string & key_r ) const;
102 /** The URL to download the release notes for this product. */
103 UrlList releaseNotesUrls() const;
105 /** The URL for registration. */
106 UrlList registerUrls() const;
108 /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */
109 UrlList smoltUrls() const;
112 * Online updates for the product.
113 * They are complementary, not alternatives. #163192
115 UrlList updateUrls() const;
118 * Additional software for the product
119 * They are complementary, not alternatives.
121 UrlList extraUrls() const;
124 * Optional software for the product.
125 * (for example. Non OSS repositories)
126 * They are complementary, not alternatives.
128 UrlList optionalUrls() const;
131 friend Ptr make<Self>( const sat::Solvable & solvable_r );
133 Product( const sat::Solvable & solvable_r );
138 /** Helper to iterate a products URL lists.
139 * \ref first is a convenience for 'lists' with just
140 * one entry (e.g. releaseNotesUrls)
142 class Product::UrlList
145 /** \todo Change to directly iterate the .solv */
146 typedef std::list<Url> ListType;
149 typedef ListType::value_type value_type;
150 typedef ListType::size_type size_type;
151 typedef ListType::const_iterator const_iterator;
154 { return _list.empty(); }
156 size_type size() const
157 { return _list.size(); }
159 const_iterator begin() const
160 { return _list.begin(); }
162 const_iterator end() const
163 { return _list.end(); }
165 /** The first Url or an empty Url. */
167 { return empty() ? value_type() : _list.front(); }
170 /** The key used to retrieve this list (for debug) */
171 std::string key() const
175 friend class Product;
176 /** Change to directly iterate the .solv */
181 /** \relates Product::UrlList Stream output. */
182 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
184 /////////////////////////////////////////////////////////////////
186 ///////////////////////////////////////////////////////////////////
187 #endif // ZYPP_PRODUCT_H