1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ServiceInfo.h
12 #ifndef ZYPP_SERVICE_H
13 #define ZYPP_SERVICE_H
20 #include "zypp/repo/ServiceType.h"
21 #include "zypp/repo/RepoInfoBase.h"
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////
30 // CLASS NAME : ServiceInfo
33 class ServiceInfo : public repo::RepoInfoBase
36 /** Default ctor creates \ref noService.*/
40 * Creates ServiceInfo with specified alias.
42 * \param alias unique short name of service
44 ServiceInfo( const std::string & alias );
47 * ServiceInfo with alias and its URL
49 * \param alias unique shortname of service
50 * \param url url to service
52 ServiceInfo( const std::string & alias, const Url& url );
55 /** Represents an empty service. */
56 static const ServiceInfo noService;
63 * \return url to service
68 * Sets url for this service
70 * \param url url to this service
72 void setUrl( const Url& url );
77 repo::ServiceType type() const;
82 * \param type the new type
84 void setType( const repo::ServiceType & type );
86 void setProbedType( const repo::ServiceType & t ) const;
89 /** \name Set of catalogs (repository aliases) to enable on next refresh.
91 * Per default new repositories are created in disabled state. But repositories
92 * mentioned here will be created in enabled state on the next refresh.
93 * Afterwards they get removed from the list.
96 /** Container of catalogs. */
97 typedef std::set<std::string> CatalogsToEnable;
98 bool catalogsToEnableEmpty() const;
99 CatalogsToEnable::size_type catalogsToEnableSize() const;
100 CatalogsToEnable::const_iterator catalogsToEnableBegin() const;
101 CatalogsToEnable::const_iterator catalogsToEnableEnd() const;
103 /** Wheter \c alias_r is mentioned in CatalogsToEnable. */
104 bool catalogToEnableFind( const std::string & alias_r ) const;
106 /** Add \c alias_r to the set of CatalogsToEnable. */
107 void addCatalogToEnable( const std::string & alias_r );
108 /** Remove \c alias_r to the set of CatalogsToEnable. */
109 void delCatalogToEnable( const std::string & alias_r );
112 /** \name Set of catalogs (repository aliases) to disable on next refresh.
114 * Repositories mentioned here will be disabled on the next refresh, in case they
115 * still exist. Afterwards they get removed from the list.
118 /** Container of catalogs. */
119 typedef std::set<std::string> CatalogsToDisable;
120 bool catalogsToDisableEmpty() const;
121 CatalogsToDisable::size_type catalogsToDisableSize() const;
122 CatalogsToDisable::const_iterator catalogsToDisableBegin() const;
123 CatalogsToDisable::const_iterator catalogsToDisableEnd() const;
125 /** Wheter \c alias_r is mentioned in CatalogsToDisable. */
126 bool catalogToDisableFind( const std::string & alias_r ) const;
128 /** Add \c alias_r to the set of CatalogsToDisable. */
129 void addCatalogToDisable( const std::string & alias_r );
130 /** Remove \c alias_r to the set of CatalogsToDisable. */
131 void delCatalogToDisable( const std::string & alias_r );
136 * Writes ServiceInfo to stream in ".service" format
138 * \param str stream where serialized version service is written
140 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
143 * Write an XML representation of this ServiceInfo object.
145 virtual std::ostream & dumpAsXMLOn(std::ostream & str) const;
148 * Write an XML representation of this ServiceInfo object.
151 * \param content if not empty, produces <service ...>content</service>
152 * otherwise <service .../>
154 virtual std::ostream & dumpAsXMLOn(
155 std::ostream & str, const std::string & content) const;
160 RWCOW_pointer<Impl> _pimpl;
162 ///////////////////////////////////////////////////////////////////
164 typedef shared_ptr<ServiceInfo> ServiceInfo_Ptr;
166 /** \relates ServiceInfo Stream output */
167 std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
170 /////////////////////////////////////////////////////////////////
172 ///////////////////////////////////////////////////////////////////
173 #endif // ZYPP_SAT_REPOSITORY_H