36 inline std::ostream &
operator<<( std::ostream & str,
const RepoInfoBase::Impl & obj )
38 return str <<
"RepoInfo::Impl";
41 void RepoInfoBase::Impl::setAlias(
const string & alias_)
47 std::string escaped_alias = alias_;
48 size_t pos = escaped_alias.find(fnd);
49 while (pos != string::npos)
51 escaped_alias.replace(pos, fnd.length(), rep);
52 pos = escaped_alias.find(fnd, pos+rep.length());
54 this->escaped_alias = escaped_alias;
68 RepoInfoBase::RepoInfoBase()
69 : _pimpl( new
Impl() )
78 : _pimpl( new Impl(alias) )
116 {
return indeterminate(
_pimpl->enabled) ?
true : (bool)
_pimpl->enabled; }
120 {
return indeterminate(
_pimpl->autorefresh) ?
false : (bool)
_pimpl->autorefresh; }
126 {
return _pimpl->escaped_alias; }
130 if (
_pimpl->name.empty() )
136 return replacer(
_pimpl->name);
147 {
return _pimpl->filepath; }
152 str <<
"--------------------------------------" << std::endl;
153 str <<
"- alias : " <<
alias() << std::endl;
154 str <<
"- name : " <<
name() << std::endl;
155 str <<
"- enabled : " <<
enabled() << std::endl;
156 str <<
"- autorefresh : " <<
autorefresh() << std::endl;
164 str <<
"[" <<
alias() <<
"]" << endl;
165 str <<
"name=" <<
name() << endl;
166 str <<
"enabled=" << (
enabled() ?
"1" :
"0") << endl;
167 str <<
"autorefresh=" << (
autorefresh() ?
"1" :
"0") << endl;
177 return str <<
"<!-- there's no XML representation of RepoInfoBase -->" << endl;
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
static ZConfig & instance()
Singleton ctor.
Pathname filepath() const
File where this repo was read from.
void setEnabled(bool enabled)
enable or disable the repository
void setAlias(const std::string &alias)
set the repository alias
void setFilepath(const Pathname &filename)
set the path to the .repo file
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)
std::ostream & operator<<(std::ostream &str, const ::_Dataiterator *obj)
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
Functor replacing repository variables.
Base class implementing common features of RepoInfo and ServiceInfo.
void setName(const std::string &name)
set the repository name
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.