libzypp 17.32.5
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
22namespace zypp
23{
25 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:
45 RepoInfoBase(const std::string &alias);
46 virtual ~RepoInfoBase();
47
48 RepoInfoBase(const RepoInfoBase &) = default;
50 RepoInfoBase &operator=(const RepoInfoBase &) = default;
52
60 std::string alias() const;
61
65 std::string escaped_alias() const;
66
74 std::string name() const;
75
77 std::string rawName() const;
78
84 std::string label() const;
85
87 std::string asUserString() const
88 { return label(); }
89
94 bool enabled() const;
95
100 bool autorefresh() const;
101
108 Pathname filepath() const;
109
110
111 public:
112
117 void setAlias( const std::string &alias );
118
123 void setName( const std::string &name );
124
129 void setEnabled( bool enabled );
130
135 void setAutorefresh( bool autorefresh );
136
145 void setFilepath( const Pathname &filename );
146
151 virtual std::ostream & dumpOn( std::ostream & str ) const;
152
157 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
158
163 virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const;
164
165 struct Impl;
166 private:
169 };
171
173 inline bool operator==( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
174 { return lhs.alias() == rhs.alias(); }
175
177 inline bool operator!=( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
178 { return lhs.alias() != rhs.alias(); }
179
180 inline bool operator<( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
181 { return lhs.alias() < rhs.alias(); }
182
184 std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
185
190
191
193 } // namespace repo
196} // namespace zypp
198
199#endif /*REPOINFOBASE_H_*/
RepoManager implementation.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
Base class implementing common features of RepoInfo and ServiceInfo.
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfoBase object into the str stream.
std::string label() const
Label for use in messages for the user interface.
bool operator!=(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
RepoInfoBase(const RepoInfoBase &)=default
void setAutorefresh(bool autorefresh)
enable or disable autorefresh
std::string escaped_alias() const
Same as alias(), just escaped in a way to be a valid file name.
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfoBase object into str in a .repo (ini) file format.
void setFilepath(const Pathname &filename)
set the path to the .repo file
bool operator==(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
std::string asUserString() const
User string: label (alias or name)
void setAlias(const std::string &alias)
set the repository alias
Pathname filepath() const
File where this repo was read from.
friend std::ostream & operator<<(std::ostream &str, const RepoInfoBase &obj)
void setName(const std::string &name)
set the repository name
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
std::string name() const
Repository name.
RepoInfoBase(RepoInfoBase &&) noexcept=default
std::string rawName() const
The raw metadata name (no default, no variables replaced).
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this object with content (if available).
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
void setEnabled(bool enabled)
enable or disable the repository
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
std::string alias() const
unique identifier for this source.
Definition Arch.h:364
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
bool operator<(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Easy-to use interface to the ZYPP dependency resolver.