libzypp
17.14.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Repository.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_SAT_REPOSITORY_H
13
#define ZYPP_SAT_REPOSITORY_H
14
15
#include <iosfwd>
16
#include "
zypp/base/Iterator.h
"
17
#include "
zypp/Pathname.h
"
18
#include "
zypp/sat/detail/PoolMember.h
"
19
#include "
zypp/sat/LookupAttr.h
"
// LookupAttrTools.h included at EOF
20
#include "
zypp/sat/Solvable.h
"
21
#include "
zypp/RepoInfo.h
"
22
#include "
zypp/Date.h
"
23
#include "
zypp/CpeId.h
"
24
26
namespace
zypp
27
{
28
29
namespace
detail
30
{
31
struct
ByRepository;
32
}
33
35
//
36
// CLASS NAME : Repository
37
//
39
class
Repository
:
protected
sat::detail::PoolMember
40
{
41
public
:
42
typedef
filter_iterator<detail::ByRepository, sat::detail::SolvableIterator>
SolvableIterator
;
43
typedef
sat::detail::size_type
size_type
;
44
typedef
sat::detail::RepoIdType
IdType
;
45
46
typedef
sat::ArrayAttr<std::string,std::string>
Keywords
;
47
48
typedef
std::string
ContentRevision
;
49
typedef
std::string
ContentIdentifier
;
50
51
public
:
53
Repository
()
54
:
_id
( sat::detail::
noRepoId
) {}
55
57
explicit
Repository
(
IdType
id_r )
58
:
_id
( id_r ) {}
59
60
public
:
62
static
const
Repository
noRepository
;
63
65
explicit
operator
bool
()
const
66
{
return
get
() !=
nullptr
; }
67
69
static
const
std::string &
systemRepoAlias
();
70
72
bool
isSystemRepo
()
const
;
73
74
public
:
84
std::string
alias
()
const
;
85
87
std::string
name
()
const
;
88
90
std::string
label
()
const
;
91
93
std::string
asUserString
()
const
94
{
return
label
(); }
95
96
public
:
100
ContentRevision
contentRevision
()
const
;
101
113
ContentIdentifier
contentIdentifier
()
const
;
114
116
bool
hasContentIdentifier
(
const
ContentIdentifier
& id_r )
const
;
117
134
Date
generatedTimestamp
()
const
;
135
152
Date
suggestedExpirationTimestamp
()
const
;
153
157
Keywords
keywords
()
const
;
158
160
bool
hasKeyword
(
const
std::string & val_r )
const
;
161
170
bool
maybeOutdated
()
const
;
171
178
bool
isUpdateRepo
()
const
;
179
186
bool
providesUpdatesFor
(
const
CpeId
& cpeid_r )
const
;
187
189
bool
solvablesEmpty
()
const
;
190
192
size_type
solvablesSize
()
const
;
193
195
SolvableIterator
solvablesBegin
()
const
;
196
198
SolvableIterator
solvablesEnd
()
const
;
199
201
Iterable<SolvableIterator>
solvables
()
const
;
202
203
public
:
204
206
class
ProductInfoIterator;
207
215
ProductInfoIterator
compatibleWithProductBegin
()
const
;
216
222
ProductInfoIterator
compatibleWithProductEnd
()
const
;
223
225
Iterable<ProductInfoIterator>
compatibleWithProduct
()
const
;
226
227
236
ProductInfoIterator
updatesProductBegin
()
const
;
237
243
ProductInfoIterator
updatesProductEnd
()
const
;
244
246
Iterable<ProductInfoIterator>
updatesProduct
()
const
;
247
248
public
:
250
RepoInfo
info
()
const
;
251
257
void
setInfo
(
const
RepoInfo
& info_r );
258
260
void
clearInfo
();
261
262
public
:
264
void
eraseFromPool
();
265
267
struct
EraseFromPool;
268
269
public
:
271
Repository
nextInPool
()
const
;
272
273
public
:
285
void
addSolv
(
const
Pathname & file_r );
286
294
void
addHelix
(
const
Pathname & file_r );
295
297
sat::Solvable::IdType
addSolvables
(
unsigned
count_r );
299
sat::Solvable::IdType
addSolvable
()
300
{
return
addSolvables
( 1 ); }
302
303
public
:
305
sat::detail::CRepo
*
get
()
const
;
307
IdType
id
()
const
{
return
_id
; }
316
int
satInternalPriority
()
const
;
317
int
satInternalSubPriority
()
const
;
319
320
private
:
321
IdType
_id
;
322
};
324
326
std::ostream &
operator<<
( std::ostream & str,
const
Repository
& obj );
327
329
std::ostream &
dumpAsXmlOn
( std::ostream & str,
const
Repository
& obj );
330
332
inline
bool
operator==
(
const
Repository
& lhs,
const
Repository
& rhs )
333
{
return
lhs.
get
() == rhs.
get
(); }
334
336
inline
bool
operator!=
(
const
Repository
& lhs,
const
Repository
& rhs )
337
{
return
lhs.
get
() != rhs.
get
(); }
338
340
inline
bool
operator<
(
const
Repository
& lhs,
const
Repository
& rhs )
341
{
return
lhs.
get
() < rhs.
get
(); }
342
344
363
class
Repository::ProductInfoIterator
:
public
boost::iterator_adaptor<
364
Repository::ProductInfoIterator
// Derived
365
, sat::LookupAttr::iterator
// Base
366
, int
// Value
367
, boost::forward_traversal_tag
// CategoryOrTraversal
368
, int
// Reference
369
>
370
{
371
public
:
372
ProductInfoIterator
()
373
{}
374
376
std::string
label
()
const
;
377
379
CpeId
cpeId
()
const
;
380
381
private
:
382
friend
class
Repository
;
384
explicit
ProductInfoIterator
(
sat::SolvAttr
attr_r,
Repository
repo_r );
385
386
private
:
387
friend
class
boost::iterator_core_access
;
388
int
dereference
()
const
{
return
0; }
389
};
391
393
inline
Iterable<Repository::ProductInfoIterator>
Repository::compatibleWithProduct
()
const
394
{
return
makeIterable(
compatibleWithProductBegin
(),
compatibleWithProductEnd
() ); }
395
397
inline
Iterable<Repository::ProductInfoIterator>
Repository::updatesProduct
()
const
398
{
return
makeIterable(
updatesProductBegin
(),
updatesProductEnd
() ); }
399
401
//
402
// CLASS NAME : Repository::EraseFromPool
403
//
430
struct
Repository::EraseFromPool
431
{
432
void
operator()
(
Repository
repository_r )
const
433
{ repository_r.
eraseFromPool
(); }
434
};
436
438
namespace
detail
439
{
440
441
//
442
// CLASS NAME : RepositoryIterator
443
//
445
class
RepositoryIterator
:
public
boost::iterator_adaptor<
446
RepositoryIterator
// Derived
447
, sat::detail::CRepo **
// Base
448
, Repository
// Value
449
, boost::forward_traversal_tag
// CategoryOrTraversal
450
, Repository
// Reference
451
>
452
{
453
public
:
454
RepositoryIterator
()
455
:
RepositoryIterator
::iterator_adaptor_( 0 )
456
{}
457
458
explicit
RepositoryIterator
(
sat::detail::CRepo
** p )
459
:
RepositoryIterator
::iterator_adaptor_( p )
460
{}
461
462
private
:
463
friend
class
boost::iterator_core_access
;
464
465
Repository
dereference
()
const
466
{
return
Repository
( *base() ); }
467
468
void
increment
();
469
};
472
//
473
// CLASS NAME : ByRepository
474
//
476
struct
ByRepository
477
{
478
public
:
479
ByRepository
(
const
Repository
& repository_r ) :
_repository
( repository_r ) {}
480
ByRepository
(
sat::detail::RepoIdType
id_r ) :
_repository
( id_r ) {}
481
ByRepository
() {}
482
483
bool
operator()
(
const
sat::Solvable
& slv_r )
const
484
{
return
slv_r.
repository
() ==
_repository
; }
485
486
private
:
487
Repository
_repository
;
488
};
491
}
// namespace detail
493
494
inline
Iterable<Repository::SolvableIterator>
Repository::solvables
()
const
495
{
return
makeIterable(
solvablesBegin
(),
solvablesEnd
() ); }
496
498
}
// namespace zypp
500
501
// Late include as sat::ArrayAttr requires Repository.h
502
#include "
zypp/sat/LookupAttrTools.h
"
503
504
#endif // ZYPP_SAT_REPOSITORY_H
zypp
Repository.h
Generated by
1.8.2