libzypp 17.37.10

Map.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#ifndef ZYPP_SAT_MAP_H
12#define ZYPP_SAT_MAP_H
13
14#include <iosfwd>
15#include <string>
16
17#include <zypp/base/PtrTypes.h>
18#include <zypp/sat/detail/PoolMember.h>
19
21 namespace zypp
22{
24 namespace sat
25 {
33 class ZYPP_API Map
34 {
35 public:
36 using size_type = unsigned long;
37
39 struct PoolSizeType {};
41 static constexpr PoolSizeType poolSize = PoolSizeType();
42
43 public:
45 Map();
46
48 explicit Map( size_type size_r );
49
51 Map( PoolSizeType );
52
54 ~Map();
55
56 public:
58 bool empty() const;
59
61 size_type size() const;
62
64 void grow( size_type size_r );
65
66 public:
68 void setAll();
69
71 void clearAll();
72
74 void assignAll( bool val_r );
75
79 void set( size_type idx_r );
80
84 void clear( size_type idx_r );
85
89 void assign( size_type idx_r, bool val_r );
90
91 public:
95 bool test( size_type idx_r ) const;
96
100 bool operator[]( size_type idx_r ) const
101 { return test( idx_r ); }
102
103 public:
105 std::string asString( const char on_r = '1', const char off_r = '0' ) const;
106
107 public:
108 operator detail::CMap *();
109 operator const detail::CMap *() const
110 { return _pimpl.get(); }
111 private:
112 RWCOW_pointer<detail::CMap> _pimpl;
113 };
114
116 inline std::ostream & operator<<( std::ostream & str, const Map & obj )
117 { return str << obj.asString(); }
118
120 bool operator==( const Map & lhs, const Map & rhs ) ZYPP_API;
121
123 inline bool operator!=( const Map & lhs, const Map & rhs )
124 { return !( lhs == rhs ); }
125
126 } // namespace sat
128
130 template<> sat::detail::CMap * rwcowClone<sat::detail::CMap>( const sat::detail::CMap * rhs );
131
132 using Bitmap = sat::Map;
133
134} // namespace zypp
136#endif // ZYPP_SAT_MAP_H
PoolMember.h
zypp::sat::Map
Libsolv (bit)Map wrapper.
Definition Map.h:34
zypp::sat::Map::asString
std::string asString(const char on_r='1', const char off_r='0') const
String representation.
Definition Map.cc:108
zypp::sat::Map::clear
void clear(size_type idx_r)
Clear bit idx_r.
Definition Map.cc:87
zypp::sat::Map::size
size_type size() const
Size of the Map.
Definition Map.cc:61
zypp::sat::Map::grow
void grow(size_type size_r)
Grow the Map if necessary.
Definition Map.cc:64
zypp::sat::Map::operator[]
bool operator[](size_type idx_r) const
Test bit idx_r.
Definition Map.h:100
zypp::sat::Map::assign
void assign(size_type idx_r, bool val_r)
Assign val_r to bit idx_r.
Definition Map.cc:93
zypp::sat::Map::clearAll
void clearAll()
Clear all bits.
Definition Map.cc:70
zypp::sat::Map::poolSize
static constexpr PoolSizeType poolSize
An object indicating the bitmap should match the current pools capacity.
Definition Map.h:41
zypp::sat::Map::operator<<
std::ostream & operator<<(std::ostream &str, const Map &obj)
Stream output.
Definition Map.h:116
zypp::sat::Map::Map
Map()
Default ctor: empty Map.
Definition Map.cc:43
zypp::sat::Map::test
bool test(size_type idx_r) const
Test bit idx_r.
Definition Map.cc:102
zypp::sat::Map::set
void set(size_type idx_r)
Set bit idx_r.
Definition Map.cc:81
zypp::sat::Map::_pimpl
RWCOW_pointer< detail::CMap > _pimpl
Pointer to implementation.
Definition Map.h:112
zypp::sat::Map::assignAll
void assignAll(bool val_r)
Assign val_r to all bits.
Definition Map.cc:73
zypp::sat::Map::empty
bool empty() const
Whether Map is empty.
Definition Map.cc:58
zypp::sat::Map::operator!=
bool operator!=(const Map &lhs, const Map &rhs)
Definition Map.h:123
zypp::sat::Map::size_type
unsigned long size_type
Definition Map.h:36
zypp::sat::Map::setAll
void setAll()
Set all bits.
Definition Map.cc:67
str
String related utilities and Regular expression matching.
zypp::sat::detail::CMap
::s_Map CMap
Wrapped libsolv C data type exposed as backdoor.
Definition PoolMember.h:60
zypp::sat
Definition Resolver.h:28
zypp::sat::operator==
bool operator==(const Map &lhs, const Map &rhs)
Definition Map.cc:125
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::Bitmap
sat::Map Bitmap
Definition Bitmap.h:19
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::asString
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
zypp::rwcowClone< sat::detail::CMap >
sat::detail::CMap * rwcowClone< sat::detail::CMap >(const sat::detail::CMap *rhs)
Definition Map.cc:30
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
zypp::sat::Map::PoolSizeType
Type to indicate the bitmap should match the current pools capacity.
Definition Map.h:39
PtrTypes.h