libzypp
17.14.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Solvable.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_SAT_SOLVABLE_H
13
#define ZYPP_SAT_SOLVABLE_H
14
15
#include <iosfwd>
16
17
#include "
zypp/sat/detail/PoolMember.h
"
18
#include "
zypp/sat/SolvAttr.h
"
19
#include "
zypp/ResTraits.h
"
20
#include "
zypp/IdString.h
"
21
#include "
zypp/Edition.h
"
22
#include "
zypp/Arch.h
"
23
#include "
zypp/Dep.h
"
24
#include "
zypp/Capabilities.h
"
25
#include "
zypp/Capability.h
"
26
#include "
zypp/Locale.h
"
27
29
namespace
zypp
30
{
31
class
ByteCount;
32
class
CheckSum;
33
class
CpeId;
34
class
Date;
35
class
OnMediaLocation;
37
namespace
sat
38
{
53
class
Solvable
:
protected
detail::PoolMember
54
{
55
public
:
56
typedef
sat::detail::SolvableIdType
IdType
;
57
58
public
:
60
Solvable
()
61
:
_id
( detail::
noSolvableId
)
62
{}
63
65
explicit
Solvable
(
IdType
id_r )
66
:
_id
( id_r )
67
{}
68
69
public
:
71
static
const
Solvable
noSolvable
;
72
74
explicit
operator
bool
()
const
75
{
return
get
(); }
76
77
public
:
82
IdString
ident
()
const
;
83
85
ResKind
kind
()
const
;
86
91
bool
isKind
(
const
ResKind
& kind_r )
const
;
93
template
<
class
TRes>
94
bool
isKind
()
const
95
{
return
isKind
( resKind<TRes>() ); }
97
template
<
class
TIterator>
98
bool
isKind
( TIterator begin, TIterator end )
const
99
{
for_
( it, begin, end )
if
(
isKind
( *it ) )
return
true
;
return
false
; }
100
102
std::string
name
()
const
;
103
105
Edition
edition
()
const
;
106
108
Arch
arch
()
const
;
109
111
IdString
vendor
()
const
;
112
114
Repository
repository
()
const
;
116
RepoInfo
repoInfo
()
const
;
117
121
bool
isSystem
()
const
;
122
126
bool
onSystemByUser
()
const
;
127
131
bool
onSystemByAuto
()
const
;
132
134
bool
identIsAutoInstalled
()
const
135
{
return
identIsAutoInstalled
(
ident
() ); }
137
static
bool
identIsAutoInstalled
(
const
IdString
& ident_r );
138
140
bool
isNeedreboot
()
const
;
141
145
bool
multiversionInstall
()
const
;
146
148
Date
buildtime
()
const
;
149
151
Date
installtime
()
const
;
152
153
public
:
161
std::string
asString
()
const
;
162
164
std::string
asUserString
()
const
;
165
169
bool
identical
(
const
Solvable
& rhs )
const
;
170
172
bool
sameNVRA
(
const
Solvable
& rhs )
const
173
{
return
(
get
() == rhs.
get
() || (
ident
() == rhs.
ident
() &&
edition
() == rhs.
edition
() &&
arch
() == rhs.
arch
() ) ); }
174
175
public
:
181
Capabilities
provides
()
const
;
182
Capabilities
requires
()
const
;
183
Capabilities
conflicts
()
const
;
184
Capabilities
obsoletes
()
const
;
185
Capabilities
recommends
()
const
;
186
Capabilities
suggests
()
const
;
187
Capabilities
enhances
()
const
;
188
Capabilities
supplements
()
const
;
189
Capabilities
prerequires
()
const
;
190
192
Capabilities
dep
(
Dep
which_r )
const
193
{
194
switch
( which_r.
inSwitch
() )
195
{
196
case
Dep::PROVIDES_e
:
return
provides
();
break
;
197
case
Dep::REQUIRES_e
:
return
requires
();
break
;
198
case
Dep::CONFLICTS_e
:
return
conflicts
();
break
;
199
case
Dep::OBSOLETES_e
:
return
obsoletes
();
break
;
200
case
Dep::RECOMMENDS_e
:
return
recommends
();
break
;
201
case
Dep::SUGGESTS_e
:
return
suggests
();
break
;
202
case
Dep::ENHANCES_e
:
return
enhances
();
break
;
203
case
Dep::SUPPLEMENTS_e
:
return
supplements
();
break
;
204
case
Dep::PREREQUIRES_e
:
return
prerequires
();
break
;
205
}
206
return
Capabilities
();
207
}
209
Capabilities
operator[]
(
Dep
which_r )
const
210
{
return
dep
( which_r ); }
211
212
214
CapabilitySet
providesNamespace
(
const
std::string & namespace_r )
const
;
215
223
CapabilitySet
valuesOfNamespace
(
const
std::string & namespace_r )
const
;
225
226
public
:
230
bool
supportsLocales
()
const
;
232
bool
supportsLocale
(
const
Locale
& locale_r )
const
;
234
bool
supportsLocale
(
const
LocaleSet
& locales_r )
const
;
238
bool
supportsRequestedLocales
()
const
;
240
LocaleSet
getSupportedLocales
()
const
;
242
void
getSupportedLocales
(
LocaleSet
& locales_r )
const
243
{ locales_r =
getSupportedLocales
(); }
245
246
public
:
248
CpeId
cpeId
()
const
;
249
251
unsigned
mediaNr
()
const
;
252
274
ByteCount
installSize
()
const
;
275
277
ByteCount
downloadSize
()
const
;
278
280
std::string
distribution
()
const
;
281
283
std::string
summary
(
const
Locale
& lang_r =
Locale
() )
const
;
284
286
std::string
description
(
const
Locale
& lang_r =
Locale
() )
const
;
287
289
std::string
insnotify
(
const
Locale
& lang_r =
Locale
() )
const
;
291
std::string
delnotify
(
const
Locale
& lang_r =
Locale
() )
const
;
292
294
std::string
licenseToConfirm
(
const
Locale
& lang_r =
Locale
() )
const
;
296
bool
needToAcceptLicense
()
const
;
297
298
public
:
304
class
SplitIdent
305
{
306
public
:
307
SplitIdent
() {}
308
SplitIdent
(
IdString
ident_r );
309
SplitIdent
(
const
char
* ident_r );
310
SplitIdent
(
const
std::string & ident_r );
311
SplitIdent
(
ResKind
kind_r,
IdString
name_r );
312
SplitIdent
(
ResKind
kind_r,
const
C_Str
& name_r );
313
314
IdString
ident
()
const
{
return
_ident
; }
315
ResKind
kind
()
const
{
return
_kind
; }
316
IdString
name
()
const
{
return
_name
; }
317
318
private
:
319
IdString
_ident
;
320
ResKind
_kind
;
321
IdString
_name
;
322
};
323
324
public
:
334
std::string
lookupStrAttribute
(
const
SolvAttr
&
attr
)
const
;
345
std::string
lookupStrAttribute
(
const
SolvAttr
&
attr
,
const
Locale
& lang_r )
const
;
346
351
unsigned
long
long
lookupNumAttribute
(
const
SolvAttr
&
attr
)
const
;
353
unsigned
long
long
lookupNumAttribute
(
const
SolvAttr
&
attr
,
unsigned
long
long
notfound_r )
const
;
354
359
bool
lookupBoolAttribute
(
const
SolvAttr
&
attr
)
const
;
360
365
detail::IdType
lookupIdAttribute
(
const
SolvAttr
&
attr
)
const
;
366
371
CheckSum
lookupCheckSumAttribute
(
const
SolvAttr
&
attr
)
const
;
372
377
OnMediaLocation
lookupLocation
()
const
;
379
380
public
:
382
Solvable
nextInPool
()
const
;
384
Solvable
nextInRepo
()
const
;
386
detail::CSolvable
*
get
()
const
;
388
IdType
id
()
const
{
return
_id
; }
389
390
private
:
391
IdType
_id
;
392
};
394
396
std::ostream &
operator<<
( std::ostream & str,
const
Solvable
& obj );
397
399
std::ostream &
dumpOn
( std::ostream & str,
const
Solvable
& obj );
400
402
std::ostream &
dumpAsXmlOn
( std::ostream & str,
const
Solvable
& obj );
403
405
inline
bool
operator==
(
const
Solvable
& lhs,
const
Solvable
& rhs )
406
{
return
lhs.
get
() == rhs.
get
(); }
407
409
inline
bool
operator!=
(
const
Solvable
& lhs,
const
Solvable
& rhs )
410
{
return
lhs.
get
() != rhs.
get
(); }
411
413
inline
bool
operator<
(
const
Solvable
& lhs,
const
Solvable
& rhs )
414
{
return
lhs.
get
() < rhs.
get
(); }
415
417
template
<
class
TRes>
418
inline
bool
isKind
(
const
Solvable
& solvable_r )
419
{
return
solvable_r.
isKind
(
ResTraits<TRes>::kind
); }
420
422
inline
bool
identical
(
const
Solvable
& lhs,
const
Solvable
& rhs )
423
{
return
lhs.
identical
( rhs ); }
424
426
inline
bool
sameNVRA
(
const
Solvable
& lhs,
const
Solvable
& rhs )
427
{
return
lhs.
sameNVRA
( rhs ); }
428
429
431
inline
int
compareByN
(
const
Solvable
& lhs,
const
Solvable
& rhs )
432
{
433
int
res = 0;
434
if
( lhs != rhs )
435
{
436
if
( (res = lhs.
kind
().
compare
( rhs.
kind
() )) == 0 )
437
res = lhs.
name
().compare( rhs.
name
() );
438
}
439
return
res;
440
}
441
443
inline
int
compareByNVR
(
const
Solvable
& lhs,
const
Solvable
& rhs )
444
{
445
int
res =
compareByN
( lhs, rhs );
446
if
( res == 0 )
447
res = lhs.
edition
().
compare
( rhs.
edition
() );
448
return
res;
449
}
450
452
inline
int
compareByNVRA
(
const
Solvable
& lhs,
const
Solvable
& rhs )
453
{
454
int
res =
compareByNVR
( lhs, rhs );
455
if
( res == 0 )
456
res = lhs.
arch
().
compare
( rhs.
arch
() );
457
return
res;
458
}
459
461
namespace
detail
462
{
464
//
465
// CLASS NAME : SolvableIterator
466
//
468
class
SolvableIterator
:
public
boost::iterator_adaptor<
469
SolvableIterator
// Derived
470
, CSolvable*
// Base
471
, const Solvable
// Value
472
, boost::forward_traversal_tag
// CategoryOrTraversal
473
, const Solvable
// Reference
474
>
475
{
476
public
:
477
SolvableIterator
()
478
:
SolvableIterator
::iterator_adaptor_( 0 )
479
{}
480
481
explicit
SolvableIterator
(
const
Solvable
& val_r )
482
:
SolvableIterator
::iterator_adaptor_( 0 )
483
{
assignVal
( val_r ); }
484
485
explicit
SolvableIterator
(
SolvableIdType
id_r )
486
:
SolvableIterator
::iterator_adaptor_( 0 )
487
{
assignVal
(
Solvable
( id_r ) ); }
488
489
private
:
490
friend
class
boost::iterator_core_access
;
491
492
Solvable
dereference
()
const
493
{
return
_val
; }
494
495
void
increment
()
496
{
assignVal
(
_val
.
nextInPool
() ); }
497
498
private
:
499
void
assignVal
(
const
Solvable
& val_r )
500
{
_val
= val_r; base_reference() =
_val
.
get
(); }
501
502
Solvable
_val
;
503
};
504
}
// namespace detail
506
}
// namespace sat
508
509
class
PoolItem
;
511
namespace
sat
512
{
517
struct
asSolvable
518
{
519
typedef
Solvable
result_type
;
520
521
Solvable
operator()
(
const
Solvable
& solv_r )
const
522
{
return
solv_r; }
523
524
Solvable
operator()
(
const
PoolItem
& pi_r )
const
;
525
526
Solvable
operator()
(
const
ResObject_constPtr & res_r )
const
;
527
};
528
}
// namespace sat
530
}
// namespace zypp
532
533
ZYPP_DEFINE_ID_HASHABLE
( ::
zypp::sat::Solvable
);
534
535
#endif // ZYPP_SAT_SOLVABLE_H
zypp
sat
Solvable.h
Generated by
1.8.2