1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ServiceInfo.cc
15 #include "zypp/parser/xml/XmlEscape.h"
17 #include "zypp/RepoInfo.h"
18 #include "zypp/parser/RepoindexFileReader.h"
19 #include "zypp/repo/RepoInfoBaseImpl.h"
21 #include "zypp/ServiceInfo.h"
24 using zypp::xml::escape;
26 ///////////////////////////////////////////////////////////////////////////////
28 {//////////////////////////////////////////////////////////////////////////////
31 struct RepoInfoCollector
33 vector<RepoInfo> repos;
34 bool collect(const RepoInfo & info)
36 repos.push_back(info);
41 ///////////////////////////////////////////////////////////////////
43 // CLASS NAME : ServiceInfo::Impl
45 struct ServiceInfo::Impl : public repo::RepoInfoBase::Impl
51 Impl() : repo::RepoInfoBase::Impl() {}
53 Impl(const Url & url_) : url(url_) {}
56 friend Impl * rwcowClone<Impl>( const Impl * rhs );
58 /** clone for RWCOW_pointer */
60 { return new Impl( *this ); }
62 ///////////////////////////////////////////////////////////////////
65 ///////////////////////////////////////////////////////////////////
67 // CLASS NAME : ServiceInfo::Impl
69 ///////////////////////////////////////////////////////////////////
71 const ServiceInfo ServiceInfo::noService;
73 ServiceInfo::ServiceInfo() : _pimpl( new Impl() ) {}
75 ServiceInfo::ServiceInfo(const string & alias)
76 : repo::RepoInfoBase(alias), _pimpl( new Impl() )
79 ServiceInfo::ServiceInfo(const string & alias, const Url & url)
80 : repo::RepoInfoBase(alias), _pimpl( new Impl(url) )
83 Url ServiceInfo::url() const { return _pimpl->url; }
84 void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; }
87 std::ostream & ServiceInfo::dumpAsIniOn( std::ostream & str ) const
89 return RepoInfoBase::dumpAsIniOn(str) << "url = " << url() << endl;
92 std::ostream & ServiceInfo::dumpAsXMLOn( std::ostream & str) const
96 << " alias=\"" << escape(alias()) << "\""
97 << " name=\"" << escape(name()) << "\""
98 << " enabled=\"" << enabled() << "\""
99 << " autorefresh=\"" << autorefresh() << "\""
100 << " url=\"" << escape(url().asString()) << "\""
104 std::ostream & operator<<( std::ostream& str, const ServiceInfo &obj )
106 return obj.dumpAsIniOn(str);
110 ///////////////////////////////////////////////////////////////////////////////
112 ///////////////////////////////////////////////////////////////////////////////