libzypp  13.10.6
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 
19 #include "zypp/Pathname.h"
20 
22 namespace zypp
23 {
24  namespace repo
26  {
27 
29  //
30  // CLASS NAME : RepoInfoBase
31  //
37  {
38  friend std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
39 
40  public:
41  RepoInfoBase();
42  RepoInfoBase(const std::string & alias);
43  virtual ~RepoInfoBase();
44 
52  std::string alias() const;
53 
57  std::string escaped_alias() const;
58 
65  std::string name() const;
66 
72  std::string label() const;
73 
78  bool enabled() const;
79 
84  bool autorefresh() const;
85 
92  Pathname filepath() const;
93 
94 
95  public:
96 
101  void setAlias( const std::string &alias );
102 
107  void setName( const std::string &name );
108 
113  void setEnabled( bool enabled );
114 
119  void setAutorefresh( bool autorefresh );
120 
129  void setFilepath( const Pathname &filename );
130 
135  virtual std::ostream & dumpOn( std::ostream & str ) const;
136 
141  virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
142 
147  virtual std::ostream & dumpAsXMLOn(std::ostream & str) const;
148 
152  virtual std::ostream & dumpAsXMLOn(
153  std::ostream & str, const std::string & content) const;
154 
155  class Impl;
156  private:
159  };
161 
163  inline bool operator==( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
164  { return lhs.alias() == rhs.alias(); }
165 
167  inline bool operator!=( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
168  { return lhs.alias() != rhs.alias(); }
169 
170  inline bool operator<( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
171  { return lhs.alias() < rhs.alias(); }
172 
174  std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
175 
177  typedef shared_ptr<RepoInfoBase> RepoInfoBase_Ptr;
179  typedef shared_ptr<const RepoInfoBase> RepoInfoBase_constPtr;
180 
181 
183  } // namespace repo
186 } // namespace zypp
188 
189 #endif /*REPOINFOBASE_H_*/
std::string name() const
Repository short label.
std::string alias() const
unique identifier for this source.
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
void setAutorefresh(bool autorefresh)
enable or disable autorefresh
Definition: RepoInfoBase.cc:94
Pathname filepath() const
File where this repo was read from.
void setEnabled(bool enabled)
enable or disable the repository
Definition: RepoInfoBase.cc:89
bool operator==(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:163
void setAlias(const std::string &alias)
set the repository alias
Definition: RepoInfoBase.cc:99
void setFilepath(const Pathname &filename)
set the path to the .repo file
bool operator<(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:170
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfoBase object into str in a .repo (ini) file format.
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfoBase object into the str stream.
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
virtual std::ostream & dumpAsXMLOn(std::ostream &str) const
Write an XML representation of this object.
std::string label() const
Label for use in messages for the user interface.
std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
bool operator!=(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition: RepoInfoBase.h:167
friend std::ostream & operator<<(std::ostream &str, const RepoInfoBase &obj)
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
Base class implementing common features of RepoInfo and ServiceInfo.
Definition: RepoInfoBase.h:36
void setName(const std::string &name)
set the repository name
shared_ptr< const RepoInfoBase > RepoInfoBase_constPtr
Definition: RepoInfoBase.h:179
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfoBase.h:155
shared_ptr< RepoInfoBase > RepoInfoBase_Ptr
Definition: RepoInfoBase.h:177
RW_pointer supporting &#39;copy on write&#39; functionality.
Definition: PtrTypes.h:438