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 );
54 virtual ~ServiceInfo();
57 /** Represents an empty service. */
58 static const ServiceInfo noService;
65 * \return url to service
70 * Sets url for this service
72 * \param url url to this service
74 void setUrl( const Url& url );
79 repo::ServiceType type() const;
84 * \param type the new type
86 void setType( const repo::ServiceType & type );
88 void setProbedType( const repo::ServiceType & t ) const;
91 /** \name Set of catalogs (repository aliases) to enable on next refresh.
93 * Per default new repositories are created in disabled state. But repositories
94 * mentioned here will be created in enabled state on the next refresh.
95 * Afterwards they get removed from the list.
98 /** Container of catalogs. */
99 typedef std::set<std::string> CatalogsToEnable;
100 bool catalogsToEnableEmpty() const;
101 CatalogsToEnable::size_type catalogsToEnableSize() const;
102 CatalogsToEnable::const_iterator catalogsToEnableBegin() const;
103 CatalogsToEnable::const_iterator catalogsToEnableEnd() const;
105 /** Wheter \c alias_r is mentioned in CatalogsToEnable. */
106 bool catalogToEnableFind( const std::string & alias_r ) const;
108 /** Add \c alias_r to the set of CatalogsToEnable. */
109 void addCatalogToEnable( const std::string & alias_r );
110 /** Remove \c alias_r to the set of CatalogsToEnable. */
111 void delCatalogToEnable( const std::string & alias_r );
114 /** \name Set of catalogs (repository aliases) to disable on next refresh.
116 * Repositories mentioned here will be disabled on the next refresh, in case they
117 * still exist. Afterwards they get removed from the list.
120 /** Container of catalogs. */
121 typedef std::set<std::string> CatalogsToDisable;
122 bool catalogsToDisableEmpty() const;
123 CatalogsToDisable::size_type catalogsToDisableSize() const;
124 CatalogsToDisable::const_iterator catalogsToDisableBegin() const;
125 CatalogsToDisable::const_iterator catalogsToDisableEnd() const;
127 /** Wheter \c alias_r is mentioned in CatalogsToDisable. */
128 bool catalogToDisableFind( const std::string & alias_r ) const;
130 /** Add \c alias_r to the set of CatalogsToDisable. */
131 void addCatalogToDisable( const std::string & alias_r );
132 /** Remove \c alias_r to the set of CatalogsToDisable. */
133 void delCatalogToDisable( const std::string & alias_r );
138 * Writes ServiceInfo to stream in ".service" format
140 * \param str stream where serialized version service is written
142 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
145 * Write an XML representation of this ServiceInfo object.
147 virtual std::ostream & dumpAsXMLOn(std::ostream & str) const;
150 * Write an XML representation of this ServiceInfo object.
153 * \param content if not empty, produces <service ...>content</service>
154 * otherwise <service .../>
156 virtual std::ostream & dumpAsXMLOn(
157 std::ostream & str, const std::string & content) const;
162 RWCOW_pointer<Impl> _pimpl;
164 ///////////////////////////////////////////////////////////////////
166 typedef shared_ptr<ServiceInfo> ServiceInfo_Ptr;
168 /** \relates ServiceInfo Stream output */
169 std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
172 /////////////////////////////////////////////////////////////////
174 ///////////////////////////////////////////////////////////////////
175 #endif // ZYPP_SAT_REPOSITORY_H