libzypp  17.24.2
VendorAttr.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
11 #ifndef ZYPP_VENDORATTR_H
12 #define ZYPP_VENDORATTR_H
13 
14 #include <iosfwd>
15 #include <string>
16 #include <vector>
17 
18 #include <zypp/base/PtrTypes.h>
19 #include <zypp/IdString.h>
20 #include <zypp/PathInfo.h>
21 #include <zypp/Vendor.h>
22 
23 #include <zypp/APIConfig.h> // LEGACY macros
24 
26 namespace zypp {
28 
29  class PoolItem;
30  namespace sat
31  {
32  class Solvable;
33  }
34 
47 {
48  friend std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
49 
50  public:
52  static const VendorAttr & instance();
53 
58  static VendorAttr & noTargetInstance();
59 
60  public:
62  VendorAttr();
63 
65  VendorAttr( const Pathname & initial_r );
66 
68  ~VendorAttr();
69 
73  bool addVendorDirectory( const Pathname & dirname_r );
74 #if LEGACY(1722)
75 
76  bool addVendorDirectory( const Pathname & dirname_r ) const ZYPP_DEPRECATED;
77 #endif
78 
82  bool addVendorFile( const Pathname & filename_r );
83 #if LEGACY(1722)
84 
85  bool addVendorFile( const Pathname & filename_r ) const ZYPP_DEPRECATED;
86 #endif
87 
92  template <class TContainer>
93  void addVendorList( const TContainer & container_r )
94  {
95  VendorList tmp;
96  for ( const auto & el : container_r )
97  tmp.push_back( IdString(el) );
98  _addVendorList( std::move(tmp) );
99  }
100 
106  bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
108  bool equivalent( IdString lVendor, IdString rVendor ) const;
110  bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
112  bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
113 
114  public:
115  class Impl;
116  typedef std::vector<IdString> VendorList;
117  private:
119 
120 #if LEGACY(1722)
121 
122  void _addVendorList( std::vector<std::string> & list_r ) const ZYPP_DEPRECATED;
123 #endif
124  void _addVendorList( VendorList && list_r );
125 };
126 
128 std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
129 
131 }; // namespace zypp
133 
134 #endif // ZYPP_VENDORATTR_H
Vendor.h
zypp::VendorAttr::addVendorList
void addVendorList(const TContainer &container_r)
Adding a new equivalent vendor set from string container (via C_Str)
Definition: VendorAttr.h:93
zypp::VendorAttr::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: VendorAttr.h:118
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
zypp::Vendor
std::string Vendor
Definition: Vendor.h:22
PathInfo.h
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:54
zypp::VendorAttr::VendorList
std::vector< IdString > VendorList
Implementation class.
Definition: VendorAttr.h:115
zypp::VendorAttr::equivalent
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
Definition: VendorAttr.cc:295
zypp::VendorAttr::addVendorDirectory
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
Definition: VendorAttr.cc:233
PtrTypes.h
zypp::VendorAttr
Definition of vendor equivalence.
Definition: VendorAttr.h:47
zypp::IdString
Access to the sat-pools string space.
Definition: IdString.h:43
zypp::VendorAttr::addVendorFile
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
Definition: VendorAttr.cc:250
IdString.h
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
Impl
zypp::VendorAttr::_addVendorList
void _addVendorList(VendorList &&list_r)
Definition: VendorAttr.cc:275
zypp::VendorAttr::operator<<
friend std::ostream & operator<<(std::ostream &str, const VendorAttr &obj)
Definition: VendorAttr.cc:306
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:45
zypp::VendorAttr::instance
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
Definition: VendorAttr.cc:203
zypp::RWCOW_pointer< Impl >
zypp::VendorAttr::~VendorAttr
~VendorAttr()
Dtor.
Definition: VendorAttr.cc:230
str
String related utilities and Regular expression matching.
zypp::VendorAttr::noTargetInstance
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
Definition: VendorAttr.cc:209
zypp::VendorAttr::VendorAttr
VendorAttr()
Ctor providing the default set.
Definition: VendorAttr.cc:215