libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Selectable.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_UI_SELECTABLE_H
13
#define ZYPP_UI_SELECTABLE_H
14
15
#include <iosfwd>
16
17
#include "
zypp/base/ReferenceCounted.h
"
18
#include "
zypp/base/NonCopyable.h
"
19
#include "
zypp/base/PtrTypes.h
"
20
#include "
zypp/base/Iterator.h
"
21
22
#include "
zypp/ui/SelectableTraits.h
"
23
#include "
zypp/ui/Status.h
"
24
26
namespace
zypp
27
{
28
30
namespace
ui
31
{
32
33
DEFINE_PTR_TYPE
(Selectable);
34
36
//
37
// CLASS NAME : Selectable
38
//
51
class
Selectable
:
public
base::ReferenceCounted
,
private
base::NonCopyable
52
{
53
friend
std::ostream &
operator<<
( std::ostream & str,
const
Selectable
& obj );
54
friend
std::ostream &
dumpOn
( std::ostream & str,
const
Selectable
& obj );
55
56
public
:
57
typedef
intrusive_ptr<Selectable>
Ptr
;
58
typedef
intrusive_ptr<const Selectable>
constPtr
;
59
61
typedef
SelectableTraits::available_iterator
available_iterator
;
62
typedef
SelectableTraits::available_size_type
available_size_type
;
63
64
typedef
SelectableTraits::installed_iterator
installed_iterator
;
65
typedef
SelectableTraits::installed_size_type
installed_size_type
;
66
67
typedef
SelectableTraits::picklist_iterator
picklist_iterator
;
68
typedef
SelectableTraits::picklist_size_type
picklist_size_type
;
69
70
public
:
81
static
Ptr
get
(
const
pool::ByIdent
& ident_r );
82
84
static
Ptr
get
(
IdString
ident_r )
85
{
return
get
(
pool::ByIdent
( ident_r ) ); }
86
88
static
Ptr
get
(
ResKind
kind_r,
const
std::string & name_r )
89
{
return
get
(
pool::ByIdent
( kind_r, name_r ) ); }
90
92
static
Ptr
get
(
const
std::string & name_r )
93
{
return
get
(
pool::ByIdent
(
ResKind::package
, name_r ) ); }
94
96
static
Ptr
get
(
const
sat::Solvable
& solv_r )
97
{
return
get
(
pool::ByIdent
( solv_r ) ); }
98
100
static
Ptr
get
(
const
ResObject::constPtr
& resolvable_r )
101
{
return
resolvable_r ?
get
( resolvable_r->satSolvable() ) :
Ptr
(); }
102
104
static
Ptr
get
(
const
PoolItem
& pi_r )
105
{
return
get
( pi_r.satSolvable() ); }
107
108
public
:
114
IdString
ident
()
const
;
115
117
ResObject::Kind
kind
()
const
;
118
120
const
std::string &
name
()
const
;
121
123
PoolItem
installedObj
()
const
;
124
129
PoolItem
candidateObj
()
const
;
130
136
PoolItem
candidateObjFrom
(
Repository
repo_r )
const
;
137
144
PoolItem
updateCandidateObj
()
const
;
145
151
PoolItem
highestAvailableVersionObj
()
const
;
152
157
bool
identicalAvailable
(
const
PoolItem
& rhs )
const
;
158
163
bool
identicalInstalled
(
const
PoolItem
& rhs )
const
;
164
168
bool
identicalInstalledCandidate
()
const
169
{
return
identicalInstalled
(
candidateObj
() ); }
170
174
bool
identicalInstalledUpdateCandidate
()
const
175
{
return
identicalInstalled
(
updateCandidateObj
() ); }
176
181
PoolItem
identicalAvailableObj
(
const
PoolItem
& rhs )
const
;
182
187
PoolItem
identicalInstalledObj
(
const
PoolItem
& rhs )
const
;
188
195
template
<
class
_Res>
196
typename
ResTraits<_Res>::constPtrType
installedAsKind
()
const
197
{
return
asKind<_Res>(
candidateObj
() ); }
198
205
template
<
class
_Res>
206
typename
ResTraits<_Res>::constPtrType
candidateAsKind
()
const
207
{
return
asKind<_Res>(
candidateObj
() ); }
208
217
PoolItem
setCandidate
(
const
PoolItem
& newCandidate_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
219
PoolItem
setCandidate
(
ResObject::constPtr
newCandidate_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
220
227
bool
setOnSystem
(
const
PoolItem
& newCandidate_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
228
234
PoolItem
theObj
()
const
;
235
237
242
bool
availableEmpty
()
const
;
243
available_size_type
availableSize
()
const
;
244
available_iterator
availableBegin
()
const
;
245
available_iterator
availableEnd
()
const
;
247
249
254
bool
installedEmpty
()
const
;
255
installed_size_type
installedSize
()
const
;
256
installed_iterator
installedBegin
()
const
;
257
installed_iterator
installedEnd
()
const
;
258
//}
259
261
267
bool
picklistEmpty
()
const
;
268
picklist_size_type
picklistSize
()
const
;
269
picklist_iterator
picklistBegin
()
const
;
270
picklist_iterator
picklistEnd
()
const
;
271
//}
272
274
275
public
:
280
bool
hasObject
()
const
281
{
return
(!
installedEmpty
()) ||
candidateObj
(); }
282
284
bool
hasInstalledObj
()
const
285
{
return
!
installedEmpty
(); }
286
288
bool
hasCandidateObj
()
const
289
{
return
candidateObj
(); }
290
292
bool
hasBothObjects
()
const
293
{
return
(!
installedEmpty
()) &&
candidateObj
(); }
294
296
bool
hasInstalledObjOnly
()
const
297
{
return
(!
installedEmpty
()) && !
candidateObj
(); }
298
300
bool
hasCandidateObjOnly
()
const
301
{
return
(
installedEmpty
() ) &&
candidateObj
(); }
303
308
bool
isUnmaintained
()
const
;
309
320
bool
multiversionInstall
()
const
;
321
324
bool
pickInstall
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
,
bool
yesno_r =
true
);
325
328
bool
pickNoInstall
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
)
329
{
return
pickInstall
( pi_r, causer_r,
false
); }
330
333
bool
pickDelete
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
,
bool
yesno_r =
true
);
334
337
bool
pickNoDelete
(
const
PoolItem
& pi_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
)
338
{
return
pickDelete
( pi_r, causer_r,
false
); }
339
363
Status
pickStatus
(
const
PoolItem
& pi_r )
const
;
364
366
bool
setPickStatus
(
const
PoolItem
& pi_r,
Status
state_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
368
378
bool
isUndetermined
()
const
;
379
383
bool
isRelevant
()
const
;
384
386
bool
isSatisfied
()
const
;
387
389
bool
isBroken
()
const
;
390
396
bool
isNeeded
()
const
;
397
399
bool
isUnwanted
()
const
;
401
402
public
:
406
enum
Fate
{
407
TO_DELETE
= -1,
408
UNMODIFIED
= 0,
409
TO_INSTALL
= 1
410
};
412
Fate
fate
()
const
;
413
415
bool
unmodified
()
const
416
{
return
fate
() ==
UNMODIFIED
; }
417
419
bool
locked
()
const
420
{
Status
st(
status
() );
return
( st ==
S_Protected
|| st ==
S_Taboo
); }
421
423
bool
toModify
()
const
424
{
return
fate
() !=
UNMODIFIED
; }
425
427
bool
toDelete
()
const
428
{
return
fate
() ==
TO_DELETE
; }
429
431
bool
toInstall
()
const
432
{
return
fate
() ==
TO_INSTALL
; }
433
435
bool
onSystem
()
const
436
{
return
( (
hasInstalledObj
() && !
toDelete
() )
437
||(
hasCandidateObj
() &&
toInstall
() ) ); }
438
440
bool
offSystem
()
const
441
{
return
!
onSystem
(); }
442
444
bool
setFate
(
Fate
fate_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
445
447
bool
setToInstall
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
)
448
{
return
setFate
(
TO_INSTALL
, causer_r ); }
449
451
bool
setInstalled
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
452
454
bool
setUpToDate
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
455
457
bool
setToDelete
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
)
458
{
return
setFate
(
TO_DELETE
, causer_r ); }
459
461
bool
setDeleted
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
462
464
bool
unset
(
ResStatus::TransactByValue
causer_r =
ResStatus::USER
)
465
{
return
setFate
(
UNMODIFIED
, causer_r ); }
467
468
public
:
477
Status
status
()
const
;
478
483
bool
setStatus
(
Status
state_r,
ResStatus::TransactByValue
causer_r =
ResStatus::USER
);
484
486
ResStatus::TransactByValue
modifiedBy
()
const
;
487
489
bool
hasLicenceConfirmed
()
const
;
490
492
void
setLicenceConfirmed
(
bool
val_r =
true
);
494
495
public
:
497
class
Impl
;
498
typedef
shared_ptr<Impl>
Impl_Ptr
;
500
Selectable
(
Impl_Ptr
pimpl_r );
501
private
:
503
~Selectable
();
504
private
:
506
RW_pointer<Impl>
_pimpl
;
507
};
509
511
std::ostream &
operator<<
( std::ostream & str,
const
Selectable
& obj );
512
514
std::ostream &
dumpOn
( std::ostream & str,
const
Selectable
& obj );
515
520
struct
asSelectable
521
{
522
typedef
Selectable_Ptr
result_type
;
523
524
Selectable_Ptr
operator()
(
const
sat::Solvable
& solv_r )
const
;
525
526
Selectable_Ptr
operator()
(
const
PoolItem
& pi_r )
const
527
{
return
operator()
( pi_r.
satSolvable
() ); }
528
};
529
531
}
// namespace ui
534
}
// namespace zypp
536
#endif // ZYPP_UI_SELECTABLE_H
zypp
ui
Selectable.h
Generated by
1.8.1