libzypp: zypp/PoolItem.h Source File

libzypp 17.25.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 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:
76 ResStatus & status() const;
77
79 ResStatus & statusReset() const;
81
82
88 bool isUndetermined() const;
89
93 bool isRelevant() const;
94
96 bool isSatisfied() const;
97
99 bool isBroken() const;
100
104 bool isNeeded() const;
105
107 bool isUnwanted() const;
109
110 public:
112 ResPool pool() const;
113
115 explicit operator sat::Solvable() const
116 { return resolvable() ? resolvable()->satSolvable() : sat::Solvable::noSolvable; }
117
121 sat::Solvable buddy() const;
122
123 public:
127 ResObject::constPtr resolvable() const;
128
132 operator ResObject::constPtr() const
133 { return resolvable(); }
134
136 ResObject::constPtr operator->() const
137 { return resolvable(); }
138
139 private:
140 friend class pool::PoolImpl;
142 static PoolItem makePoolItem( const sat::Solvable & solvable_r );
144 void setBuddy( const sat::Solvable & solv_r );
146 public:
147 struct Impl;
148 private:
149 explicit PoolItem( Impl * implptr_r );
151 RW_pointer<Impl> _pimpl;
152
153 private:
157 friend struct PoolItemSaver;
158 void saveState() const;
159 void restoreState() const;
160 bool sameState() const;
162 };
164
166 std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
167
168
170 inline bool operator==( const PoolItem & lhs, const PoolItem & rhs )
171 { return lhs.resolvable() == rhs.resolvable(); }
172
174 inline bool operator==( const PoolItem & lhs, const ResObject::constPtr & rhs )
175 { return lhs.resolvable() == rhs; }
176
178 inline bool operator==( const ResObject::constPtr & lhs, const PoolItem & rhs )
179 { return lhs == rhs.resolvable(); }
180
181
183 inline bool operator!=( const PoolItem & lhs, const PoolItem & rhs )
184 { return ! (lhs==rhs); }
185
187 inline bool operator!=( const PoolItem & lhs, const ResObject::constPtr & rhs )
188 { return ! (lhs==rhs); }
189
191 inline bool operator!=( const ResObject::constPtr & lhs, const PoolItem & rhs )
192 { return ! (lhs==rhs); }
193
198 struct asPoolItem
199 {
200 typedef PoolItem result_type;
201
202 PoolItem operator()( const sat::Solvable & solv_r ) const
203 { return PoolItem( solv_r ); }
204 };
205
206 } // namespace zypp
208 #endif // ZYPP_POOLITEM_H
PtrTypes.h
ResObject.h
ResStatus.h
SolvableType.h
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
zypp::PoolItem::isRelevant
bool isRelevant() const
Returns true if the solvable is relevant which means e.g.
Definition: PoolItem.cc:209
zypp::PoolItem::isNeeded
bool isNeeded() const
This includes unlocked broken patches, as well as those already selected to be installed (otherwise c...
Definition: PoolItem.cc:212
zypp::PoolItem::operator==
bool operator==(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition: PoolItem.h:174
zypp::PoolItem::operator!=
bool operator!=(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition: PoolItem.h:191
zypp::PoolItem::restoreState
void restoreState() const
Definition: PoolItem.cc:216
zypp::PoolItem::saveState
void saveState() const
Definition: PoolItem.cc:215
zypp::PoolItem::resolvable
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
Definition: PoolItem.cc:218
zypp::PoolItem::sameState
bool sameState() const
Definition: PoolItem.cc:217
zypp::PoolItem::operator!=
bool operator!=(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition: PoolItem.h:187
zypp::PoolItem::isBroken
bool isBroken() const
Whether a relevant items requirements are broken.
Definition: PoolItem.cc:211
zypp::PoolItem::status
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:204
zypp::PoolItem::setBuddy
void setBuddy(const sat::Solvable &solv_r)
Buddies are set by pool::PoolImpl.
Definition: PoolItem.cc:207
zypp::PoolItem::isSatisfied
bool isSatisfied() const
Whether a relevant items requirements are met.
Definition: PoolItem.cc:210
zypp::PoolItem::PoolItem
PoolItem(const SolvableType< Derived > &solvable_r)
Ctor looking up the sat::Solvable in the ResPool.
Definition: PoolItem.h:62
zypp::PoolItem::isUnwanted
bool isUnwanted() const
Broken (needed) but locked patches.
Definition: PoolItem.cc:213
zypp::PoolItem::operator==
bool operator==(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition: PoolItem.h:170
zypp::PoolItem::makePoolItem
static PoolItem makePoolItem(const sat::Solvable &solvable_r)
PoolItem generator for pool::PoolImpl.
Definition: PoolItem.cc:192
zypp::PoolItem::~PoolItem
~PoolItem()
Dtor.
Definition: PoolItem.cc:197
zypp::PoolItem::statusReset
ResStatus & statusReset() const
Reset status.
Definition: PoolItem.cc:205
zypp::PoolItem::pool
ResPool pool() const
Return the ResPool the item belongs to.
Definition: PoolItem.cc:200
zypp::PoolItem::PoolItem
PoolItem()
Default ctor for use in std::container.
Definition: PoolItem.cc:176
zypp::PoolItem::buddy
sat::Solvable buddy() const
Return the buddy we share our status object with.
Definition: PoolItem.cc:206
zypp::PoolItem::_pimpl
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: PoolItem.h:151
zypp::PoolItem::operator->
ResObject::constPtr operator->() const
Forward -> access to ResObject.
Definition: PoolItem.h:136
zypp::PoolItem::operator==
bool operator==(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition: PoolItem.h:178
zypp::PoolItem::operator<<
friend std::ostream & operator<<(std::ostream &str, const PoolItem &obj)
Definition: PoolItem.cc:221
zypp::PoolItem::isUndetermined
bool isUndetermined() const
No validation is performed for packages.
Definition: PoolItem.cc:208
zypp::PoolItem::operator!=
bool operator!=(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition: PoolItem.h:183
zypp::ResObject::constPtr
TraitsType::constPtrType constPtr
Definition: ResObject.h:43
zypp::ResPool
Global ResObject pool.
Definition: ResPool.h:61
zypp::ResStatus
Status bitfield.
Definition: ResStatus.h:54
zypp::pool::PoolImpl
Definition: PoolImpl.h:168
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:74
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
zypp::PoolItemSaver
Tem.
Definition: ResPoolProxy.cc:31
zypp::PoolItem::Impl
PoolItem implementation.
Definition: PoolItem.cc:38
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:286
zypp::asPoolItem
Solvable to PoolItem transform functor.
Definition: PoolItem.h:199
zypp::asPoolItem::operator()
PoolItem operator()(const sat::Solvable &solv_r) const
Definition: PoolItem.h:202
zypp::asPoolItem::result_type
PoolItem result_type
Definition: PoolItem.h:200
zypp::sat::SolvableType
Base class for creating Solvable based types.
Definition: SolvableType.h:55
zypp::sat::SolvableType< PoolItem >::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57