libzypp  17.28.0
RepoInfoBase.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef REPOINFOBASE_H_
13 #define REPOINFOBASE_H_
14 
15 #include <iosfwd>
16 
17 #include <zypp/base/PtrTypes.h>
18 #include <zypp/APIConfig.h>
19 #include <zypp/Pathname.h>
20 
22 namespace zypp
23 {
24  namespace repo
26  {
27 
29  //
30  // CLASS NAME : RepoInfoBase
31  //
40  {
41  friend std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
42 
43  public:
44  RepoInfoBase();
45  RepoInfoBase(const std::string & alias);
46  virtual ~RepoInfoBase();
47 
55  std::string alias() const;
56 
60  std::string escaped_alias() const;
61 
69  std::string name() const;
70 
72  std::string rawName() const;
73 
79  std::string label() const;
80 
82  std::string asUserString() const
83  { return label(); }
84 
89  bool enabled() const;
90 
95  bool autorefresh() const;
96 
103  Pathname filepath() const;
104 
105 
106  public:
107 
112  void setAlias( const std::string &alias );
113 
118  void setName( const std::string &name );
119 
124  void setEnabled( bool enabled );
125 
130  void setAutorefresh( bool autorefresh );
131 
140  void setFilepath( const Pathname &filename );
141 
146  virtual std::ostream & dumpOn( std::ostream & str ) const;
147 
152  virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
153 
158  virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const;
159 
160  struct Impl;
161  private:
164  };
166 
168  inline bool operator==( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
169  { return lhs.alias() == rhs.alias(); }
170 
172  inline bool operator!=( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
173  { return lhs.alias() != rhs.alias(); }
174 
175  inline bool operator<( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
176  { return lhs.alias() < rhs.alias(); }
177 
179  std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
180 
182  typedef shared_ptr<RepoInfoBase> RepoInfoBase_Ptr;
184  typedef shared_ptr<const RepoInfoBase> RepoInfoBase_constPtr;
185 
186 
188  } // namespace repo
191 } // namespace zypp
193 
194 #endif /*REPOINFOBASE_H_*/
zypp::repo::RepoInfoBase::dumpAsIniOn
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfoBase object into str in a .repo (ini) file format.
Definition: RepoInfoBase.cc:150
zypp::repo::RepoInfoBase::rawName
std::string rawName() const
The raw metadata name (no default, no variables replaced).
Definition: RepoInfoBase.cc:124
zypp::repo::RepoInfoBase::operator!=
bool operator!=(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:172
zypp::repo::RepoInfoBase::setAutorefresh
void setAutorefresh(bool autorefresh)
enable or disable autorefresh
Definition: RepoInfoBase.cc:91
zypp::repo::RepoInfoBase::setName
void setName(const std::string &name)
set the repository name
Definition: RepoInfoBase.cc:97
zypp::repo::RepoInfoBase::enabled
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
Definition: RepoInfoBase.cc:104
zypp::repo::RepoInfoBase::asUserString
std::string asUserString() const
User string: label (alias or name)
Definition: RepoInfoBase.h:82
zypp::repo::RepoInfoBase::setFilepath
void setFilepath(const Pathname &filename)
set the path to the .repo file
Definition: RepoInfoBase.cc:100
zypp::repo::RepoInfoBase::dumpAsXmlOn
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this object with content (if available).
Definition: RepoInfoBase.cc:162
zypp::repo::RepoInfoBase::operator==
bool operator==(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:168
zypp::repo::operator<
bool operator<(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:175
zypp::repo::RepoInfoBase::escaped_alias
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
Definition: RepoInfoBase.cc:114
zypp::repo::operator<<
std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
Definition: DeltaCandidates.cc:107
zypp::repo::RepoInfoBase::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfoBase.h:160
zypp::repo::RepoInfoBase::operator<<
friend std::ostream & operator<<(std::ostream &str, const RepoInfoBase &obj)
Definition: RepoInfoBase.cc:167
zypp::repo::RepoInfoBase::alias
std::string alias() const
unique identifier for this source.
Definition: RepoInfoBase.cc:111
zypp::repo::RepoInfoBase::name
std::string name() const
Repository name.
Definition: RepoInfoBase.cc:117
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
zypp::repo::RepoInfoBase::label
std::string label() const
Label for use in messages for the user interface.
Definition: RepoInfoBase.cc:127
zypp::repo::RepoInfoBase::RepoInfoBase_constPtr
shared_ptr< const RepoInfoBase > RepoInfoBase_constPtr
Definition: RepoInfoBase.h:184
zypp::repo::RepoInfoBase::setEnabled
void setEnabled(bool enabled)
enable or disable the repository
Definition: RepoInfoBase.cc:88
zypp::repo::RepoInfoBase::filepath
Pathname filepath() const
File where this repo was read from.
Definition: RepoInfoBase.cc:134
Impl
zypp::repo::RepoInfoBase
Base class implementing common features of RepoInfo and ServiceInfo.
Definition: RepoInfoBase.h:40
zypp::repo::RepoInfoBase::RepoInfoBase
RepoInfoBase()
Definition: RepoInfoBase.cc:77
zypp::repo::RepoInfoBase::autorefresh
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
Definition: RepoInfoBase.cc:108
zypp::repo::RepoInfoBase::RepoInfoBase_Ptr
shared_ptr< RepoInfoBase > RepoInfoBase_Ptr
Definition: RepoInfoBase.h:182
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:45
zypp::RWCOW_pointer< Impl >
str
String related utilities and Regular expression matching.
zypp::repo::RepoInfoBase::setAlias
void setAlias(const std::string &alias)
set the repository alias
Definition: RepoInfoBase.cc:94
zypp::repo::RepoInfoBase::~RepoInfoBase
virtual ~RepoInfoBase()
Definition: RepoInfoBase.cc:85
zypp::repo::RepoInfoBase::dumpOn
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfoBase object into the str stream.
Definition: RepoInfoBase.cc:138