Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / Product.h
index fd2a65f..7c9bb3f 100644 (file)
@@ -43,6 +43,31 @@ namespace zypp
      */
     sat::Solvable referencePackage() const;
 
+    /** For installed products the name of the coddesponding
+     * \c /etc/products.d entry.
+    .*/
+    std::string referenceFilename() const;
+
+    /** List of packages included in older versions of this product and now dropped.
+     *
+     * This evaluates the \ref referencePackage \c weakremover namespace. It actually
+     * returns a \ref CapabilitySet, because we support to drop specific versions or
+     * version ranges of a package. Use \ref sat::WhatProvides to get the actually
+     * installed and available packages matching this list.
+     * \code
+     *   const Product & openSUSE;
+     *   sat::WhatProvides dropped( openSUSE.droplist() );
+     *   for_( it, dropped.poolItemBegin(), dropped.poolItemEnd() )
+     *   {
+     *     if ( it->status().isInstalled() )
+     *     {
+     *       MIL << "Installed but no longer supported package: " << *it << endl;
+     *     }
+     *   }
+     * \endcode
+     */
+    CapabilitySet droplist() const;
+
   public:
     /***/
     typedef std::vector<constPtr> ReplacedProducts;
@@ -52,60 +77,105 @@ namespace zypp
      */
     ReplacedProducts replacedProducts() const;
 
+    /** Vendor specific string denoting the product line. */
+    std::string productLine() const;
+
   public:
-    /** Untranslated short name like <tt>SLES 10</tt>*/
+    /** Untranslated short name like <tt>SLES 10</tt> (fallback: name) */
     std::string shortName() const;
 
     /** The product flavor (LiveCD Demo, FTP edition,...). */
     std::string flavor() const;
 
-    /** Get the product type (base, add-on)
+    /** Get the product type
      * Well, in an ideal world there is only one base product.
      * It's the installed product denoted by a symlink in
      * \c /etc/products.d.
-    */
+     */
     std::string type() const;
 
-    /** The URL to download the release notes for this product */
-    Url releaseNotesUrl() const;
+    /** The product flags */
+    std::list<std::string> flags() const;
+
+    /** The date when this Product goes out of support as indicated by it's medadata. */
+    Date endOfLife() const;
+
+    /** ContentIdentifier of required update repositories. */
+    std::vector<Repository::ContentIdentifier> updateContentIdentifier() const;
+
+    /** Whether \a cident_r is listed as required update repository. */
+    bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const;
+
+    /** Whether one of the ContentIdentifier is listed as required update repository. */
+    template <class _Iterator>
+    bool hasUpdateContentIdentifier( _Iterator begin, _Iterator end ) const
+    {
+      for_( it, begin, end )
+       if ( hasUpdateContentIdentifier( *it ) )
+         return true;
+      return false;
+    }
+
+  public:
+    /** This is the \b installed product that is also targeted by the
+     *  \c /etc/products.d/baseproduct symlink.
+    */
+    bool isTargetDistribution() const;
+
+    /** This is \c register.target attribute of a product.
+      * Used for registration and filtering service repos.
+      */
+    std::string registerTarget() const;
+
+    /** This is \c register.release attribute of an \b installed product.
+      * Used for registration.
+      */
+    std::string registerRelease() const;
+
+    /** This is \c register.flavor attribute of a product.
+      * Used for registration.
+      */
+    std::string registerFlavor() const;
+
+  public:
+    /***/
+    class UrlList;
+
+    /** Rerieve urls flagged with \c key_r for this product.
+     *
+     * This is the most common interface. There are convenience methods for
+     * wellknown flags like \c "releasenotes", \c "register", \c "updateurls",
+     * \c "extraurls", \c "optionalurls" and \c "smolt" below.
+     */
+    UrlList urls( const std::string & key_r ) const;
+
+    /** The URL to download the release notes for this product. */
+    UrlList releaseNotesUrls() const;
+
+    /** The URL for registration. */
+    UrlList registerUrls() const;
+
+    /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */
+    UrlList smoltUrls() const;
 
     /**
      * Online updates for the product.
      * They are complementary, not alternatives. #163192
      */
-    std::list<Url> updateUrls() const;
+    UrlList updateUrls() const;
 
     /**
      * Additional software for the product
      * They are complementary, not alternatives.
      */
-    std::list<Url> extraUrls() const;
+    UrlList extraUrls() const;
 
     /**
-     * Optional software for the product
+     * Optional software for the product.
      * (for example. Non OSS repositories)
      * They are complementary, not alternatives.
      */
-    std::list<Url> optionalUrls() const;
-
-    /** The product flags */
-    std::list<std::string> flags() const;
-
-    /** Translated long name like <tt>SUSE Linux Enterprise Server 10</tt>
-     * \deprecated use summary.
-     */
-    std::string longName( const Locale & lang_r = Locale() ) const ZYPP_DEPRECATED
-    { return summary( lang_r ); }
-
-    /** Vendor specific distribution id.
-     * \deprecated replaced by ResObject::distribution
-     */
-    std::string distributionName() const ZYPP_DEPRECATED;
-
-    /** Vendor specific distribution version.
-     * \deprecated replaced by ResObject::distribution
-     */
-    Edition distributionEdition() const ZYPP_DEPRECATED;
+    UrlList optionalUrls() const;
 
   protected:
     friend Ptr make<Self>( const sat::Solvable & solvable_r );
@@ -115,6 +185,52 @@ namespace zypp
     virtual ~Product();
   };
 
+  /** Helper to iterate a products URL lists.
+   * \ref first is a convenience for 'lists' with just
+   * one entry (e.g. releaseNotesUrls)
+   */
+  class Product::UrlList
+  {
+    private:
+      /** \todo Change to directly iterate the .solv */
+      typedef std::list<Url> ListType;
+
+    public:
+      typedef ListType::value_type     value_type;
+      typedef ListType::size_type      size_type;
+      typedef ListType::const_iterator const_iterator;
+
+      bool empty() const
+      { return _list.empty(); }
+
+      size_type size() const
+      { return _list.size(); }
+
+      const_iterator begin() const
+      { return _list.begin(); }
+
+      const_iterator end() const
+      { return _list.end(); }
+
+      /** The first Url or an empty Url. */
+      Url first() const
+      { return empty() ? value_type() : _list.front(); }
+
+    public:
+      /** The key used to retrieve this list (for debug) */
+      std::string key() const
+      { return _key; }
+
+    private:
+      friend class Product;
+      /** Change to directly iterate the .solv */
+      std::string _key;
+      ListType    _list;
+  };
+
+  /** \relates Product::UrlList Stream output. */
+  std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj );
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////