1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/RepoInfo.cc
13 #include "zypp/base/Logger.h"
15 #include "zypp/RepoInfo.h"
18 using namespace boost;
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 // CLASS NAME : RepoInfo::Impl
28 /** RepoInfo implementation. */
33 : enabled (indeterminate),
34 autorefresh(indeterminate),
35 type(repo::RepoType::NONE_e)
43 boost::tribool enabled;
44 boost::tribool autorefresh;
47 std::set<Url> baseUrls;
54 friend Impl * rwcowClone<Impl>( const Impl * rhs );
55 /** clone for RWCOW_pointer */
57 { return new Impl( *this ); }
59 ///////////////////////////////////////////////////////////////////
61 /** \relates RepoInfo::Impl Stream output */
62 inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
64 return str << "RepoInfo::Impl";
67 ///////////////////////////////////////////////////////////////////
69 // CLASS NAME : RepoInfo
71 ///////////////////////////////////////////////////////////////////
73 ///////////////////////////////////////////////////////////////////
75 // METHOD NAME : RepoInfo::RepoInfo
79 : _pimpl( new Impl() )
82 ///////////////////////////////////////////////////////////////////
84 // METHOD NAME : RepoInfo::~RepoInfo
94 RepoInfo & RepoInfo::setEnabled( boost::tribool enabled )
96 _pimpl->enabled = enabled;
100 RepoInfo & RepoInfo::setAutorefresh( boost::tribool autorefresh )
102 _pimpl->autorefresh = autorefresh;
106 RepoInfo & RepoInfo::setMirrorListUrl( const Url &url )
108 _pimpl->mirrorlist_url = url;
112 RepoInfo & RepoInfo::addBaseUrl( const Url &url )
114 _pimpl->baseUrls.insert(url);
118 RepoInfo & RepoInfo::setAlias( const std::string &alias )
120 _pimpl->alias = alias;
124 RepoInfo & RepoInfo::setType( const repo::RepoType &t )
130 RepoInfo & RepoInfo::setName( const std::string &name )
136 tribool RepoInfo::enabled() const
137 { return _pimpl->enabled; }
139 tribool RepoInfo::autorefresh() const
140 { return _pimpl->autorefresh; }
142 std::string RepoInfo::alias() const
143 { return _pimpl->alias; }
145 std::string RepoInfo::name() const
146 { return _pimpl->name; }
148 repo::RepoType RepoInfo::type() const
149 { return _pimpl->type; }
151 Url RepoInfo::mirrorListUrl() const
152 { return _pimpl->mirrorlist_url; }
154 std::set<Url> RepoInfo::baseUrls() const
155 { return _pimpl->baseUrls; }
157 RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
158 { return _pimpl->baseUrls.begin(); }
160 RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const
161 { return _pimpl->baseUrls.end(); }
163 std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
165 str << "--------------------------------------" << std::endl;
166 str << "- alias : " << alias() << std::endl;
167 std::set<Url> url_set(baseUrls());
168 for ( std::set<Url>::const_iterator it = url_set.begin();
172 str << "- url : " << *it << std::endl;
175 str << "- type : " << type() << std::endl;
176 str << "- enabled : " << enabled() << std::endl;
177 str << "- autorefresh : " << autorefresh() << std::endl;
178 //str << "- path : " << path() << std::endl;
182 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
184 return obj.dumpOn(str);
187 /////////////////////////////////////////////////////////////////
189 ///////////////////////////////////////////////////////////////////