1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/RepoInfo.cc
13 #include "zypp/base/Logger.h"
15 #include "zypp2/RepoInfo.h"
18 using namespace boost;
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 // CLASS NAME : RepoInfo::Impl
28 /** RepoInfo implementation. */
33 : enabled (indeterminate),
34 autorefresh(indeterminate)
37 boost::tribool enabled;
38 boost::tribool autorefresh;
49 /** Offer default Impl. */
50 static shared_ptr<Impl> nullimpl()
52 static shared_ptr<Impl> _nullimpl( new Impl );
57 friend Impl * rwcowClone<Impl>( const Impl * rhs );
58 /** clone for RWCOW_pointer */
60 { return new Impl( *this ); }
62 ///////////////////////////////////////////////////////////////////
64 /** \relates RepoInfo::Impl Stream output */
65 inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
67 return str << "RepoInfo::Impl";
70 ///////////////////////////////////////////////////////////////////
72 // CLASS NAME : RepoInfo
74 ///////////////////////////////////////////////////////////////////
76 ///////////////////////////////////////////////////////////////////
78 // METHOD NAME : RepoInfo::RepoInfo
82 : _pimpl( Impl::nullimpl() )
85 ///////////////////////////////////////////////////////////////////
87 // METHOD NAME : RepoInfo::~RepoInfo
95 RepoInfo & RepoInfo::setEnabled( boost::tribool enabled )
97 _pimpl->enabled = enabled;
101 RepoInfo & RepoInfo::setAutorefresh( boost::tribool autorefresh )
103 _pimpl->autorefresh = autorefresh;
107 RepoInfo & RepoInfo::setBaseUrl( const Url &url )
109 _pimpl->baseurl = url;
113 RepoInfo & RepoInfo::setPath( const Pathname &p )
119 RepoInfo & RepoInfo::setAlias( const std::string &alias )
121 _pimpl->alias = alias;
125 RepoInfo & RepoInfo::setType( const std::string &t )
131 RepoInfo & RepoInfo::setName( const std::string &name )
137 RepoInfo & RepoInfo::setChecksum( const CheckSum &checksum )
139 _pimpl->checksum = checksum;
143 RepoInfo & RepoInfo::setTimestamp( const Date ×tamp )
145 _pimpl->timestamp = timestamp;
149 tribool RepoInfo::enabled() const
150 { return _pimpl->enabled; }
152 tribool RepoInfo::autorefresh() const
153 { return _pimpl->autorefresh; }
156 Pathname RepoInfo::path() const
157 { return _pimpl->path; }
159 std::string RepoInfo::alias() const
160 { return _pimpl->alias; }
162 std::string RepoInfo::name() const
163 { return _pimpl->name; }
165 CheckSum RepoInfo::checksum() const
166 { return _pimpl->checksum; }
168 Date RepoInfo::timestamp() const
169 { return _pimpl->timestamp; }
171 std::string RepoInfo::type() const
172 { return _pimpl->type; }
174 Url RepoInfo::baseUrl() const
175 { return _pimpl->baseurl; }
177 std::set<Url> RepoInfo::urls() const
178 { return _pimpl->urls; }
180 RepoInfo::urls_const_iterator RepoInfo::urlsBegin() const
181 { return _pimpl->urls.begin(); }
183 RepoInfo::urls_const_iterator RepoInfo::urlsEnd() const
184 { return _pimpl->urls.end(); }
186 std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
188 str << "--------------------------------------" << std::endl;
189 str << "- alias : " << alias() << std::endl;
190 str << "- url : " << baseUrl() << std::endl;
191 str << "- type : " << type() << std::endl;
192 str << "- enabled : " << enabled() << std::endl;
193 str << "- autorefresh : " << autorefresh() << std::endl;
194 str << "- path : " << path() << std::endl;
198 /////////////////////////////////////////////////////////////////
200 ///////////////////////////////////////////////////////////////////