libzypp 17.37.17
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
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;
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) ); }
107
108 void addVendorList( const VendorList & list_r )
109 { _addVendorList( VendorList(list_r) ); }
110
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 }
119
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
165std::ostream & operator<<( std::ostream & str, const VendorAttr & obj ) ZYPP_API;
166
168}; // namespace zypp
170
171#endif // ZYPP_VENDORATTR_H
Access to the sat-pools string space.
Definition IdString.h:44
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:108
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:112
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition VendorAttr.h:100
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition VendorAttr.h:159
VendorAttr(VendorAttr &&) noexcept=default
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition VendorAttr.h:105
VendorAttr(const VendorAttr &)=default
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition VendorAttr.h:121
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
Definition Arch.h:364
String related utilities and Regular expression matching.
Libsolv interface
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
std::string Vendor
Definition Vendor.h:22
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
Provides API related macros.