libzypp  17.35.14
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-core/Globals.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 
84  VendorAttr(const VendorAttr &) = default;
85  VendorAttr(VendorAttr &&) noexcept = default;
86  VendorAttr &operator=(const VendorAttr &) = default;
87  VendorAttr &operator=(VendorAttr &&) noexcept = default;
88 
92  bool addVendorDirectory( const Pathname & dirname_r );
93 
97  bool addVendorFile( const Pathname & filename_r );
98 
100  using VendorList = std::vector<std::string>;
101 
105  void addVendorList( VendorList && list_r )
106  { _addVendorList( std::move(list_r) ); }
108  void addVendorList( const VendorList & list_r )
109  { _addVendorList( VendorList(list_r) ); }
111  template <class TContainer>
112  void addVendorList( const TContainer & container_r )
113  {
114  VendorList tmp;
115  for ( const auto & el : container_r )
116  tmp.push_back( std::string(el) );
117  _addVendorList( std::move(tmp) );
118  }
120  template <class TStr>
121  void addVendorList( const std::initializer_list<TStr> & container_r )
122  {
123  VendorList tmp;
124  for ( const auto & el : container_r )
125  tmp.push_back( std::string(el) );
126  _addVendorList( std::move(tmp) );
127  }
128 
134  bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
136  bool equivalent( IdString lVendor, IdString rVendor ) const;
138  bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
140  bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
141 
143  bool relaxedEquivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
145  bool relaxedEquivalent( IdString lVendor, IdString rVendor ) const;
147  bool relaxedEquivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
149  bool relaxedEquivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
150 
151  public:
155  unsigned foreachVendorList( std::function<bool(VendorList)> fnc_r ) const;
156 
157  public:
158  class Impl;
160 
161  void _addVendorList( VendorList && list_r );
162 };
163 
165 std::ostream & operator<<( std::ostream & str, const VendorAttr & obj ) ZYPP_API;
166 
168 }; // namespace zypp
170 
171 #endif // ZYPP_VENDORATTR_H
A Solvable object within the sat Pool.
Definition: Solvable.h:53
void addVendorList(const VendorList &list_r)
Definition: VendorAttr.h:108
void addVendorList(const TContainer &container_r)
Definition: VendorAttr.h:112
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: VendorAttr.h:158
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
Access to the sat-pools string space.
Definition: IdString.h:43
Provides API related macros.
VendorAttr implementation.
Definition: VendorAttr.cc:40
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
Definition of vendor equivalence.
Definition: VendorAttr.h:60
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition: VendorAttr.h:105
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition: VendorAttr.h:121
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition: VendorAttr.h:100
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
std::string Vendor
Definition: Vendor.h:22