libzypp  14.29.1
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  //
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 
75  std::string asUserString() const
76  { return label(); }
77 
82  bool enabled() const;
83 
88  bool autorefresh() const;
89 
96  Pathname filepath() const;
97 
98 
99  public:
100 
105  void setAlias( const std::string &alias );
106 
111  void setName( const std::string &name );
112 
117  void setEnabled( bool enabled );
118 
123  void setAutorefresh( bool autorefresh );
124 
133  void setFilepath( const Pathname &filename );
134 
139  virtual std::ostream & dumpOn( std::ostream & str ) const;
140 
145  virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
146 
150  virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const;
151 
153  ZYPP_DEPRECATED std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content = "" ) const { return dumpAsXmlOn( str, content ); }
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:91
Pathname filepath() const
File where this repo was read from.
void setEnabled(bool enabled)
enable or disable the repository
Definition: RepoInfoBase.cc:88
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:94
String related utilities and Regular expression matching.
ZYPP_DEPRECATED std::ostream & dumpAsXMLOn(std::ostream &str, const std::string &content="") const
Definition: RepoInfoBase.h:153
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...
std::string label() const
Label for use in messages for the user interface.
Provides API related macros.
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
Definition: RepoInfoBase.cc:97
shared_ptr< const RepoInfoBase > RepoInfoBase_constPtr
Definition: RepoInfoBase.h:179
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfoBase.h:155
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3...
Definition: APIConfig.h:86
std::string asUserString() const
User string: label (alias or name)
Definition: RepoInfoBase.h:75
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
shared_ptr< RepoInfoBase > RepoInfoBase_Ptr
Definition: RepoInfoBase.h:177
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this object with content (if available).