Imported Upstream version 15.19.0
[platform/upstream/libzypp.git] / zypp / VendorAttr.h
index d9cd380..6e70740 100644 (file)
 
 #include <iosfwd>
 #include <string>
+#include <vector>
 
-#include "zypp/base/NonCopyable.h"
-#include "zypp/NeedAType.h"
 #include "zypp/PathInfo.h"
+#include "zypp/Vendor.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp {
 //////////////////////////////////////////////////////////////////
 
-class VendorAttr : private base::NonCopyable
+  class PoolItem;
+  namespace sat
+  {
+    class Solvable;
+  }
+
+/** Definition of vendor equivalence.
+ *
+ * Packages with equivalment vendor strings may replace themself without
+ * creating a solver error.
+ *
+ * Per default vendor strings starting with \c "suse" or \c "opensuse"
+ * are treated equivalent. This may be changed by providing customized
+ * vendor description files in \c /etc/zypp/vendors.d.
+ *
+ * \see \ref pg_zypp-solv-vendorchange
+*/
+class VendorAttr
 {
   public:
+    typedef std::vector<std::string> VendorList;
+
     /** Singleton */
     static const VendorAttr & instance();
 
@@ -37,7 +56,14 @@ class VendorAttr : private base::NonCopyable
     /**
      * Adding new equivalent vendors described in a file
      **/
-    bool addVendorFile( const Pathname & filename) const;    
+    bool addVendorFile( const Pathname & filename ) const;
+
+    /**
+     * Adding new equivalent vendor set from list
+     **/
+    template <class TIterator>
+    void addVendorList( TIterator begin, TIterator end ) const
+    { VendorList tmp( begin, end ); _addVendorList( tmp ); }
 
     /** Return whether two vendor strings shold be treated as the same vendor.
      * Usually the solver is allowed to automatically select a package of an
@@ -45,11 +71,21 @@ class VendorAttr : private base::NonCopyable
      * different vendor usually must be confirmed by the user.
     */
     bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
+    /** \overload using \ref IdStrings */
+    bool equivalent( IdString lVendor, IdString rVendor ) const;
+    /** \overload using \ref sat::Solvable */
+    bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
+    /** \overload using \ref PoolItem */
+    bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
 
   private:
     VendorAttr();
+    void _addVendorList( VendorList & ) const;
 };
 
+/** \relates VendorAttr Stream output */
+std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
+
 ///////////////////////////////////////////////////////////////////
 }; // namespace zypp
 ///////////////////////////////////////////////////////////////////