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 repos (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 repos. */
99 typedef std::set<std::string> ReposToEnable;
100 bool reposToEnableEmpty() const;
101 ReposToEnable::size_type reposToEnableSize() const;
102 ReposToEnable::const_iterator reposToEnableBegin() const;
103 ReposToEnable::const_iterator reposToEnableEnd() const;
105 /** Whether \c alias_r is mentioned in ReposToEnable. */
106 bool repoToEnableFind( const std::string & alias_r ) const;
108 /** Add \c alias_r to the set of ReposToEnable. */
109 void addRepoToEnable( const std::string & alias_r );
110 /** Remove \c alias_r from the set of ReposToEnable. */
111 void delRepoToEnable( const std::string & alias_r );
112 /** Clear the set of ReposToEnable. */
113 void clearReposToEnable();
116 /** \name Set of repos (repository aliases) to disable on next refresh.
118 * Repositories mentioned here will be disabled on the next refresh, in case they
119 * still exist. Afterwards they get removed from the list.
122 /** Container of repos. */
123 typedef std::set<std::string> ReposToDisable;
124 bool reposToDisableEmpty() const;
125 ReposToDisable::size_type reposToDisableSize() const;
126 ReposToDisable::const_iterator reposToDisableBegin() const;
127 ReposToDisable::const_iterator reposToDisableEnd() const;
129 /** Whether \c alias_r is mentioned in ReposToDisable. */
130 bool repoToDisableFind( const std::string & alias_r ) const;
132 /** Add \c alias_r to the set of ReposToDisable. */
133 void addRepoToDisable( const std::string & alias_r );
134 /** Remove \c alias_r from the set of ReposToDisable. */
135 void delRepoToDisable( const std::string & alias_r );
136 /** Clear the set of ReposToDisable. */
137 void clearReposToDisable();
142 * Writes ServiceInfo to stream in ".service" format
144 * \param str stream where serialized version service is written
146 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
149 * Write an XML representation of this ServiceInfo object.
152 * \param content if not empty, produces <service ...>content</service>
153 * otherwise <service .../>
155 virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const;
157 /** \deprecated Use camel cased dumpAsXmlOn */
158 ZYPP_DEPRECATED std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content = "" ) const { return dumpAsXmlOn( str, content ); }
163 RWCOW_pointer<Impl> _pimpl;
165 ///////////////////////////////////////////////////////////////////
167 /** \relates ServiceInfo */
168 typedef shared_ptr<ServiceInfo> ServiceInfo_Ptr;
169 /** \relates ServiceInfo */
170 typedef shared_ptr<const ServiceInfo> ServiceInfo_constPtr;
171 /** \relates ServiceInfo */
172 typedef std::list<ServiceInfo> ServiceInfoList;
174 /** \relates ServiceInfo Stream output */
175 std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
178 /////////////////////////////////////////////////////////////////
180 ///////////////////////////////////////////////////////////////////
181 #endif // ZYPP_SAT_REPOSITORY_H