1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ServiceInfo.h
12 #ifndef ZYPP_SERVICE_H
13 #define ZYPP_SERVICE_H
20 #include "zypp/repo/RepoInfoBase.h"
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 // CLASS NAME : ServiceInfo
32 class ServiceInfo : public repo::RepoInfoBase
35 /** Default ctor creates \ref noService.*/
39 * Creates ServiceInfo with specified alias.
41 * \param alias unique short name of service
43 ServiceInfo( const std::string & alias );
46 * ServiceInfo with alias and its URL
48 * \param alias unique shortname of service
49 * \param url url to service
51 ServiceInfo( const std::string & alias, const Url& url );
54 /** Represents an empty service. */
55 static const ServiceInfo noService;
62 * \return url to service
67 * Sets url for this service
69 * \param url url to this service
71 void setUrl( const Url& url );
74 /** \name Set of catalogs (repository aliases) to enable on next refresh.
76 * Per default new repositories are created in disabled state. But repositories
77 * mentioned here will be created in enabled state on the next refresh.
78 * Afterwards they get removed from the list.
81 /** Container of catalogs. */
82 typedef std::set<std::string> CatalogsToEnable;
83 bool catalogsToEnableEmpty() const;
84 CatalogsToEnable::size_type catalogsToEnableSize() const;
85 CatalogsToEnable::const_iterator catalogsToEnableBegin() const;
86 CatalogsToEnable::const_iterator catalogsToEnableEnd() const;
88 /** Wheter \c alias_r is mentioned in CatalogsToEnable. */
89 bool catalogToEnableFind( const std::string & alias_r ) const;
91 /** Add \c alias_r to the set of CatalogsToEnable. */
92 void addCatalogToEnable( const std::string & alias_r );
93 /** Remove \c alias_r to the set of CatalogsToEnable. */
94 void delCatalogToEnable( const std::string & alias_r );
97 /** \name Set of catalogs (repository aliases) to disable on next refresh.
99 * Repositories mentioned here will be disabled on the next refresh, in case they
100 * still exist. Afterwards they get removed from the list.
103 /** Container of catalogs. */
104 typedef std::set<std::string> CatalogsToDisable;
105 bool catalogsToDisableEmpty() const;
106 CatalogsToDisable::size_type catalogsToDisableSize() const;
107 CatalogsToDisable::const_iterator catalogsToDisableBegin() const;
108 CatalogsToDisable::const_iterator catalogsToDisableEnd() const;
110 /** Wheter \c alias_r is mentioned in CatalogsToDisable. */
111 bool catalogToDisableFind( const std::string & alias_r ) const;
113 /** Add \c alias_r to the set of CatalogsToDisable. */
114 void addCatalogToDisable( const std::string & alias_r );
115 /** Remove \c alias_r to the set of CatalogsToDisable. */
116 void delCatalogToDisable( const std::string & alias_r );
121 * Writes ServiceInfo to stream in ".service" format
123 * \param str stream where serialized version service is written
125 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
128 * Write an XML representation of this ServiceInfo object.
130 virtual std::ostream & dumpAsXMLOn(std::ostream & str) const;
133 * Write an XML representation of this ServiceInfo object.
136 * \param content if not empty, produces <service ...>content</service>
137 * otherwise <service .../>
139 virtual std::ostream & dumpAsXMLOn(
140 std::ostream & str, const std::string & content) const;
145 RWCOW_pointer<Impl> _pimpl;
147 ///////////////////////////////////////////////////////////////////
149 typedef shared_ptr<ServiceInfo> ServiceInfo_Ptr;
151 /** \relates ServiceInfo Stream output */
152 std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
155 /////////////////////////////////////////////////////////////////
157 ///////////////////////////////////////////////////////////////////
158 #endif // ZYPP_SAT_REPOSITORY_H