libzypp 17.38.6
repository.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_NG_SAT_REPOSITORY_H
13#define ZYPP_NG_SAT_REPOSITORY_H
14
15#include <iosfwd>
18#include <zypp-core/Pathname.h>
21//#include <zypp/sat/LookupAttr.h> // LookupAttrTools.h included at EOF
23//#include <zypp/RepoInfo.h>
24#include <zypp-core/Date.h>
25#include <zypp/ng/cpeid.h>
26
28namespace zyppng
29{
30 namespace sat
31 {
32 namespace detail
33 {
34 struct ByRepository;
35 }
36
37 class Repository;
38
39 namespace detail {
40 template<> Pool & poolFromType( Repository & );
41 template<> const Pool & poolFromType( const Repository & );
42 }
43
45 //
46 // CLASS NAME : Repository
47 //
49 class Repository : public PoolMember<Repository>
50 {
51 public:
52 using SolvableIterator = boost::filter_iterator<detail::ByRepository, sat::detail::SolvableIterator>;
54 using size_type = unsigned int;
56
57 //using Keywords = sat::ArrayAttr<std::string, std::string>;
58
59 using ContentRevision = std::string;
60 using ContentIdentifier = std::string;
61
62 public:
65 : _id( detail::noRepoId ) {}
66
67 Repository(const Repository &) = default;
68 Repository(Repository &&) noexcept = default;
69 Repository &operator=(const Repository &) = default;
70 Repository &operator=(Repository &&) noexcept = default;
71
73 explicit Repository( IdType id_r )
74 : _id( id_r ) {}
75
76 public:
79
81 explicit operator bool() const
82 { return get() != nullptr; }
83
85 static const std::string & systemRepoAlias();
86
88 bool isSystemRepo() const;
89
90 public:
100 std::string alias() const;
101
103 //std::string name() const;
104
106 //std::string label() const;
107
109 //std::string asUserString() const
110 //{ return label(); }
111
112 public:
117
130
132 bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
133
151
169
173 //Keywords keywords() const;
174
176 //bool hasKeyword( const std::string & val_r ) const;
177
186 bool maybeOutdated() const;
187
194 //bool isUpdateRepo() const;
195
202 //bool providesUpdatesFor( const CpeId & cpeid_r ) const;
203
205 bool solvablesEmpty() const;
206
208 size_type solvablesSize() const;
209
212
213 public:
214
216 //class ProductInfoIterator;
217
225 //ProductInfoIterator compatibleWithProductBegin() const;
226
232 //ProductInfoIterator compatibleWithProductEnd() const;
233
235 //Iterable<ProductInfoIterator> compatibleWithProduct() const;
236
237
246 //ProductInfoIterator updatesProductBegin() const;
247
253 //ProductInfoIterator updatesProductEnd() const;
254
256 //Iterable<ProductInfoIterator> updatesProduct() const;
257
258 public:
260 //RepoInfo info() const;
261
267 //void setInfo( const RepoInfo & info_r );
268
270 //void clearInfo();
271
272 public:
274 void eraseFromPool();
275
277 struct EraseFromPool;
278
279 public:
281 Repository nextInPool() const;
282
283 public:
289
295 void addSolv( const zypp::Pathname & file_r );
296
304 void addHelix( const zypp::Pathname & file_r );
305
313 void addTesttags(const zypp::Pathname &file_r);
314
316 sat::Solvable::IdType addSolvables( unsigned count_r );
320
321
322 public:
324 detail::CRepo * get() const;
326 IdType id() const { return _id; }
335 int satInternalPriority() const;
336 int satInternalSubPriority() const;
338
339 private:
342
345
346 private:
348 };
349
350
351 //std::ostream & operator<<( std::ostream & str, const Repository & obj );
352
353 //std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj );
354
356 inline bool operator==( const Repository & lhs, const Repository & rhs )
357 { return lhs.get() == rhs.get(); }
358
360 inline bool operator!=( const Repository & lhs, const Repository & rhs )
361 { return !( lhs == rhs ); }
362
364 inline bool operator<( const Repository & lhs, const Repository & rhs )
365 { return lhs.get() < rhs.get(); }
366
368
387 /*
388 class Repository::ProductInfoIterator : public boost::iterator_adaptor<
389 Repository::ProductInfoIterator // Derived
390 , sat::LookupAttr::iterator // Base
391 , int // Value
392 , boost::forward_traversal_tag // CategoryOrTraversal
393 , int // Reference
394 >
395 {
396 public:
397 ProductInfoIterator()
398 {}
399
400 // Product label
401 std::string label() const;
402
403 // The Common Platform Enumeration name for this product.
404 CpeId cpeId() const;
405
406 private:
407 friend class Repository;
408 // Hide ctor as just a limited set of attributes is valid.
409 explicit ProductInfoIterator( sat::SolvAttr attr_r, Repository repo_r );
410
411 private:
412 friend class boost::iterator_core_access;
413 int dereference() const { return 0; }
414 };
415 */
417
419 /*
420 inline Iterable<Repository::ProductInfoIterator> Repository::compatibleWithProduct() const
421 { return makeIterable( compatibleWithProductBegin(), compatibleWithProductEnd() ); }
422 */
423
425 /*
426 inline Iterable<Repository::ProductInfoIterator> Repository::updatesProduct() const
427 { return makeIterable( updatesProductBegin(), updatesProductEnd() ); }
428 */
429
431 //
432 // CLASS NAME : Repository::EraseFromPool
433 //
461 {
462 void operator()( Repository repository_r ) const
463 { repository_r.eraseFromPool(); }
464 };
465
466
468 namespace detail
469 {
473
474 class RepositoryIterator : public boost::iterator_adaptor<
475 RepositoryIterator // Derived
476 , sat::detail::CRepo ** // Base
477 , Repository // Value
478 , boost::forward_traversal_tag // CategoryOrTraversal
479 , Repository // Reference
480 >
481 {
482 public:
484 : RepositoryIterator::iterator_adaptor_( 0 )
485 {}
486
488 : RepositoryIterator::iterator_adaptor_( p )
489 {}
490
491 private:
493
495 { return Repository( *base() ); }
496
497 void increment();
498 };
499
502 //
503 // CLASS NAME : ByRepository
504 //
507 {
508 public:
509 ByRepository( const Repository & repository_r ) : _repository( repository_r ) {}
512
513 bool operator()( const sat::Solvable & slv_r ) const
514 { return slv_r.repository() == _repository.id(); }
515
516 private:
518 };
519
521 } // namespace detail
523
526
527 } // namespace sat
528} // namespace zyppng
530
531// Late include as sat::ArrayAttr requires Repository.h
532//#include <zypp/sat/LookupAttrTools.h>
533
534#endif // ZYPP_SAT_REPOSITORY_H
Store and operate on date (time_t).
Definition Date.h:33
Iterable< SolvableIterator > solvables() const
Iterate the repositories Solvables.
Definition Repository.h:507
int satInternalSubPriority() const
Definition repository.cc:88
void addSolv(const zypp::Pathname &file_r)
Load Solvables from a solv-file.
void eraseFromPool()
Query class for Repository related products.
Repository()
Default ctor creates noRepository.
Definition repository.h:64
void addHelix(const zypp::Pathname &file_r)
Load Solvables from a helix-file.
bool isSystemRepo() const
Return whether this is the system repository.
Definition repository.cc:68
static const Repository noRepository
Represents no Repository.
Definition repository.h:78
void addTesttags(const zypp::Pathname &file_r)
Load Solvables from a libsolv testtags-file.
bool hasContentIdentifier(const ContentIdentifier &id_r) const
Whether id_r matches this repos content identifier.
std::string alias() const
Short unique string to identify a repo.
Definition repository.cc:74
sat::Solvable::IdType addSolvables(unsigned count_r)
Add count_r new empty Solvable to this Repository.
IdType id() const
Expert backdoor.
Definition repository.h:326
zypp::Date generatedTimestamp() const
Timestamp when this repository was generated.
boost::filter_iterator< detail::ByRepository, sat::detail::SolvableIterator > SolvableIterator
Definition repository.h:52
Repository(const Repository &)=default
ContentRevision contentRevision() const
Label to display for this repo.
Definition repository.cc:94
std::string ContentRevision
Definition repository.h:59
ContentIdentifier contentIdentifier() const
Unique string identifying a repositories content.
int satInternalPriority() const
libsolv internal priorities.
Definition repository.cc:82
bool maybeOutdated() const
repository keywords (tags)
SolvableIterable solvables() const
Iterate the repositories Solvables.
Definition repository.h:524
bool solvablesEmpty() const
Hint whether the Repo may provide updates for a product.
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
sat::Solvable::IdType addSolvable()
Definition repository.h:318
size_type solvablesSize() const
Number of solvables in Repository.
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
detail::CRepo * get() const
Expert backdoor.
Definition repository.cc:57
detail::RepoIdType IdType
Definition repository.h:55
std::string ContentIdentifier
Definition repository.h:60
Repository(Repository &&) noexcept=default
unsigned int size_type
Definition repository.h:54
zypp::Iterable< SolvableIterator > SolvableIterable
Definition repository.h:53
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
Definition repository.cc:52
Repository nextInPool() const
Return next Repository in Pool (or noRepository).
zypp::Date suggestedExpirationTimestamp() const
Suggested expiration timestamp.
A Solvable object within the sat Pool.
Definition solvable.h:65
detail::SolvableIdType IdType
Definition solvable.h:67
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
Definition solvable.cc:272
RepositoryIterator(sat::detail::CRepo **p)
Definition repository.h:487
bool operator!=(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
bool operator<(const LocaleSupport &lhs, const LocaleSupport &rhs)
relates: LocaleSupport
bool operator==(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Iterable< TIterator > makeIterable(TIterator &&begin_r, TIterator &&end_r)
relates: Iterable convenient construction.
Definition Iterable.h:88
CLASS NAME : detail::DIWrap.
Definition cap2str.cc:14
zypp::sat::detail::RepoIdType RepoIdType
Pool & poolFromType(T &)
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
zypp::sat::detail::CRepo CRepo
This file contains private API, this might break at any time between releases.
Query class for Repository related products.
Definition repository.h:461
void operator()(Repository repository_r) const
Definition repository.h:462
Functor filtering Solvable by Repository.
Definition repository.h:507
ByRepository(const Repository &repository_r)
Definition repository.h:509
ByRepository(sat::detail::RepoIdType id_r)
Definition repository.h:510
bool operator()(const sat::Solvable &slv_r) const
Definition repository.h:513