libzypp 17.32.5
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
84 VendorAttr(const VendorAttr &) = default;
86 VendorAttr &operator=(const VendorAttr &) = default;
88
93#if LEGACY(1722)
96#endif
97
101 bool addVendorFile( const Pathname & filename_r );
102#if LEGACY(1722)
104 bool addVendorFile( const Pathname & filename_r ) const ZYPP_DEPRECATED;
105#endif
106
108 using VendorList = std::vector<std::string>;
109
114 { _addVendorList( std::move(list_r) ); }
119 template <class TContainer>
120 void addVendorList( const TContainer & container_r )
121 {
123 for ( const auto & el : container_r )
124 tmp.push_back( std::string(el) );
125 _addVendorList( std::move(tmp) );
126 }
128 template <class TStr>
129 void addVendorList( const std::initializer_list<TStr> & container_r )
130 {
132 for ( const auto & el : container_r )
133 tmp.push_back( std::string(el) );
134 _addVendorList( std::move(tmp) );
135 }
136
142 bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
148 bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
149
151 bool relaxedEquivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
157 bool relaxedEquivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const;
158
159 public:
163 unsigned foreachVendorList( std::function<bool(VendorList)> fnc_r ) const;
164
165 public:
166 class Impl;
168
169#if LEGACY(1722)
171 void _addVendorList( std::vector<std::string> & list_r ) const ZYPP_DEPRECATED;
173 void _addVendorList( std::vector<IdString> && list_r );
174#endif
176};
177
179std::ostream & operator<<( std::ostream & str, const VendorAttr & obj );
180
182}; // namespace zypp
184
185#endif // ZYPP_VENDORATTR_H
RepoManager implementation.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
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:116
VendorAttr()
Ctor providing the default set.
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
void addVendorList(const TContainer &container_r)
Definition VendorAttr.h:120
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition VendorAttr.h:108
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
friend std::ostream & operator<<(std::ostream &str, const VendorAttr &obj)
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition VendorAttr.h:167
VendorAttr(VendorAttr &&) noexcept=default
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition VendorAttr.h:113
unsigned foreachVendorList(std::function< bool(VendorList)> fnc_r) const
Call fnc_r for each equivalent vendor list (return false to break).
VendorAttr(const VendorAttr &)=default
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition VendorAttr.h:129
bool relaxedEquivalent(const Vendor &lVendor, const Vendor &rVendor) const
Like equivalent but always unifies suse and openSUSE vendor.
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
void _addVendorList(VendorList &&list_r)
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
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.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::string Vendor
Definition Vendor.h:22
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:99