libzypp
11.13.5
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/SafeBool.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
25
namespace
zypp
26
{
27
28
namespace
detail
29
{
30
struct
ByRepository;
31
}
32
34
//
35
// CLASS NAME : Repository
36
//
38
class
Repository
:
protected
sat::detail::PoolMember
,
39
private
base::SafeBool
<Repository>
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
public
:
50
Repository
()
51
:
_id
( sat::detail::
noRepoId
) {}
52
54
explicit
Repository
(
IdType
id_r )
55
:
_id
( id_r ) {}
56
57
public
:
59
static
const
Repository
noRepository
;
60
61
#ifndef SWIG // Swig treats it as syntax error
62
63
using
base::SafeBool<Repository>::operator
bool_type
;
64
#endif
65
66
static
const
std::string &
systemRepoAlias
();
67
69
bool
isSystemRepo
()
const
;
70
71
public
:
81
std::string
alias
()
const
;
82
84
std::string
name
()
const
;
85
102
Date
generatedTimestamp
()
const
;
103
120
Date
suggestedExpirationTimestamp
()
const
;
121
125
Keywords
keywords
()
const
;
126
135
bool
maybeOutdated
()
const
;
136
145
bool
isUpdateRepo
()
const
;
146
156
bool
providesUpdatesFor
(
const
std::string &cpeid )
const
;
157
159
bool
solvablesEmpty
()
const
;
160
162
size_type
solvablesSize
()
const
;
163
165
SolvableIterator
solvablesBegin
()
const
;
166
168
SolvableIterator
solvablesEnd
()
const
;
169
170
public
:
171
173
class
ProductInfoIterator
;
174
182
ProductInfoIterator
compatibleWithProductBegin
()
const
;
183
189
ProductInfoIterator
compatibleWithProductEnd
()
const
;
190
196
ProductInfoIterator
updatesProductBegin
()
const
;
197
203
ProductInfoIterator
updatesProductEnd
()
const
;
204
205
public
:
207
RepoInfo
info
()
const
;
208
214
void
setInfo
(
const
RepoInfo
& info_r );
215
217
void
clearInfo
();
218
219
public
:
221
void
eraseFromPool
();
222
224
struct
EraseFromPool
;
225
226
public
:
228
Repository
nextInPool
()
const
;
229
230
public
:
242
void
addSolv
(
const
Pathname & file_r );
243
251
void
addHelix
(
const
Pathname & file_r );
252
254
sat::Solvable::IdType
addSolvables
(
unsigned
count_r );
256
sat::Solvable::IdType
addSolvable
()
257
{
return
addSolvables
( 1 ); }
259
260
public
:
262
::_Repo *
get
()
const
;
264
IdType
id
()
const
{
return
_id
; }
273
int
satInternalPriority
()
const
;
274
int
satInternalSubPriority
()
const
;
276
private
:
277
#ifndef SWIG // Swig treats it as syntax error
278
friend
base::SafeBool<Repository>::operator
bool_type
()
const
;
279
#endif
280
bool
boolTest
()
const
{
return
get
(); }
281
private
:
282
IdType
_id
;
283
};
285
287
std::ostream &
operator<<
( std::ostream & str,
const
Repository
& obj );
288
290
inline
bool
operator==
(
const
Repository
& lhs,
const
Repository
& rhs )
291
{
return
lhs.
get
() == rhs.
get
(); }
292
294
inline
bool
operator!=
(
const
Repository
& lhs,
const
Repository
& rhs )
295
{
return
lhs.
get
() != rhs.
get
(); }
296
298
inline
bool
operator<
(
const
Repository
& lhs,
const
Repository
& rhs )
299
{
return
lhs.
get
() < rhs.
get
(); }
300
302
318
class
Repository::ProductInfoIterator
:
public
boost::iterator_adaptor<
319
Repository::ProductInfoIterator
// Derived
320
, sat::LookupAttr::iterator
// Base
321
, int
// Value
322
, boost::forward_traversal_tag
// CategoryOrTraversal
323
, int
// Reference
324
>
325
{
326
public
:
327
ProductInfoIterator
()
328
{}
329
333
std::string
label
()
const
;
334
341
std::string
cpeId
()
const
;
342
343
private
:
344
friend
class
Repository
;
346
explicit
ProductInfoIterator
(
sat::SolvAttr
attr_r,
Repository
repo_r );
347
348
private
:
349
friend
class
boost::iterator_core_access
;
350
int
dereference
()
const
{
return
0; }
351
};
353
355
//
356
// CLASS NAME : Repository::EraseFromPool
357
//
384
struct
Repository::EraseFromPool
385
{
386
void
operator()
(
Repository
repository_r )
const
387
{ repository_r.
eraseFromPool
(); }
388
};
390
392
namespace
detail
393
{
394
395
//
396
// CLASS NAME : RepositoryIterator
397
//
399
class
RepositoryIterator
:
public
boost::iterator_adaptor<
400
RepositoryIterator
// Derived
401
, ::_Repo **
// Base
402
, Repository
// Value
403
, boost::forward_traversal_tag
// CategoryOrTraversal
404
, Repository
// Reference
405
>
406
{
407
public
:
408
RepositoryIterator
()
409
:
RepositoryIterator
::iterator_adaptor_( 0 )
410
{}
411
412
explicit
RepositoryIterator
( ::_Repo ** p )
413
:
RepositoryIterator
::iterator_adaptor_( p )
414
{}
415
416
private
:
417
friend
class
boost::iterator_core_access
;
418
419
Repository
dereference
()
const
420
{
return
Repository
( *base() ); }
421
422
void
increment
();
423
};
426
//
427
// CLASS NAME : ByRepository
428
//
430
struct
ByRepository
431
{
432
public
:
433
ByRepository
(
const
Repository
& repository_r ) :
_repository
( repository_r ) {}
434
ByRepository
(
sat::detail::RepoIdType
id_r ) :
_repository
( id_r ) {}
435
ByRepository
() {}
436
437
bool
operator()
(
const
sat::Solvable
& slv_r )
const
438
{
return
slv_r.
repository
() ==
_repository
; }
439
440
private
:
441
Repository
_repository
;
442
};
445
}
// namespace detail
448
}
// namespace zypp
450
451
// Late include as sat::ArrayAttr requires Repository.h
452
#include "
zypp/sat/LookupAttrTools.h
"
453
454
#endif // ZYPP_SAT_REPOSITORY_H
zypp
Repository.h
Generated by
1.8.1