libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Selectable.cc
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#include <iostream>
13
//#include "zypp/base/Logger.h"
14
15
#include "
zypp/ui/Selectable.h
"
16
#include "
zypp/ui/SelectableImpl.h
"
17
#include "
zypp/ResPool.h
"
18
20
namespace
zypp
21
{
22
23
namespace
ui
24
{
25
26
IMPL_PTR_TYPE
(Selectable);
27
28
Selectable::Ptr
Selectable::get
(
const
pool::ByIdent
& ident_r )
29
{
return
ResPool::instance
().
proxy
().
lookup
( ident_r ); }
30
32
//
33
// METHOD NAME : Selectable::Selectable
34
// METHOD TYPE : Ctor
35
//
36
Selectable::Selectable
(
Impl_Ptr
pimpl_r )
37
: _pimpl( pimpl_r )
38
{}
39
41
//
42
// METHOD NAME : Selectable::~Selectable
43
// METHOD TYPE : Dtor
44
//
45
Selectable::~Selectable
()
46
{}
47
49
//
50
// Forward to implementation.
51
// Restrict PoolItems to ResObject::constPtr!
52
//
54
55
IdString
Selectable::ident
()
const
56
{
return
_pimpl
->
ident
(); }
57
58
ResObject::Kind
Selectable::kind
()
const
59
{
return
_pimpl
->
kind
(); }
60
61
const
std::string &
Selectable::name
()
const
62
{
return
_pimpl
->
name
(); }
63
64
Status
Selectable::status
()
const
65
{
return
_pimpl
->
status
(); }
66
67
bool
Selectable::setStatus
(
Status
state_r,
ResStatus::TransactByValue
causer_r )
68
{
return
_pimpl
->
setStatus
( state_r, causer_r ); }
69
70
PoolItem
Selectable::installedObj
()
const
71
{
return
_pimpl
->
installedObj
(); }
72
73
PoolItem
Selectable::candidateObj
()
const
74
{
return
_pimpl
->
candidateObj
(); }
75
76
PoolItem
Selectable::candidateObjFrom
(
Repository
repo_r )
const
77
{
return
_pimpl
->
candidateObjFrom
( repo_r ); }
78
79
PoolItem
Selectable::updateCandidateObj
()
const
80
{
return
_pimpl
->
updateCandidateObj
(); }
81
82
PoolItem
Selectable::highestAvailableVersionObj
()
const
83
{
return
_pimpl
->
highestAvailableVersionObj
(); }
84
85
bool
Selectable::identicalAvailable
(
const
PoolItem
& rhs )
const
86
{
return
_pimpl
->
identicalAvailable
( rhs ); }
87
88
bool
Selectable::identicalInstalled
(
const
PoolItem
& rhs )
const
89
{
return
_pimpl
->
identicalInstalled
( rhs ); }
90
91
PoolItem
Selectable::identicalAvailableObj
(
const
PoolItem
& rhs )
const
92
{
return
_pimpl
->
identicalAvailableObj
( rhs ); }
93
94
PoolItem
Selectable::identicalInstalledObj
(
const
PoolItem
& rhs )
const
95
{
return
_pimpl
->
identicalInstalledObj
( rhs ); }
96
97
PoolItem
Selectable::setCandidate
(
const
PoolItem
& newCandidate_r,
ResStatus::TransactByValue
causer_r )
98
{
return
_pimpl
->
setCandidate
( newCandidate_r, causer_r ); }
99
100
PoolItem
Selectable::setCandidate
(
ResObject::constPtr
newCandidate_r,
ResStatus::TransactByValue
causer_r )
101
{
return
_pimpl
->
setCandidate
(
PoolItem
( newCandidate_r ), causer_r ); }
102
103
bool
Selectable::setOnSystem
(
const
PoolItem
& newCandidate_r,
ResStatus::TransactByValue
causer_r )
104
{
105
if
(
identicalInstalled
( newCandidate_r ) )
106
return
setFate
(
UNMODIFIED
, causer_r );
107
return
setCandidate
( newCandidate_r, causer_r ) &&
setFate
(
TO_INSTALL
, causer_r );
108
}
109
110
PoolItem
Selectable::theObj
()
const
111
{
return
_pimpl
->
theObj
(); }
112
114
115
bool
Selectable::availableEmpty
()
const
116
{
return
_pimpl
->
availableEmpty
(); }
117
118
Selectable::available_size_type
Selectable::availableSize
()
const
119
{
return
_pimpl
->
availableSize
(); }
120
121
Selectable::available_iterator
Selectable::availableBegin
()
const
122
{
return
_pimpl
->
availableBegin
(); }
123
124
Selectable::available_iterator
Selectable::availableEnd
()
const
125
{
return
_pimpl
->
availableEnd
(); }
126
128
129
bool
Selectable::installedEmpty
()
const
130
{
return
_pimpl
->
installedEmpty
(); }
131
132
Selectable::installed_size_type
Selectable::installedSize
()
const
133
{
return
_pimpl
->
installedSize
(); }
134
135
Selectable::installed_iterator
Selectable::installedBegin
()
const
136
{
return
_pimpl
->
installedBegin
(); }
137
138
Selectable::installed_iterator
Selectable::installedEnd
()
const
139
{
return
_pimpl
->
installedEnd
(); }
140
142
143
bool
Selectable::picklistEmpty
()
const
144
{
return
_pimpl
->
picklistEmpty
(); }
145
146
Selectable::picklist_size_type
Selectable::picklistSize
()
const
147
{
return
_pimpl
->
picklistSize
(); }
148
149
Selectable::picklist_iterator
Selectable::picklistBegin
()
const
150
{
return
_pimpl
->
picklistBegin
(); }
151
152
Selectable::picklist_iterator
Selectable::picklistEnd
()
const
153
{
return
_pimpl
->
picklistEnd
(); }
154
156
157
bool
Selectable::isUnmaintained
()
const
158
{
return
_pimpl
->
isUnmaintained
(); }
159
160
bool
Selectable::multiversionInstall
()
const
161
{
return
_pimpl
->
multiversionInstall
(); }
162
163
bool
Selectable::pickInstall
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r,
bool
yesno_r )
164
{
return
_pimpl
->
pickInstall
( pi_r, causer_r, yesno_r ); }
165
166
bool
Selectable::pickDelete
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r,
bool
yesno_r )
167
{
return
_pimpl
->
pickDelete
( pi_r, causer_r, yesno_r ); }
168
169
Status
Selectable::pickStatus
(
const
PoolItem
& pi_r )
const
170
{
return
_pimpl
->
pickStatus
( pi_r ); }
171
172
bool
Selectable::setPickStatus
(
const
PoolItem
& pi_r,
Status
state_r,
ResStatus::TransactByValue
causer_r )
173
{
return
_pimpl
->
setPickStatus
( pi_r, state_r, causer_r ); }
174
176
177
bool
Selectable::isUndetermined
()
const
178
{
return
_pimpl
->
isUndetermined
(); }
179
180
bool
Selectable::isRelevant
()
const
181
{
return
_pimpl
->
isRelevant
(); }
182
183
bool
Selectable::isSatisfied
()
const
184
{
return
_pimpl
->
isSatisfied
(); }
185
186
bool
Selectable::isBroken
()
const
187
{
return
_pimpl
->
isBroken
(); }
188
189
bool
Selectable::isNeeded
()
const
190
{
191
return
fate
() ==
TO_INSTALL
|| ( !
locked
() &&
isBroken
() );
192
}
193
194
bool
Selectable::isUnwanted
()
const
195
{
196
return
locked
() &&
isBroken
() ;
197
}
198
199
ResStatus::TransactByValue
Selectable::modifiedBy
()
const
200
{
return
_pimpl
->
modifiedBy
(); }
201
202
bool
Selectable::hasLicenceConfirmed
()
const
203
{
return
_pimpl
->
hasLicenceConfirmed
(); }
204
205
void
Selectable::setLicenceConfirmed
(
bool
val_r )
206
{
_pimpl
->
setLicenceConfirmed
( val_r ); }
207
208
209
Selectable::Fate
Selectable::fate
()
const
210
{
211
switch
(
status
() ) {
212
case
S_Update
:
213
case
S_Install
:
214
case
S_AutoUpdate
:
215
case
S_AutoInstall
:
216
return
TO_INSTALL
;
217
break
;
218
219
case
S_Del
:
220
case
S_AutoDel
:
221
return
TO_DELETE
;
222
break
;
223
224
case
S_Protected
:
225
case
S_Taboo
:
226
case
S_KeepInstalled
:
227
case
S_NoInst
:
228
break
;
229
}
230
return
UNMODIFIED
;
231
};
232
233
bool
Selectable::setFate
(
Fate
fate_r,
ResStatus::TransactByValue
causer_r )
234
{
235
switch
( fate_r )
236
{
237
case
TO_INSTALL
:
238
return
setStatus
(
hasInstalledObj
() ?
S_Update
:
S_Install
, causer_r );
239
break
;
240
241
case
TO_DELETE
:
242
return
setStatus
(
S_Del
, causer_r );
243
break
;
244
245
case
UNMODIFIED
:
246
switch
(
status
() ) {
247
case
S_Protected
:
248
case
S_Taboo
:
249
return
true
;
250
break
;
251
default
:
252
return
setStatus
(
hasInstalledObj
() ?
S_KeepInstalled
:
S_NoInst
, causer_r );
253
break
;
254
}
255
break
;
256
}
257
return
false
;
258
}
259
260
bool
Selectable::setInstalled
(
ResStatus::TransactByValue
causer_r )
261
{
262
return
(
hasInstalledObj
() ||
setStatus
(
S_Install
, causer_r ) );
263
}
264
265
bool
Selectable::setUpToDate
(
ResStatus::TransactByValue
causer_r )
266
{
267
if
( !
hasInstalledObj
() )
268
return
setStatus
(
S_Install
, causer_r );
269
270
PoolItem
cand(
candidateObj
() );
271
if
( ! cand )
272
return
true
;
273
274
return
(
installedObj
()->edition() >= cand->edition()
275
||
setStatus
(
S_Update
, causer_r ) );
276
}
277
278
bool
Selectable::setDeleted
(
ResStatus::TransactByValue
causer_r )
279
{
280
return
( !
hasInstalledObj
() ||
setStatus
(
S_Del
, causer_r ) );
281
}
282
283
/******************************************************************
284
**
285
** FUNCTION NAME : operator<<
286
** FUNCTION TYPE : std::ostream &
287
*/
288
std::ostream &
operator<<
( std::ostream & str,
const
Selectable
& obj )
289
{
return
str << *(obj.
_pimpl
); }
290
291
std::ostream &
dumpOn
( std::ostream & str,
const
Selectable
& obj )
292
{
return
dumpOn
( str, *(obj.
_pimpl
) ); }
293
295
}
// namespace ui
298
}
// namespace zypp
zypp
ui
Selectable.cc
Generated by
1.8.1