libzypp: zypp/VendorAttr.h Source File

libzypp 17.38.8

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-core/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
60 class ZYPP_API VendorAttr
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) ); }
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;
159 RWCOW_pointer<Impl> _pimpl;
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
Globals.h
Provides API related macros.
IdString.h
PtrTypes.h
Vendor.h
Impl
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:55
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::VendorAttr
Definition of vendor equivalence.
Definition VendorAttr.h:61
zypp::VendorAttr::addVendorList
void addVendorList(const VendorList &list_r)
Definition VendorAttr.h:108
zypp::VendorAttr::VendorAttr
VendorAttr()
Ctor providing the default set.
Definition VendorAttr.cc:242
zypp::VendorAttr::noTargetInstance
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
Definition VendorAttr.cc:236
zypp::VendorAttr::addVendorList
void addVendorList(const TContainer &container_r)
Definition VendorAttr.h:112
zypp::VendorAttr::VendorList
std::vector< std::string > VendorList
Preferred type to pass equivalent vendor strings.
Definition VendorAttr.h:100
zypp::VendorAttr::addVendorFile
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
Definition VendorAttr.cc:275
zypp::VendorAttr::_pimpl
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition VendorAttr.h:159
zypp::VendorAttr::VendorAttr
VendorAttr(VendorAttr &&) noexcept=default
zypp::VendorAttr::addVendorList
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Definition VendorAttr.h:105
zypp::VendorAttr::VendorAttr
VendorAttr(const VendorAttr &)=default
zypp::VendorAttr::addVendorList
void addVendorList(const std::initializer_list< TStr > &container_r)
Definition VendorAttr.h:121
zypp::VendorAttr::instance
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
Definition VendorAttr.cc:230
zypp::VendorAttr::_addVendorList
void _addVendorList(VendorList &&list_r)
Definition VendorAttr.cc:300
zypp::VendorAttr::addVendorDirectory
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
Definition VendorAttr.cc:258
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::sat
Libsolv interface
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::Vendor
std::string Vendor
Definition Vendor.h:22
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
PathInfo.h