libzypp  17.25.1
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 
61 {
62  friend std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
63 
64  public:
66  static const VendorAttr & instance();
67 
72  static VendorAttr & noTargetInstance();
73 
74  public:
76  VendorAttr();
77 
79  VendorAttr( const Pathname & initial_r );
80 
82  ~VendorAttr();
83 
87  bool addVendorDirectory( const Pathname & dirname_r );
88 #if LEGACY(1722)
89 
90  bool addVendorDirectory( const Pathname & dirname_r ) const ZYPP_DEPRECATED;
91 #endif
92 
96  bool addVendorFile( const Pathname & filename_r );
97 #if LEGACY(1722)
98 
99  bool addVendorFile( const Pathname & filename_r ) const ZYPP_DEPRECATED;
100 #endif
101 
103  typedef std::vector<std::string> VendorList;
104 
108  void addVendorList( VendorList && list_r )
109  { _addVendorList( std::move(list_r) ); }
111  void addVendorList( const VendorList & list_r )
112  { _addVendorList( VendorList(list_r) ); }
114  template <class TContainer>
115  void addVendorList( const TContainer & container_r )
116  {
117  VendorList tmp;
118  for ( const auto & el : container_r )
119  tmp.push_back( std::string(el) );
120  _addVendorList( std::move(tmp) );
121  }
123  template <class TStr>
124  void addVendorList( const std::initializer_list<TStr> & container_r )
125  {
126  VendorList tmp;
127  for ( const auto & el : container_r )
128  tmp.push_back( std::string(el) );
129  _addVendorList( std::move(tmp) );
130  }
131 
137  bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
139  bool equivalent( IdString lVendor, IdString rVendor ) const;
141  bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
143  bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
144 
145  public:
146  class Impl;
148 
149 #if LEGACY(1722)
150 
151  void _addVendorList( std::vector<std::string> & list_r ) const ZYPP_DEPRECATED;
153  void _addVendorList( std::vector<IdString> && list_r );
154 #endif
155  void _addVendorList( VendorList && list_r );
156 };
157 
159 std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
160 
162 }; // namespace zypp
164 
165 #endif // ZYPP_VENDORATTR_H
Vendor.h
zypp::VendorAttr::addVendorList
void addVendorList(const TContainer &container_r)
Definition: VendorAttr.h:115
zypp::VendorAttr::_pimpl
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: VendorAttr.h:146
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
zypp::Vendor
std::string Vendor
Definition: Vendor.h:22
PathInfo.h
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
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:293
zypp::VendorAttr::addVendorDirectory
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
Definition: VendorAttr.cc:223
PtrTypes.h
zypp::VendorAttr
Definition of vendor equivalence.
Definition: VendorAttr.h:60
zypp::IdString
Access to the sat-pools string space.
Definition: IdString.h:42
zypp::VendorAttr::addVendorList
void addVendorList(const VendorList &list_r)
Definition: VendorAttr.h:111
zypp::VendorAttr::addVendorList
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition: VendorAttr.h:124
zypp::VendorAttr::addVendorFile
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
Definition: VendorAttr.cc:240
zypp::VendorAttr::addVendorList
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition: VendorAttr.h:108
IdString.h
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::VendorAttr::_addVendorList
void _addVendorList(VendorList &&list_r)
Definition: VendorAttr.cc:265
zypp::VendorAttr::operator<<
friend std::ostream & operator<<(std::ostream &str, const VendorAttr &obj)
Definition: VendorAttr.cc:304
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
zypp::VendorAttr::VendorList
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition: VendorAttr.h:103
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::VendorAttr::instance
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
Definition: VendorAttr.cc:195
zypp::RWCOW_pointer< Impl >
zypp::VendorAttr::Impl
VendorAttr implementation.
Definition: VendorAttr.cc:40
zypp::VendorAttr::~VendorAttr
~VendorAttr()
Dtor.
Definition: VendorAttr.cc:220
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:201
zypp::VendorAttr::VendorAttr
VendorAttr()
Ctor providing the default set.
Definition: VendorAttr.cc:207