1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/VendorAttr.h
12 #ifndef ZYPP_VENDORATTR_H
13 #define ZYPP_VENDORATTR_H
19 #include "zypp/PathInfo.h"
20 #include "zypp/Vendor.h"
22 ///////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////
32 /** Definition of vendor equivalence.
34 * Packages with equivalment vendor strings may replace themself without
35 * creating a solver error.
37 * Per default vendor strings starting with \c "suse" or \c "opensuse"
38 * are treated equivalent. This may be changed by providing customized
39 * vendor description files in \c /etc/zypp/vendors.d.
41 * \see \ref pg_zypp-solv-vendorchange
46 typedef std::vector<std::string> VendorList;
49 static const VendorAttr & instance();
52 * Adding new equivalent vendors described in a directory
54 bool addVendorDirectory( const Pathname & dirname ) const;
57 * Adding new equivalent vendors described in a file
59 bool addVendorFile( const Pathname & filename ) const;
62 * Adding new equivalent vendor set from list
64 template <class _Iterator>
65 void addVendorList( _Iterator begin, _Iterator end ) const
66 { VendorList tmp( begin, end ); _addVendorList( tmp ); }
68 /** Return whether two vendor strings shold be treated as the same vendor.
69 * Usually the solver is allowed to automatically select a package of an
70 * equivalent vendor when updating. Replacing a package with one of a
71 * different vendor usually must be confirmed by the user.
73 bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
74 /** \overload using \ref IdStrings */
75 bool equivalent( IdString lVendor, IdString rVendor ) const;
76 /** \overload using \ref sat::Solvable */
77 bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
78 /** \overload using \ref PoolItem */
79 bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
83 void _addVendorList( VendorList & ) const;
86 /** \relates VendorAttr Stream output */
87 std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
89 ///////////////////////////////////////////////////////////////////
91 ///////////////////////////////////////////////////////////////////
93 #endif // ZYPP_VENDORATTR_H