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;
51 /** List of packages included in older versions of this product and now dropped.
53 * This evaluates the \ref referencePackage \c weakremover namespace. It actually
54 * returns a \ref CapabilitySet, because we support to drop specific versions or
55 * version ranges of a package. Use \ref sat::WhatProvides to get the actually
56 * installed and available packages matching this list.
58 * const Product & openSUSE;
59 * sat::WhatProvides dropped( openSUSE.droplist() );
60 * for_( it, dropped.poolItemBegin(), dropped.poolItemEnd() )
62 * if ( it->status().isInstalled() )
64 * MIL << "Installed but no longer supported package: " << *it << endl;
69 CapabilitySet droplist() const;
73 typedef std::vector<constPtr> ReplacedProducts;
75 /** Array of \b installed Products that would be replaced by
76 * installing this one.
78 ReplacedProducts replacedProducts() const;
80 /** Vendor specific string denoting the product line. */
81 std::string productLine() const;
84 /** Untranslated short name like <tt>SLES 10</tt>*/
85 std::string shortName() const;
87 /** The product flavor (LiveCD Demo, FTP edition,...). */
88 std::string flavor() const;
90 /** Get the product type
91 * Well, in an ideal world there is only one base product.
92 * It's the installed product denoted by a symlink in
94 * \deprecated Use isTargetDistribution to test for the installed base product,
95 * other wise type is empty for almost all products.
97 std::string type() const ZYPP_DEPRECATED;
99 /** The product flags */
100 std::list<std::string> flags() const;
103 /** This is the \b installed product that is also targeted by the
104 * \c /etc/products.d/baseproduct symlink.
106 bool isTargetDistribution() const;
108 /** This is \c register.target attribute of an \b installed product.
109 * Used for registration.
111 std::string registerTarget() const;
113 /** This is \c register.release attribute of an \b installed product.
114 * Used for registration.
116 std::string registerRelease() const;
122 /** Rerieve urls flagged with \c key_r for this product.
124 * This is the most common interface. There are convenience methods for
125 * wellknown flags like \c "releasenotes", \c "register", \c "updateurls",
126 * \c "extraurls", \c "optionalurls" and \c "smolt" below.
128 UrlList urls( const std::string & key_r ) const;
130 /** The URL to download the release notes for this product. */
131 UrlList releaseNotesUrls() const;
133 /** The URL for registration. */
134 UrlList registerUrls() const;
136 /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */
137 UrlList smoltUrls() const;
140 * Online updates for the product.
141 * They are complementary, not alternatives. #163192
143 UrlList updateUrls() const;
146 * Additional software for the product
147 * They are complementary, not alternatives.
149 UrlList extraUrls() const;
152 * Optional software for the product.
153 * (for example. Non OSS repositories)
154 * They are complementary, not alternatives.
156 UrlList optionalUrls() const;
159 friend Ptr make<Self>( const sat::Solvable & solvable_r );
161 Product( const sat::Solvable & solvable_r );
166 /** Helper to iterate a products URL lists.
167 * \ref first is a convenience for 'lists' with just
168 * one entry (e.g. releaseNotesUrls)
170 class Product::UrlList
173 /** \todo Change to directly iterate the .solv */
174 typedef std::list<Url> ListType;
177 typedef ListType::value_type value_type;
178 typedef ListType::size_type size_type;
179 typedef ListType::const_iterator const_iterator;
182 { return _list.empty(); }
184 size_type size() const
185 { return _list.size(); }
187 const_iterator begin() const
188 { return _list.begin(); }
190 const_iterator end() const
191 { return _list.end(); }
193 /** The first Url or an empty Url. */
195 { return empty() ? value_type() : _list.front(); }
198 /** The key used to retrieve this list (for debug) */
199 std::string key() const
203 friend class Product;
204 /** Change to directly iterate the .solv */
209 /** \relates Product::UrlList Stream output. */
210 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
212 /////////////////////////////////////////////////////////////////
214 ///////////////////////////////////////////////////////////////////
215 #endif // ZYPP_PRODUCT_H