libzypp 17.37.10

PoolItem.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_POOLITEM_H
13#define ZYPP_POOLITEM_H
14
15#include <iosfwd>
16#include <functional>
17
18#include <zypp/base/PtrTypes.h>
19#include <zypp/ResObject.h>
20
21#include <zypp/sat/SolvableType.h>
22#include <zypp/ResStatus.h>
23
25 namespace zypp
26{
27 class ResPool;
28 namespace pool
29 {
30 class PoolImpl;
31 }
50 class ZYPP_API PoolItem : public sat::SolvableType<PoolItem>
51 {
52 friend std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
53 public:
55 PoolItem();
56
58 explicit PoolItem( const sat::Solvable & solvable_r );
59
61 template <class Derived>
62 explicit PoolItem( const SolvableType<Derived> & solvable_r )
63 : PoolItem( solvable_r.satSolvable() )
64 {}
65
67 explicit PoolItem( const ResObject::constPtr & resolvable_r );
68
70 ~PoolItem();
71
72 public:
75
76 ResStatus & status() const;
77
79 ResStatus & statusReset() const;
80
85 ResStatus & statusReinit() const;
87
88
93
94 bool isUndetermined() const;
95
99 bool isRelevant() const;
100
102 bool isSatisfied() const;
103
105 bool isBroken() const;
106
110 bool isNeeded() const;
111
113 bool isUnwanted() const;
115
116 public:
118 ResPool pool() const;
119
121 explicit operator sat::Solvable() const
122 { return resolvable() ? resolvable()->satSolvable() : sat::Solvable::noSolvable; }
123
127 sat::Solvable buddy() const;
128
129 public:
133 ResObject::constPtr resolvable() const;
134
138 operator ResObject::constPtr() const
139 { return resolvable(); }
140
142 ResObject::constPtr operator->() const
143 { return resolvable(); }
144
145 private:
146 friend class pool::PoolImpl;
148 static PoolItem makePoolItem( const sat::Solvable & solvable_r );
150 void setBuddy( const sat::Solvable & solv_r );
152 public:
153 struct Impl;
154 private:
155 explicit PoolItem( Impl * implptr_r );
157 RW_pointer<Impl> _pimpl;
158
159 private:
163 friend struct PoolItemSaver;
164 void saveState() const;
165 void restoreState() const;
166 bool sameState() const;
168 };
169
170
172 std::ostream & operator<<( std::ostream & str, const PoolItem & obj ) ZYPP_API;
173
175 inline bool operator==( const PoolItem & lhs, const PoolItem & rhs )
176 { return lhs.resolvable() == rhs.resolvable(); }
177
179 inline bool operator==( const PoolItem & lhs, const ResObject::constPtr & rhs )
180 { return lhs.resolvable() == rhs; }
181
183 inline bool operator==( const ResObject::constPtr & lhs, const PoolItem & rhs )
184 { return lhs == rhs.resolvable(); }
185
186
188 inline bool operator!=( const PoolItem & lhs, const PoolItem & rhs )
189 { return ! (lhs==rhs); }
190
192 inline bool operator!=( const PoolItem & lhs, const ResObject::constPtr & rhs )
193 { return ! (lhs==rhs); }
194
196 inline bool operator!=( const ResObject::constPtr & lhs, const PoolItem & rhs )
197 { return ! (lhs==rhs); }
198
203 struct asPoolItem
204 {
205 using result_type = PoolItem;
206
207 PoolItem operator()( const sat::Solvable & solv_r ) const
208 { return PoolItem( solv_r ); }
209 };
210
211} // namespace zypp
213#endif // ZYPP_POOLITEM_H
ResObject.h
ResStatus.h
SolvableType.h
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::PoolItem::operator==
bool operator==(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition PoolItem.h:179
zypp::PoolItem::operator!=
bool operator!=(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition PoolItem.h:196
zypp::PoolItem::restoreState
void restoreState() const
Definition PoolItem.cc:225
zypp::PoolItem::PoolItemSaver
friend struct PoolItemSaver
Definition PoolItem.h:163
zypp::PoolItem::saveState
void saveState() const
Definition PoolItem.cc:224
zypp::PoolItem::resolvable
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
Definition PoolItem.cc:227
zypp::PoolItem::sameState
bool sameState() const
Definition PoolItem.cc:226
zypp::PoolItem::operator!=
bool operator!=(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition PoolItem.h:192
zypp::PoolItem::setBuddy
void setBuddy(const sat::Solvable &solv_r)
Buddies are set by pool::PoolImpl.
Definition PoolItem.cc:216
zypp::PoolItem::PoolItem
PoolItem(const SolvableType< Derived > &solvable_r)
Ctor looking up the sat::Solvable in the ResPool.
Definition PoolItem.h:62
zypp::PoolItem::operator==
bool operator==(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition PoolItem.h:175
zypp::PoolItem::makePoolItem
static PoolItem makePoolItem(const sat::Solvable &solvable_r)
PoolItem generator for pool::PoolImpl.
Definition PoolItem.cc:200
zypp::PoolItem::PoolItem
PoolItem()
Default ctor for use in std::container.
Definition PoolItem.cc:184
zypp::PoolItem::_pimpl
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition PoolItem.h:157
zypp::PoolItem::operator->
ResObject::constPtr operator->() const
Forward -> access to ResObject.
Definition PoolItem.h:142
zypp::PoolItem::operator==
bool operator==(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition PoolItem.h:183
zypp::PoolItem::operator!=
bool operator!=(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition PoolItem.h:188
zypp::ResObject::constPtr
TraitsType::constPtrType constPtr
Definition ResObject.h:43
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::ResStatus
Status bitfield.
Definition ResStatus.h:55
zypp::pool::PoolImpl
Definition PoolImpl.h:169
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
zypp::sat::Solvable::noSolvable
static const Solvable noSolvable
Represents no Solvable.
Definition Solvable.h:80
str
String related utilities and Regular expression matching.
zypp::pool
Definition ByIdent.h:24
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::PoolItem::Impl
PoolItem implementation.
Definition PoolItem.cc:39
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
zypp::asPoolItem
Solvable to PoolItem transform functor.
Definition PoolItem.h:204
zypp::asPoolItem::operator()
PoolItem operator()(const sat::Solvable &solv_r) const
Definition PoolItem.h:207
zypp::asPoolItem::result_type
PoolItem result_type
Definition PoolItem.h:205
zypp::sat::SolvableType
Base class for creating Solvable based types.
Definition SolvableType.h:55
zypp::sat::SolvableType< PoolItem >::satSolvable
Solvable satSolvable() const
Definition SolvableType.h:57
zypp::sat::SolvableType< PoolItem >::SolvableType
SolvableType()
Definition SolvableType.h:164
PtrTypes.h