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"
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////
30 // CLASS NAME : RepoInfo
33 * \short What is known about a repository
35 * The class RepoInfo represents everything that
36 * is known about a software repository.
38 * It can be used to store information about known
41 * This class tries to be compatible with the
42 * concept of a .repo file used by YUM and
43 * also available in the openSUSE build service.
49 * name=Ruby repository (openSUSE_10.2)
51 * baseurl=http://software.opensuse.org/download/ruby/openSUSE_10.2/
53 * gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
57 * \note A Repository info is a hint about how
58 * to create a repository.
62 friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
67 //RepoInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
70 * unique identifier for this source. If not specified
71 * It should be generated from the base url.
73 * Normally, in a .repo file the section name is used
76 std::string alias() const;
79 * The base Url is the Url of the repository that generates
80 * the authoritative metadata this repository provides.
82 * For example for the url http://updates.novell.com/10.2
83 * the base url is http://updates.novell.com/10.2.
84 * For the url http://host.com/mirror/update.novell.com/10.2
85 * the base url is http://updates.novell.com/10.2
87 * This can't be empty in order the repository to be valid
88 * unless the download of the mirror list succeeds and it
89 * contains a valid url.
91 std::set<Url> urls() const;
94 * Url of a file which contains a list of Urls
95 * If empty, the base url will be used.
97 Url mirrorListUrl() const;
99 typedef std::set<Url>::const_iterator urls_const_iterator;
102 * iterator that points at begin of repository urls
104 urls_const_iterator urlsBegin() const;
107 * iterator that points at end of repository urls
109 urls_const_iterator urlsEnd() const;
112 * If enabled is false, then this repository must be ignored as if does
113 * not exists, except when checking for duplicate alias.
115 boost::tribool enabled() const;
118 * If true, the repostory must be refreshed before creating resolvables
121 boost::tribool autorefresh() const;
124 * Type of repository,
125 * FIXME should be an enum?
127 std::string type() const;
130 * \short Repository short label
132 * Short label or description of the repository, to be used on
133 * the user interface.
134 * ie: "SUSE Linux 10.2 updates"
136 std::string name() const;
139 * Add a base url. \see baseUrl
140 * \param url The base url for the repository.
142 RepoInfo & addBaseUrl( const Url &url );
145 * Set mirror list url. \see mirrorListUrl
146 * \param url The base url for the list
148 RepoInfo & setMirrorListUrl( const Url &url );
151 * enable or disable the repository \see enabled
154 RepoInfo & setEnabled( boost::tribool enabled );
157 * enable or disable autorefresh \see autorefresh
160 RepoInfo & setAutorefresh( boost::tribool autorefresh );
163 * set the repository alias \see alias
166 RepoInfo & setAlias( const std::string &alias );
169 * set the repository type \see type
172 RepoInfo & setType( const std::string &t );
175 * set the repository name \see name
178 RepoInfo & setName( const std::string &name );
180 std::ostream & dumpOn( std::ostream & str ) const;
184 /** Pointer to implementation */
185 RWCOW_pointer<Impl> _pimpl;
187 ///////////////////////////////////////////////////////////////////
189 /** \relates RepoInfo Stream output */
190 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
192 typedef std::list<RepoInfo> RepoInfoList;
194 /////////////////////////////////////////////////////////////////
196 ///////////////////////////////////////////////////////////////////
197 #endif // ZYPP2_REPOSITORYINFO_H