libzypp 17.32.2
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>
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
26namespace zypp
27{
28
29 namespace detail
30 {
31 struct ByRepository;
32 }
33
35 //
36 // CLASS NAME : Repository
37 //
40 {
41 public:
45
47
48 using ContentRevision = std::string;
49 using ContentIdentifier = std::string;
50
51 public:
54 : _id( sat::detail::noRepoId ) {}
55
56 Repository(const Repository &) = default;
58 Repository &operator=(const Repository &) = default;
60
64
65 public:
68
70 explicit operator bool() const
71 { return get() != nullptr; }
72
74 static const std::string & systemRepoAlias();
75
77 bool isSystemRepo() const;
78
79 public:
89 std::string alias() const;
90
92 std::string name() const;
93
95 std::string label() const;
96
98 std::string asUserString() const
99 { return label(); }
100
101 public:
106
119
121 bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
122
139 Date generatedTimestamp() const;
140
158
162 Keywords keywords() const;
163
165 bool hasKeyword( const std::string & val_r ) const;
166
175 bool maybeOutdated() const;
176
183 bool isUpdateRepo() const;
184
191 bool providesUpdatesFor( const CpeId & cpeid_r ) const;
192
194 bool solvablesEmpty() const;
195
197 size_type solvablesSize() const;
198
201
204
207
208 public:
209
211 class ProductInfoIterator;
212
220 ProductInfoIterator compatibleWithProductBegin() const;
221
227 ProductInfoIterator compatibleWithProductEnd() const;
228
231
232
241 ProductInfoIterator updatesProductBegin() const;
242
248 ProductInfoIterator updatesProductEnd() const;
249
252
253 public:
255 RepoInfo info() const;
256
262 void setInfo( const RepoInfo & info_r );
263
265 void clearInfo();
266
267 public:
269 void eraseFromPool();
270
272 struct EraseFromPool;
273
274 public:
276 Repository nextInPool() const;
277
278 public:
290 void addSolv( const Pathname & file_r );
291
299 void addHelix( const Pathname & file_r );
300
308 void addTesttags(const Pathname &file_r);
309
316
317 public:
319 sat::detail::CRepo * get() const;
321 IdType id() const { return _id; }
330 int satInternalPriority() const;
331 int satInternalSubPriority() const;
333 private:
335 };
337
339 std::ostream & operator<<( std::ostream & str, const Repository & obj );
340
342 std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj );
343
345 inline bool operator==( const Repository & lhs, const Repository & rhs )
346 { return lhs.get() == rhs.get(); }
347
349 inline bool operator!=( const Repository & lhs, const Repository & rhs )
350 { return lhs.get() != rhs.get(); }
351
353 inline bool operator<( const Repository & lhs, const Repository & rhs )
354 { return lhs.get() < rhs.get(); }
355
357
376 class Repository::ProductInfoIterator : public boost::iterator_adaptor<
377 Repository::ProductInfoIterator // Derived
378 , sat::LookupAttr::iterator // Base
379 , int // Value
380 , boost::forward_traversal_tag // CategoryOrTraversal
381 , int // Reference
382 >
383 {
384 public:
387
389 std::string label() const;
390
392 CpeId cpeId() const;
393
394 private:
395 friend class Repository;
398
399 private:
401 int dereference() const { return 0; }
402 };
404
408
412
414 //
415 // CLASS NAME : Repository::EraseFromPool
416 //
444 {
446 { repository_r.eraseFromPool(); }
447 };
449
451 namespace detail
452 {
454 //
455 // CLASS NAME : RepositoryIterator
456 //
458 class RepositoryIterator : public boost::iterator_adaptor<
459 RepositoryIterator // Derived
460 , sat::detail::CRepo ** // Base
461 , Repository // Value
462 , boost::forward_traversal_tag // CategoryOrTraversal
463 , Repository // Reference
464 >
465 {
466 public:
470
474
475 private:
477
479 { return Repository( *base() ); }
480
481 void increment();
482 };
485 //
486 // CLASS NAME : ByRepository
487 //
490 {
491 public:
495
496 bool operator()( const sat::Solvable & slv_r ) const
497 { return slv_r.repository() == _repository; }
498
499 private:
501 };
504 } // namespace detail
506
509
511} // namespace zypp
513
514// Late include as sat::ArrayAttr requires Repository.h
516
517#endif // ZYPP_SAT_REPOSITORY_H
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition CpeId.h:32
Store and operate on date (time_t).
Definition Date.h:33
What is known about a repository.
Definition RepoInfo.h:72
Query class for Repository related products.
Definition Repository.h:383
std::string label() const
Product label.
CpeId cpeId() const
The Common Platform Enumeration name for this product.
friend class boost::iterator_core_access
Definition Repository.h:400
Repository nextInPool() const
Return next Repository in Pool (or noRepository).
int satInternalSubPriority() const
Definition Repository.cc:80
static const Repository noRepository
Represents no Repository.
Definition Repository.h:67
void addHelix(const Pathname &file_r)
Load Solvables from a helix-file.
Repository()
Default ctor creates noRepository.
Definition Repository.h:53
bool hasKeyword(const std::string &val_r) const
Whether val_r is present in keywords.
Repository(Repository &&) noexcept=default
bool isUpdateRepo() const
Hint whether the Repo may provide updates for a product.
Keywords keywords() const
repository keywords (tags)
sat::detail::CRepo * get() const
Expert backdoor.
Definition Repository.cc:43
bool operator==(const Repository &lhs, const Repository &rhs)
Definition Repository.h:345
bool solvablesEmpty() const
Whether Repository contains solvables.
std::string label() const
Alias or name, according to ZConfig::repoLabelIsAlias.
Definition Repository.cc:71
Date suggestedExpirationTimestamp() const
Suggested expiration timestamp.
filter_iterator< detail::ByRepository, sat::detail::SolvableIterator > SolvableIterator
Definition Repository.h:42
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
ProductInfoIterator compatibleWithProductEnd() const
Get an iterator to the end of the repository compatible distros.
int satInternalPriority() const
libsolv internal priorities.
Definition Repository.cc:74
void clearInfo()
Remove any RepoInfo set for this repository.
sat::Solvable::IdType addSolvables(unsigned count_r)
Add count_r new empty Solvable to this Repository.
bool providesUpdatesFor(const CpeId &cpeid_r) const
Hint whether the Repo may provide updates for a product identified by its CpeId.
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
std::string ContentRevision
Definition Repository.h:48
void addTesttags(const Pathname &file_r)
Load Solvables from a libsolv testtags-file.
ProductInfoIterator updatesProductEnd() const
Get an iterator to the end of distos the repository provides upadates for.
ContentIdentifier contentIdentifier() const
Unique string identifying a repositories content.
Definition Repository.cc:93
bool maybeOutdated() const
The suggested expiration date of this repository already passed.
ProductInfoIterator compatibleWithProductBegin() const
Get an iterator to the beginning of the repository compatible distros.
std::string alias() const
Short unique string to identify a repo.
Definition Repository.cc:60
bool hasContentIdentifier(const ContentIdentifier &id_r) const
Whether id_r matches this repos content identifier.
size_type solvablesSize() const
Number of solvables in Repository.
Iterable< ProductInfoIterator > updatesProduct() const
Iterate distos the repository provides upadates for.
Definition Repository.h:410
IdType id() const
Expert backdoor.
Definition Repository.h:321
void setInfo(const RepoInfo &info_r)
Set RepoInfo for this repository.
sat::Solvable::IdType addSolvable()
Definition Repository.h:313
std::string name() const
Label to display for this repo.
Definition Repository.cc:68
bool operator<(const Repository &lhs, const Repository &rhs)
Definition Repository.h:353
bool operator!=(const Repository &lhs, const Repository &rhs)
Definition Repository.h:349
void addSolv(const Pathname &file_r)
Load Solvables from a solv-file.
Repository(const Repository &)=default
ContentRevision contentRevision() const
Timestamp or arbitrary user supplied string.
Definition Repository.cc:86
Iterable< ProductInfoIterator > compatibleWithProduct() const
Iterate the repository compatible distros.
Definition Repository.h:406
Iterable< SolvableIterator > solvables() const
Iterate the repositories Solvables.
Definition Repository.h:507
sat::ArrayAttr< std::string, std::string > Keywords
Definition Repository.h:46
Date generatedTimestamp() const
Timestamp when this repository was generated.
ProductInfoIterator updatesProductBegin() const
Get an iterator to the beginning of distos the repository provides upadates for.
std::string ContentIdentifier
Definition Repository.h:49
std::string asUserString() const
User string: label (alias or name)
Definition Repository.h:98
static const std::string & systemRepoAlias()
Reserved system repository alias @System .
Definition Repository.cc:38
RepoInfo info() const
Return any associated RepoInfo.
void eraseFromPool()
Remove this Repository from its Pool.
bool isSystemRepo() const
Return whether this is the system repository.
Definition Repository.cc:54
Repository dereference() const
Definition Repository.h:478
RepositoryIterator(sat::detail::CRepo **p)
Definition Repository.h:471
friend class boost::iterator_core_access
Definition Repository.h:476
LookupAttr::TransformIterator based container to retrieve list attributes.
Solvable attribute keys.
Definition SolvAttr.h:41
A Solvable object within the sat Pool.
Definition Solvable.h:54
String related utilities and Regular expression matching.
SolvableIdType size_type
Definition PoolMember.h:126
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
Definition PoolMember.h:133
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
Functor removing Repository from its Pool.
Definition Repository.h:444
void operator()(Repository repository_r) const
Definition Repository.h:445
Functor filtering Solvable by Repository.
Definition Repository.h:490
ByRepository(sat::detail::RepoIdType id_r)
Definition Repository.h:493
ByRepository(const Repository &repository_r)
Definition Repository.h:492
bool operator()(const sat::Solvable &slv_r) const
Definition Repository.h:496
Backlink to the associated PoolImpl.
Definition PoolMember.h:89