libzypp  13.10.6
RepoInfo.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP2_REPOSITORYINFO_H
13 #define ZYPP2_REPOSITORYINFO_H
14 
15 #include <list>
16 #include <set>
17 
18 #include "zypp/base/Iterator.h"
19 #include "zypp/APIConfig.h"
20 
21 #include "zypp/Url.h"
22 #include "zypp/Locale.h"
23 #include "zypp/repo/RepoType.h"
25 
26 #include "zypp/repo/RepoInfoBase.h"
27 
29 namespace zypp
30 {
31 
33  //
34  // CLASS NAME : RepoInfo
35  //
67  {
68  friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
69 
70  public:
71  RepoInfo();
72  virtual ~RepoInfo();
73 
75  static const RepoInfo noRepo;
76 
77  public:
81  static unsigned defaultPriority();
86  unsigned priority() const;
92  void setPriority( unsigned newval_r );
93 
94  typedef std::set<Url> url_set;
96  typedef transform_iterator<repo::RepoVariablesUrlReplacer, url_set::const_iterator> urls_const_iterator;
100  bool baseUrlsEmpty() const;
104  bool baseUrlSet() const;
120  Url url() const
121  { return( baseUrlsEmpty() ? Url() : *baseUrlsBegin()); }
131  std::set<Url> baseUrls() const;
139  void addBaseUrl( const Url &url );
143  void setBaseUrl( const Url &url );
144 
165  Pathname path() const;
170  void setPath( const Pathname &path );
171 
176  Url mirrorListUrl() const;
181  void setMirrorListUrl( const Url &url );
182 
187  repo::RepoType type() const;
194  void setProbedType( const repo::RepoType &t ) const;
199  void setType( const repo::RepoType &t );
200 
207  Pathname metadataPath() const;
216  void setMetadataPath( const Pathname &path );
217 
221  Pathname packagesPath() const;
227  void setPackagesPath( const Pathname &path );
228 
236  bool gpgCheck() const;
246  void setGpgCheck( bool check );
247 
257  Url gpgKeyUrl() const;
267  void setGpgKeyUrl( const Url &gpgkey );
268 
272  bool keepPackages() const;
282  void setKeepPackages( bool keep );
283 
288  std::string service() const;
292  void setService( const std::string& name );
293 
297  std::string targetDistribution() const;
303  void setTargetDistribution(const std::string & targetDistribution);
304 
305  public:
310  bool hasLicense() const;
311 
315  bool needToAcceptLicense() const;
316 
318  std::string getLicense( const Locale & lang_r = Locale() );
319 
326 
332 
333 
334  public:
339  virtual std::ostream & dumpOn( std::ostream & str ) const;
340 
344  virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
345 
349  virtual std::ostream & dumpAsXMLOn(std::ostream & str) const;
350 
358  virtual std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content ) const;
359 
360  class Impl;
361  private:
364  };
366 
368  typedef shared_ptr<RepoInfo> RepoInfo_Ptr;
370  typedef shared_ptr<const RepoInfo> RepoInfo_constPtr;
372  typedef std::list<RepoInfo> RepoInfoList;
373 
375  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
376 
377 
379 } // namespace zypp
381 #endif // ZYPP2_REPOSITORYINFO_H
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition: RepoInfo.cc:356
std::string name() const
Repository short label.
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition: RepoInfo.cc:249
void setGpgKeyUrl(const Url &gpgkey)
Key to use for gpg checking of this repository.
Definition: RepoInfo.cc:173
static unsigned defaultPriority()
The default priority (99).
Definition: RepoInfo.cc:161
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfo object into str in a .repo file format.
Definition: RepoInfo.cc:426
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition: RepoInfo.cc:164
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:360
shared_ptr< RepoInfo > RepoInfo_Ptr
Definition: RepoInfo.h:368
void setMirrorListUrl(const Url &url)
Set mirror list url.
Definition: RepoInfo.cc:170
virtual std::ostream & dumpAsXMLOn(std::ostream &str) const
Write an XML representation of this RepoInfo object.
Definition: RepoInfo.cc:466
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:252
std::string getLicense(const Locale &lang_r=Locale())
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:314
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:216
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
Definition: RepoInfo.cc:191
What is known about a repository.
Definition: RepoInfo.h:66
void setBaseUrl(const Url &url)
Clears current base URL list and adds url.
Definition: RepoInfo.cc:179
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition: RepoInfo.cc:259
shared_ptr< const RepoInfo > RepoInfo_constPtr
Definition: RepoInfo.h:370
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:219
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:158
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition: RepoInfo.h:96
RepoInfo implementation.
Definition: RepoInfo.cc:37
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:213
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:286
virtual ~RepoInfo()
Definition: RepoInfo.cc:153
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
Url mirrorListUrl() const
Url of a file which contains a list of Urls If empty, the base url will be used.
Definition: RepoInfo.cc:225
Provides API related macros.
void setPath(const Pathname &path)
set the product path.
Definition: RepoInfo.cc:185
void setService(const std::string &name)
sets service which added this repository
Definition: RepoInfo.cc:204
void setMetadataPath(const Pathname &path)
set the path where the local metadata is stored
Definition: RepoInfo.cc:195
bool gpgCheck() const
Whether to check or not this repository with gpg.
Definition: RepoInfo.cc:210
void setType(const repo::RepoType &t)
set the repository type
Definition: RepoInfo.cc:188
bool baseUrlSet() const
whether there are manualy configured repository urls
Definition: RepoInfo.cc:272
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:201
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
Definition: RepoInfo.cc:246
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
void addBaseUrl(const Url &url)
Add a base url.
Definition: RepoInfo.cc:176
SolvableIdType size_type
Definition: PoolMember.h:99
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition: RepoInfo.cc:198
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:269
repo::RepoType type() const
Type of repository,.
Definition: RepoInfo.cc:222
url_set::size_type urls_size_type
Definition: RepoInfo.h:95
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition: RepoInfo.cc:207
std::set< Url > baseUrls() const
A Url under which the metadata are located, or a set of mirrors.
Definition: RepoInfo.cc:231
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:277
Url gpgKeyUrl() const
Key to use for gpg checking of this repository.
Definition: RepoInfo.cc:228
Url url() const
Pars pro toto: The first repository url.
Definition: RepoInfo.h:120
void setGpgCheck(bool check)
Whether to check or not this repository with gpg.
Definition: RepoInfo.cc:167
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:75
std::list< RepoInfo > RepoInfoList
Definition: RepoInfo.h:372
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
Base class implementing common features of RepoInfo and ServiceInfo.
Definition: RepoInfoBase.h:36
urls_size_type baseUrlsSize() const
number of repository urls
Definition: RepoInfo.cc:266
Url manipulation class.
Definition: Url.h:87
Pathname path() const
Repository path.
Definition: RepoInfo.cc:243
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfo object into the str stream.
Definition: RepoInfo.cc:389
RW_pointer supporting &#39;copy on write&#39; functionality.
Definition: PtrTypes.h:438
Repository type enumeration.
Definition: RepoType.h:27
friend std::ostream & operator<<(std::ostream &str, const RepoInfo &obj)
Definition: RepoInfo.cc:501
std::set< Url > url_set
Definition: RepoInfo.h:94