1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp2/RepoInfo.h
12 #ifndef ZYPP2_REPOSITORYINFO_H
13 #define ZYPP2_REPOSITORYINFO_H
18 #include "zypp/base/PtrTypes.h"
20 #include <boost/logic/tribool.hpp>
21 #include "zypp/Pathname.h"
23 #include "zypp/CheckSum.h"
24 #include "zypp/Date.h"
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 ///////////////////////////////////////////////////////////////////
32 // CLASS NAME : RepoInfo
35 * \short What is known about a repository
37 * The class RepoInfo represents everything that
38 * is known about a software repository.
40 * It can be used to store information about known
43 * This class tries to be compatible with the
44 * concept of a .repo file used by YUM and
45 * also available in the openSUSE build service.
51 * name=Ruby repository (openSUSE_10.2)
53 * baseurl=http://software.opensuse.org/download/ruby/openSUSE_10.2/
55 * gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
59 * \note A Repository info is a hint about how
60 * to create a repository.
64 friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
69 //RepoInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
72 * unique identifier for this source. If not specified
73 * It should be generated from the base url.
75 * Normally, in a .repo file the section name is used
78 std::string alias() const;
81 * The base Url is the Url of the repository that generates
82 * the authoritative metadata this repository provides.
84 * For example for the url http://updates.novell.com/10.2
85 * the base url is http://updates.novell.com/10.2.
86 * For the url http://host.com/mirror/update.novell.com/10.2
87 * the base url is http://updates.novell.com/10.2
89 * This can't be empty in order the repository to be valid
94 * Urls is a list of Urls where this repository
96 * If empty, the base url will be used.
98 std::set<Url> urls() const;
100 typedef std::set<Url>::const_iterator urls_const_iterator;
103 * iterator that points at begin of repository urls
105 urls_const_iterator urlsBegin() const;
108 * iterator that points at end of repository urls
110 urls_const_iterator urlsEnd() const;
113 * Path on the url where the repository root
116 Pathname path() const;
119 * If enabled is false, then this repository must be ignored as if does
120 * not exists, except when checking for duplicate alias.
122 boost::tribool enabled() const;
125 * If true, the repostory must be refreshed before creating resolvables
128 boost::tribool autorefresh() const;
131 * Type of repository,
132 * FIXME should be an enum?
134 std::string type() const;
137 * \short Repository short label
139 * Short label or description of the repository, to be used on
140 * the user interface.
141 * ie: "SUSE Linux 10.2 updates"
143 std::string name() const;
146 * Checksum of the repository.
147 * Usually the checksum of the index, but any
148 * checksum that changes when the repository changes
149 * in any way is sufficient.
151 CheckSum checksum() const;
154 * timestamp of the repository. If the repository
155 * changes, it has to be updated as well with the
158 Date timestamp() const;
161 * Set the base url. \see baseUrl
162 * \param url The base url for the repository.
164 RepoInfo & setBaseUrl( const Url &url );
167 * enable or disable the repository \see enabled
170 RepoInfo & setEnabled( boost::tribool enabled );
173 * enable or disable autorefresh \see autorefresh
176 RepoInfo & setAutorefresh( boost::tribool autorefresh );
179 * set the repository path \see path
182 RepoInfo & setPath( const Pathname &p );
185 * set the repository alias \see alias
188 RepoInfo & setAlias( const std::string &alias );
191 * set the repository type \see type
194 RepoInfo & setType( const std::string &t );
197 * set the repository name \see name
200 RepoInfo & setName( const std::string &name );
203 * set the repository checksum \see checksum
206 RepoInfo & setChecksum( const CheckSum &checksum );
209 * set the repository timestamp \see timestamp
212 RepoInfo & setTimestamp( const Date ×tamp );
214 std::ostream & dumpOn( std::ostream & str ) const;
218 /** Pointer to implementation */
219 RWCOW_pointer<Impl> _pimpl;
221 ///////////////////////////////////////////////////////////////////
223 /** \relates RepoInfo Stream output */
224 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
226 typedef std::list<RepoInfo> RepoInfoList;
228 /////////////////////////////////////////////////////////////////
230 ///////////////////////////////////////////////////////////////////
231 #endif // ZYPP2_REPOSITORYINFO_H