1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/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/repo/RepoType.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.
46 * See <tt>man yum.conf</tt>.
52 * name=Ruby repository (openSUSE_10.2)
54 * baseurl=http://software.opensuse.org/download/ruby/openSUSE_10.2/
56 * gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
60 * \note A RepoInfo is a hint about how
61 * to create a Repository.
65 friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
70 //RepoInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
73 * unique identifier for this source. If not specified
74 * It should be generated from the base url.
76 * Normally, in a .repo file the section name is used
79 std::string alias() const;
82 * A Url under which the metadata are located, or a set of mirrors.
84 * This can't be empty in order the repository to be valid
85 * unless the download of the mirror list succeeds and it
86 * contains a valid url.
88 std::set<Url> baseUrls() const;
91 * Url of a file which contains a list of Urls
92 * If empty, the base url will be used.
94 Url mirrorListUrl() const;
96 typedef std::set<Url>::const_iterator urls_const_iterator;
99 * iterator that points at begin of repository urls
101 urls_const_iterator baseUrlsBegin() const;
104 * iterator that points at end of repository urls
106 urls_const_iterator baseUrlsEnd() const;
109 * If enabled is false, then this repository must be ignored as if does
110 * not exists, except when checking for duplicate alias.
112 boost::tribool enabled() const;
115 * If true, the repostory must be refreshed before creating resolvables
118 boost::tribool autorefresh() const;
121 * Type of repository,
124 repo::RepoType type() const;
127 * \short Repository short label
129 * Short label or description of the repository, to be used on
130 * the user interface.
131 * ie: "SUSE Linux 10.2 updates"
133 std::string name() const;
136 * Add a base url. \see baseUrl
137 * \param url The base url for the repository.
139 RepoInfo & addBaseUrl( const Url &url );
142 * Set mirror list url. \see mirrorListUrl
143 * \param url The base url for the list
145 RepoInfo & setMirrorListUrl( const Url &url );
148 * enable or disable the repository \see enabled
151 RepoInfo & setEnabled( boost::tribool enabled );
154 * enable or disable autorefresh \see autorefresh
157 RepoInfo & setAutorefresh( boost::tribool autorefresh );
160 * set the repository alias \see alias
163 RepoInfo & setAlias( const std::string &alias );
166 * set the repository type \see type
169 RepoInfo & setType( const repo::RepoType &t );
172 * set the repository name \see name
175 RepoInfo & setName( const std::string &name );
177 std::ostream & dumpOn( std::ostream & str ) const;
181 /** Pointer to implementation */
182 RWCOW_pointer<Impl> _pimpl;
184 ///////////////////////////////////////////////////////////////////
186 /** \relates RepoInfo Stream output */
187 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
189 typedef std::list<RepoInfo> RepoInfoList;
191 /////////////////////////////////////////////////////////////////
193 ///////////////////////////////////////////////////////////////////
194 #endif // ZYPP2_REPOSITORYINFO_H