libzypp 17.31.6
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
26namespace 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
73
74 public:
76 VendorAttr();
77
79 VendorAttr( const Pathname & initial_r );
80
83
87 bool addVendorDirectory( const Pathname & dirname_r );
88#if LEGACY(1722)
90 bool addVendorDirectory( const Pathname & dirname_r ) const ZYPP_DEPRECATED;
91#endif
92
96 bool addVendorFile( const Pathname & filename_r );
97#if LEGACY(1722)
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
146 bool relaxedEquivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
148 bool relaxedEquivalent( IdString lVendor, IdString rVendor ) const;
150 bool relaxedEquivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const;
152 bool relaxedEquivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
153
154 public:
158 unsigned foreachVendorList( std::function<bool(VendorList)> fnc_r ) const;
159
160 public:
161 class Impl;
163
164#if LEGACY(1722)
166 void _addVendorList( std::vector<std::string> & list_r ) const ZYPP_DEPRECATED;
168 void _addVendorList( std::vector<IdString> && list_r );
169#endif
170 void _addVendorList( VendorList && list_r );
171};
172
174std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
175
177}; // namespace zypp
179
180#endif // ZYPP_VENDORATTR_H
RepoManager implementation.
Access to the sat-pools string space.
Definition: IdString.h:43
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
Definition of vendor equivalence.
Definition: VendorAttr.h:61
void addVendorList(const VendorList &list_r)
Definition: VendorAttr.h:111
VendorAttr()
Ctor providing the default set.
Definition: VendorAttr.cc:242
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
Definition: VendorAttr.cc:236
void addVendorList(const TContainer &container_r)
Definition: VendorAttr.h:115
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
Definition: VendorAttr.cc:331
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
Definition: VendorAttr.cc:275
friend std::ostream & operator<<(std::ostream &str, const VendorAttr &obj)
Definition: VendorAttr.cc:355
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: VendorAttr.h:161
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition: VendorAttr.h:108
unsigned foreachVendorList(std::function< bool(VendorList)> fnc_r) const
Call fnc_r for each equivalent vendor list (return false to break).
Definition: VendorAttr.cc:303
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition: VendorAttr.h:124
bool relaxedEquivalent(const Vendor &lVendor, const Vendor &rVendor) const
Like equivalent but always unifies suse and openSUSE vendor.
Definition: VendorAttr.cc:344
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
Definition: VendorAttr.cc:230
void _addVendorList(VendorList &&list_r)
Definition: VendorAttr.cc:300
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition: VendorAttr.h:103
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
Definition: VendorAttr.cc:258
A Solvable object within the sat Pool.
Definition: Solvable.h:54
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::string Vendor
Definition: Vendor.h:22
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
RW_pointer supporting 'copy on write' functionality.
Definition: PtrTypes.h:459
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition: Globals.h:99