typos
[platform/upstream/libzypp.git] / zypp / ServiceInfo.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ServiceInfo.h
10  *
11  */
12 #ifndef ZYPP_SERVICE_H
13 #define ZYPP_SERVICE_H
14
15 #include <set>
16 #include <string>
17
18 #include "zypp/Url.h"
19
20 #include "zypp/repo/RepoInfoBase.h"
21
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26
27   ///////////////////////////////////////////////////////////////////
28   //
29   //    CLASS NAME : ServiceInfo
30   //
31   /** */
32   class ServiceInfo : public repo::RepoInfoBase
33   {
34   public:
35     /** Default ctor creates \ref noService.*/
36     ServiceInfo();
37
38     /**
39      *  Creates ServiceInfo with specified alias.
40      *
41      * \param alias unique short name of service
42      */
43     ServiceInfo( const std::string & alias );
44
45     /**
46      * ServiceInfo with alias and its URL
47      *
48      * \param alias unique shortname of service
49      * \param url url to service
50      */
51     ServiceInfo( const std::string & alias, const Url& url );
52
53   public:
54     /** Represents an empty service. */
55     static const ServiceInfo noService;
56
57   public:
58
59     /**
60      * Gets url to service
61      *
62      * \return url to service
63      */
64     Url url() const;
65
66     /**
67      * Sets url for this service
68      *
69      * \param url url to this service
70      */
71     void setUrl( const Url& url );
72
73
74     /** \name Set of catalogs (repository aliases) to enable on next refresh.
75      *
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.
79      */
80     //@{
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;
87
88     /** Wheter \c alias_r is mentioned in CatalogsToEnable. */
89     bool catalogToEnableFind( const std::string & alias_r ) const;
90
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 );
95     //@}
96
97   public:
98     /**
99      * Writes ServiceInfo to stream in ".service" format
100      *
101      * \param str stream where serialized version service is written
102      */
103     virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
104
105     /**
106      * Write an XML representation of this ServiceInfo object.
107      */
108     virtual std::ostream & dumpAsXMLOn( std::ostream & str) const;
109
110     class Impl;
111
112   private:
113       RWCOW_pointer<Impl> _pimpl;
114   };
115   ///////////////////////////////////////////////////////////////////
116
117   typedef shared_ptr<ServiceInfo> ServiceInfo_Ptr;
118
119   /** \relates ServiceInfo Stream output */
120   std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
121
122
123     /////////////////////////////////////////////////////////////////
124 } // namespace zypp
125 ///////////////////////////////////////////////////////////////////
126 #endif // ZYPP_SAT_REPOSITORY_H