00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_PRODUCT_H 00013 #define ZYPP_PRODUCT_H 00014 00015 #include <list> 00016 #include <string> 00017 00018 #include "zypp/ResObject.h" 00019 00021 namespace zypp 00022 { 00023 00024 DEFINE_PTR_TYPE(Product); 00025 00027 // 00028 // CLASS NAME : Product 00029 // 00032 class Product : public ResObject 00033 { 00034 public: 00035 typedef Product Self; 00036 typedef ResTraits<Self> TraitsType; 00037 typedef TraitsType::PtrType Ptr; 00038 typedef TraitsType::constPtrType constPtr; 00039 00040 public: 00044 sat::Solvable referencePackage() const; 00045 00049 std::string referenceFilename() const; 00050 00069 CapabilitySet droplist() const; 00070 00071 public: 00072 /***/ 00073 typedef std::vector<constPtr> ReplacedProducts; 00074 00078 ReplacedProducts replacedProducts() const; 00079 00081 std::string productLine() const; 00082 00083 public: 00085 std::string shortName() const; 00086 00088 std::string flavor() const; 00089 00097 std::string type() const ZYPP_DEPRECATED; 00098 00100 std::list<std::string> flags() const; 00101 00102 public: 00106 bool isTargetDistribution() const; 00107 00111 std::string registerTarget() const; 00112 00116 std::string registerRelease() const; 00117 00118 public: 00119 /***/ 00120 class UrlList; 00121 00128 UrlList urls( const std::string & key_r ) const; 00129 00131 UrlList releaseNotesUrls() const; 00132 00134 UrlList registerUrls() const; 00135 00137 UrlList smoltUrls() const; 00138 00143 UrlList updateUrls() const; 00144 00149 UrlList extraUrls() const; 00150 00156 UrlList optionalUrls() const; 00157 00158 protected: 00159 friend Ptr make<Self>( const sat::Solvable & solvable_r ); 00161 Product( const sat::Solvable & solvable_r ); 00163 virtual ~Product(); 00164 }; 00165 00170 class Product::UrlList 00171 { 00172 private: 00174 typedef std::list<Url> ListType; 00175 00176 public: 00177 typedef ListType::value_type value_type; 00178 typedef ListType::size_type size_type; 00179 typedef ListType::const_iterator const_iterator; 00180 00181 bool empty() const 00182 { return _list.empty(); } 00183 00184 size_type size() const 00185 { return _list.size(); } 00186 00187 const_iterator begin() const 00188 { return _list.begin(); } 00189 00190 const_iterator end() const 00191 { return _list.end(); } 00192 00194 Url first() const 00195 { return empty() ? value_type() : _list.front(); } 00196 00197 public: 00199 std::string key() const 00200 { return _key; } 00201 00202 private: 00203 friend class Product; 00205 std::string _key; 00206 ListType _list; 00207 }; 00208 00210 std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj ); 00211 00213 } // namespace zypp 00215 #endif // ZYPP_PRODUCT_H