libzypp: zypp/repo/RepoInfoBase.h Source File

libzypp 17.38.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-core/base/PtrTypes.h>
18#include <zypp-core/Globals.h>
19#include <zypp-core/Pathname.h>
20
22namespace zypp
23{
25 namespace repo
26 {
27
29 //
30 // CLASS NAME : RepoInfoBase
31 //
39 class ZYPP_API RepoInfoBase
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
48 RepoInfoBase(const RepoInfoBase &) = default;
49 RepoInfoBase(RepoInfoBase &&) noexcept = default;
50 RepoInfoBase &operator=(const RepoInfoBase &) = default;
51 RepoInfoBase &operator=(RepoInfoBase &&) noexcept = 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:
168 RWCOW_pointer<Impl> _pimpl;
169 };
170
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
187 using RepoInfoBase_Ptr = shared_ptr<RepoInfoBase>;
189 using RepoInfoBase_constPtr = shared_ptr<const RepoInfoBase>;
190
191
193 } // namespace repo
196} // namespace zypp
198
199#endif /*REPOINFOBASE_H_*/
Globals.h
Provides API related macros.
operator<<
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
relates: zypp::sat::LookupAttr::iterator Stream output of the underlying iterator for debug.
Definition LookupAttr.cc:808
Pathname.h
PtrTypes.h
Impl
shared_ptr
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::repo::RepoInfoBase
Base class implementing common features of RepoInfo and ServiceInfo.
Definition RepoInfoBase.h:40
zypp::repo::RepoInfoBase::label
std::string label() const
Label for use in messages for the user interface.
Definition RepoInfoBase.cc:126
zypp::repo::RepoInfoBase::RepoInfoBase
RepoInfoBase(const RepoInfoBase &)=default
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:113
zypp::repo::RepoInfoBase::asUserString
std::string asUserString() const
User string: label (alias or name).
Definition RepoInfoBase.h:87
zypp::repo::RepoInfoBase::RepoInfoBase
RepoInfoBase()
Definition RepoInfoBase.cc:78
zypp::repo::RepoInfoBase::name
std::string name() const
Repository name.
Definition RepoInfoBase.cc:116
zypp::repo::RepoInfoBase::RepoInfoBase
RepoInfoBase(RepoInfoBase &&) noexcept=default
zypp::repo::RepoInfoBase::rawName
std::string rawName() const
The raw metadata name (no default, no variables replaced).
Definition RepoInfoBase.cc:123
zypp::repo::RepoInfoBase::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfoBase.h:168
zypp::repo::RepoInfoBase::alias
std::string alias() const
unique identifier for this source.
Definition RepoInfoBase.cc:110
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::repo
Definition DeltaCandidates.cc:30
zypp::repo::operator!=
bool operator!=(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
relates: RepoInfoBase
Definition RepoInfoBase.h:177
zypp::repo::operator<<
std::ostream & operator<<(std::ostream &str, const DeltaCandidates::Impl &obj)
relates: DeltaCandidates::Impl Stream output
Definition DeltaCandidates.cc:55
zypp::repo::operator==
bool operator==(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
relates: RepoInfoBase
Definition RepoInfoBase.h:173
zypp::repo::RepoInfoBase_constPtr
shared_ptr< const RepoInfoBase > RepoInfoBase_constPtr
relates: RepoInfoBase
Definition RepoInfoBase.h:189
zypp::repo::operator<
bool operator<(const RepoInfoBase &lhs, const RepoInfoBase &rhs)
Definition RepoInfoBase.h:180
zypp::repo::RepoInfoBase_Ptr
shared_ptr< RepoInfoBase > RepoInfoBase_Ptr
relates: RepoInfoBase
Definition RepoInfoBase.h:187
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::dumpAsXmlOn
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
relates: Repository XML output
Definition Repository.cc:411
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
relates: Capability Detailed stream output
Definition Capability.cc:589
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469