libzypp 17.38.7
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>
27
29namespace zyppng
30{
31 namespace sat
32 {
33 namespace detail
34 {
35 struct ByRepository;
36 }
37
38 class Repository;
39
40 namespace detail {
41 template<> Pool & poolFromType( Repository & );
42 template<> const Pool & poolFromType( const Repository & );
43 }
44
46 //
47 // CLASS NAME : Repository
48 //
50 class Repository : public PoolMember<Repository>
51 {
52 public:
55 using size_type = unsigned int;
57
58 //using Keywords = sat::ArrayAttr<std::string, std::string>;
59
60 using ContentRevision = std::string;
61 using ContentIdentifier = std::string;
62
63 public:
66 : _id( detail::noRepoId ) {}
67
68 Repository(const Repository &) = default;
69 Repository(Repository &&) noexcept = default;
70 Repository &operator=(const Repository &) = default;
71 Repository &operator=(Repository &&) noexcept = default;
72
74 explicit Repository( IdType id_r )
75 : _id( id_r ) {}
76
77 public:
80
82 explicit operator bool() const
83 { return get() != nullptr; }
84
86 static const std::string & systemRepoAlias();
87
89 bool isSystemRepo() const;
90
91 public:
101 std::string alias() const;
102
104 //std::string name() const;
105
107 //std::string label() const;
108
110 //std::string asUserString() const
111 //{ return label(); }
112
113 public:
118
131
133 bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
134
152
170
174 //Keywords keywords() const;
175
177 //bool hasKeyword( const std::string & val_r ) const;
178
187 bool maybeOutdated() const;
188
195 //bool isUpdateRepo() const;
196
203 //bool providesUpdatesFor( const CpeId & cpeid_r ) const;
204
206 bool solvablesEmpty() const;
207
209 size_type solvablesSize() const;
210
213
214 public:
215
217 //class ProductInfoIterator;
218
226 //ProductInfoIterator compatibleWithProductBegin() const;
227
233 //ProductInfoIterator compatibleWithProductEnd() const;
234
236 //Iterable<ProductInfoIterator> compatibleWithProduct() const;
237
238
247 //ProductInfoIterator updatesProductBegin() const;
248
254 //ProductInfoIterator updatesProductEnd() const;
255
257 //Iterable<ProductInfoIterator> updatesProduct() const;
258
259 public:
261 //RepoInfo info() const;
262
268 //void setInfo( const RepoInfo & info_r );
269
271 //void clearInfo();
272
273 public:
275 void eraseFromPool();
276
278 struct EraseFromPool;
279
280 public:
282 Repository nextInPool() const;
283
284 public:
290
296 void addSolv( const zypp::Pathname & file_r );
297
305 void addHelix( const zypp::Pathname & file_r );
306
314 void addTesttags(const zypp::Pathname &file_r);
315
317 sat::Solvable::IdType addSolvables( unsigned count_r );
321
322
323 public:
325 detail::CRepo * get() const;
327 IdType id() const { return _id; }
336 int satInternalPriority() const;
337 int satInternalSubPriority() const;
339
340 private:
343
346
347 private:
349 };
350
351
352 //std::ostream & operator<<( std::ostream & str, const Repository & obj );
353
354 //std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj );
355
357 inline bool operator==( const Repository & lhs, const Repository & rhs )
358 { return lhs.get() == rhs.get(); }
359
361 inline bool operator!=( const Repository & lhs, const Repository & rhs )
362 { return !( lhs == rhs ); }
363
365 inline bool operator<( const Repository & lhs, const Repository & rhs )
366 { return lhs.get() < rhs.get(); }
367
369
388 /*
389 class Repository::ProductInfoIterator : public boost::iterator_adaptor<
390 Repository::ProductInfoIterator // Derived
391 , sat::LookupAttr::iterator // Base
392 , int // Value
393 , boost::forward_traversal_tag // CategoryOrTraversal
394 , int // Reference
395 >
396 {
397 public:
398 ProductInfoIterator()
399 {}
400
401 // Product label
402 std::string label() const;
403
404 // The Common Platform Enumeration name for this product.
405 CpeId cpeId() const;
406
407 private:
408 friend class Repository;
409 // Hide ctor as just a limited set of attributes is valid.
410 explicit ProductInfoIterator( sat::SolvAttr attr_r, Repository repo_r );
411
412 private:
413 friend class boost::iterator_core_access;
414 int dereference() const { return 0; }
415 };
416 */
418
420 /*
421 inline Iterable<Repository::ProductInfoIterator> Repository::compatibleWithProduct() const
422 { return makeIterable( compatibleWithProductBegin(), compatibleWithProductEnd() ); }
423 */
424
426 /*
427 inline Iterable<Repository::ProductInfoIterator> Repository::updatesProduct() const
428 { return makeIterable( updatesProductBegin(), updatesProductEnd() ); }
429 */
430
432 //
433 // CLASS NAME : Repository::EraseFromPool
434 //
462 {
463 void operator()( Repository repository_r ) const
464 { repository_r.eraseFromPool(); }
465 };
466
467
469 namespace detail
470 {
474
476 {
477 public:
478 using iterator_category = std::forward_iterator_tag;
480 using difference_type = std::ptrdiff_t;
481 using pointer = void;
483
485 : _base( nullptr )
486 {}
487
489 : _base( p )
490 {}
491
493 { return Repository( *_base ); }
494
496 { increment(); return *this; }
497
499 { RepositoryIterator tmp = *this; increment(); return tmp; }
500
501 bool operator==( const RepositoryIterator & rhs ) const
502 { return _base == rhs._base; }
503
504 bool operator!=( const RepositoryIterator & rhs ) const
505 { return !(*this == rhs); }
506
507 sat::detail::CRepo ** const & base() const
508 { return _base; }
509
510 private:
511 void increment();
512
514 };
515
518 //
519 // CLASS NAME : ByRepository
520 //
523 {
524 public:
525 ByRepository( const Repository & repository_r ) : _repository( repository_r ) {}
528
529 bool operator()( const sat::Solvable & slv_r ) const
530 { return slv_r.repository() == _repository.id(); }
531
532 private:
534 };
535
537 } // namespace detail
539
542
543 } // namespace sat
544} // namespace zyppng
546
547// Late include as sat::ArrayAttr requires Repository.h
548//#include <zypp/sat/LookupAttrTools.h>
549
550#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
A simple forward iterator that filters a base range according to a predicate.
Definition iterators.h:39
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:65
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:79
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:327
zypp::Date generatedTimestamp() const
Timestamp when this repository was generated.
Repository(const Repository &)=default
ContentRevision contentRevision() const
Label to display for this repo.
Definition repository.cc:94
std::string ContentRevision
Definition repository.h:60
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:540
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:319
size_type solvablesSize() const
Number of solvables in Repository.
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
zyppng::FilterIterator< detail::ByRepository, sat::detail::SolvableIterator > SolvableIterator
Definition repository.h:53
detail::CRepo * get() const
Expert backdoor.
Definition repository.cc:57
detail::RepoIdType IdType
Definition repository.h:56
std::string ContentIdentifier
Definition repository.h:61
Repository(Repository &&) noexcept=default
unsigned int size_type
Definition repository.h:55
zypp::Iterable< SolvableIterator > SolvableIterable
Definition repository.h:54
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:273
RepositoryIterator operator++(int)
Definition repository.h:498
sat::detail::CRepo **const & base() const
Definition repository.h:507
bool operator!=(const RepositoryIterator &rhs) const
Definition repository.h:504
std::forward_iterator_tag iterator_category
Definition repository.h:478
bool operator==(const RepositoryIterator &rhs) const
Definition repository.h:501
RepositoryIterator(sat::detail::CRepo **p)
Definition repository.h:488
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:462
void operator()(Repository repository_r) const
Definition repository.h:463
Functor filtering Solvable by Repository.
Definition repository.h:523
ByRepository(const Repository &repository_r)
Definition repository.h:525
ByRepository(sat::detail::RepoIdType id_r)
Definition repository.h:526
bool operator()(const sat::Solvable &slv_r) const
Definition repository.h:529