15#include <zypp/base/String.h>
16#include <zypp-core/base/DefaultIntegral>
17#include <zypp/parser/xml/XmlEscape.h>
69 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
73 {
return new Impl( *
this ); }
89 : repo::RepoInfoBase(alias), _pimpl( new
Impl() )
93 : repo::RepoInfoBase(alias), _pimpl( new
Impl(url) )
100 {
return _pimpl->_url.transformed(); }
103 {
return _pimpl->_url.raw(); }
125 {
return(
_pimpl->_reposToEnable.find( alias_r ) !=
_pimpl->_reposToEnable.end() ); }
129 _pimpl->_reposToEnable.insert( alias_r );
130 _pimpl->_reposToDisable.erase( alias_r );
134 {
_pimpl->_reposToEnable.erase( alias_r ); }
137 {
_pimpl->_reposToEnable.clear(); }
146 {
return(
_pimpl->_reposToDisable.find( alias_r ) !=
_pimpl->_reposToDisable.end() ); }
150 _pimpl->_reposToDisable.insert( alias_r );
151 _pimpl->_reposToEnable.erase( alias_r );
155 {
_pimpl->_reposToDisable.erase( alias_r ); }
158 {
_pimpl->_reposToDisable.clear(); }
168 <<
"enabled=" << obj.
enabled <<
" "
175 RepoInfoBase::dumpAsIniOn(
str)
177 <<
"type = " <<
type() << endl;
180 str <<
"ttl_sec = " <<
ttl() << endl;
190 std::string tag(
"repo_" );
194 str << tag <<
"=" << el.first << endl
195 << tag <<
"_enabled=" << state.
enabled << endl
196 << tag <<
"_autorefresh=" << state.
autorefresh << endl;
199 << tag <<
"_priority=" << state.
priority << endl;
214 <<
" alias=\"" << escape(
alias()) <<
"\""
215 <<
" name=\"" << escape(
name()) <<
"\""
216 <<
" enabled=\"" <<
enabled() <<
"\""
218 <<
" url=\"" << escape(
url().asString()) <<
"\""
220 <<
" ttl_sec=\"" <<
ttl() <<
"\"";
225 str <<
">" << endl << content <<
"</service>" << endl;
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
Helper managing repo variables replaced urls.
Store and operate on date (time_t).
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
Integral type with defined initial value when default constructed.
static unsigned defaultPriority()
The default priority (99).
void setProbedTtl(Date::Duration ttl_r) const
Lazy init sugested TTL.
ReposToEnable::size_type reposToEnableSize() const
repo::ServiceType type() const
Service type.
ReposToEnable::const_iterator reposToEnableBegin() const
Date::Duration ttl() const
Sugested TTL between two metadata auto-refreshs.
void setLrf(Date lrf_r)
Set date of last refresh.
void setType(const repo::ServiceType &type)
Set service type.
Date lrf() const
Date of last refresh (if known).
bool repoToDisableFind(const std::string &alias_r) const
Whether alias_r is mentioned in ReposToDisable.
bool repoToEnableFind(const std::string &alias_r) const
Whether alias_r is mentioned in ReposToEnable.
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this ServiceInfo object.
const RepoStates & repoStates() const
Access the remembered repository states.
ReposToDisable::const_iterator reposToDisableEnd() const
ServiceInfo()
Default ctor creates noService.
ReposToEnable::const_iterator reposToEnableEnd() const
void addRepoToDisable(const std::string &alias_r)
Add alias_r to the set of ReposToDisable.
void clearReposToEnable()
Clear the set of ReposToEnable.
std::set< std::string > ReposToDisable
Container of repos.
void delRepoToDisable(const std::string &alias_r)
Remove alias_r from the set of ReposToDisable.
bool reposToEnableEmpty() const
Url url() const
The service url.
RWCOW_pointer< Impl > _pimpl
std::set< std::string > ReposToEnable
Container of repos.
void setProbedType(const repo::ServiceType &t) const
Lazy init service type.
void setTtl(Date::Duration ttl_r)
Set sugested TTL.
std::map< std::string, RepoState > RepoStates
Url rawUrl() const
The service raw url (no variables replaced)
void addRepoToEnable(const std::string &alias_r)
Add alias_r to the set of ReposToEnable.
void clearReposToDisable()
Clear the set of ReposToDisable.
void setUrl(const Url &url)
Set the service url (raw value)
ReposToDisable::const_iterator reposToDisableBegin() const
void delRepoToEnable(const std::string &alias_r)
Remove alias_r from the set of ReposToEnable.
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Writes ServiceInfo to stream in ".service" format.
ReposToDisable::size_type reposToDisableSize() const
void setRepoStates(RepoStates newStates_r)
Remember a new set of repository states.
static const ServiceInfo noService
Represents an empty service.
bool reposToDisableEmpty() const
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
std::string name() const
Repository name.
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
std::string alias() const
unique identifier for this source.
String related utilities and Regular expression matching.
std::string asString(const Url &url_r)
std::string joinEscaped(TIterator begin, TIterator end, const char sep_r=' ')
Join strings using separator sep_r, quoting or escaping the values.
std::string numstring(char n, int w=0)
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
ReposToDisable _reposToDisable
DefaultIntegral< Date::Duration, 0 > _ttl
RepoVariablesReplacedUrl _url
void setProbedType(const repo::ServiceType &type_r) const
Impl * clone() const
clone for RWCOW_pointer
ServiceInfo::ReposToEnable ReposToEnable
ReposToEnable _reposToEnable
ServiceInfo::ReposToDisable ReposToDisable
Service type enumeration.
static const ServiceType NONE
No service set.
const std::string & asString() const