Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / Repository.h
index 9e0f65b..6ed1725 100644 (file)
@@ -19,6 +19,7 @@
 #include "zypp/sat/Solvable.h"
 #include "zypp/RepoInfo.h"
 #include "zypp/Date.h"
+#include "zypp/CpeId.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -84,9 +85,12 @@ namespace zypp
         /** Label to display for this repo. */
         std::string name() const;
 
-       /** User string */
+       /** Alias or name, according to \ref ZConfig::repoLabelIsAlias */
+       std::string label() const;
+
+       /** User string: \ref label (alias or name) */
        std::string asUserString() const
-       { return name(); }
+       { return label(); }
 
     public:
        /** Timestamp or arbitrary user supplied string.
@@ -107,6 +111,9 @@ namespace zypp
         */
        ContentIdentifier contentIdentifier() const;
 
+       /** Whether \a id_r matches this repos content identifier. */
+       bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
+
         /**
          * Timestamp when this repository was generated
          *
@@ -161,26 +168,21 @@ namespace zypp
          */
         bool maybeOutdated() const;
 
-        /**
-         * if the repository claims to update something then
-         * it is an update repository
-         *
-         * This is implemented by looking at the repository updates
-         * tag.
-         * \see http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml
+        /** Hint whether the Repo may provide updates for a product.
+        *
+         * Either the repository claims to update a product via a repository updates
+         * tag in it's metadata or a known product lists the repositories ContentIdentifier
+        * as required update repo.
          */
         bool isUpdateRepo() const;
 
-        /**
-         * whether the repository claims to update something \ref prod
-         * with key \ref cpeid
-         *
-         * \see zypp::Product::cpeId()
-         *
-         * See http://cpe.mitre.org/ for more information on the
-         * Common Platform Enumearation.
-         */
-        bool providesUpdatesFor( const std::string &cpeid ) const;
+        /** Hint whether the Repo may provide updates for a product identified by it's \ref CpeId
+        *
+         * Either the repository claims to update a product via a repository updates
+         * tag in it's metadata or a known product lists the repositories ContentIdentifier
+        * as required update repo.
+        */
+        bool providesUpdatesFor( const CpeId & cpeid_r ) const;
 
         /** Whether \ref Repository contains solvables. */
         bool solvablesEmpty() const;
@@ -196,7 +198,7 @@ namespace zypp
 
     public:
 
-      /** Query class for Repository */
+      /** Query class for Repository related products */
       class ProductInfoIterator;
 
       /**
@@ -216,15 +218,18 @@ namespace zypp
       ProductInfoIterator compatibleWithProductEnd() const;
 
       /**
-       * Get an iterator to the beginning of the repository
-       * compatible distros.
+       * Get an iterator to the beginning of distos the repository
+       * provides upadates for.
+       * \note This is only a hint within the repositories metadata.
+       * The same realation might be expressed by a product listing
+       * this repositories ContentIdentifier as required update repo.
        * \see Repository::ProductInfoIterator
        */
       ProductInfoIterator updatesProductBegin() const;
 
       /**
-       * Get an iterator to the end of the repository
-       * compatible distros.
+       * Get an iterator to the end of distos the repository
+       * provides upadates for.
        * \see Repository::ProductInfoIterator
        */
       ProductInfoIterator updatesProductEnd() const;
@@ -328,6 +333,9 @@ namespace zypp
     /**
      * Query class for Repository related products
      *
+     * Products are identified by CpeIds within the repositories metadata.
+     * \see http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml
+     *
      * The iterator does not provide a dereference
      * operator so you can do * on it, but you can
      * access the attributes of each related product
@@ -336,7 +344,7 @@ namespace zypp
      * \code
      * for_( it, repo.compatibleWithProductBegin(), repo.compatibleWithProductEnd() )
      * {
-     *   cout << it.cpeid() << endl;
+     *   cout << it.label() << ": " << it.cpeid() << endl;
      * }
      * \endcode
      *
@@ -353,18 +361,11 @@ namespace zypp
         ProductInfoIterator()
         {}
 
-        /**
-         * Product label
-         */
+        /** Product label */
         std::string label() const;
 
-        /**
-         * The Common Platform Enumeration name
-         * for this product.
-         *
-         * See http://cpe.mitre.org
-         */
-        std::string cpeId() const;
+        /** The Common Platform Enumeration name for this product. */
+        CpeId cpeId() const;
 
       private:
         friend class Repository;