backup
[platform/upstream/libzypp.git] / zypp / CapFactory.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/CapFactory.h
10  *
11 */
12 #ifndef ZYPP_CAPFACTORY_H
13 #define ZYPP_CAPFACTORY_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/PtrTypes.h"
18
19 #include "zypp/Capability.h"
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24   ///////////////////////////////////////////////////////////////////
25   namespace detail
26   { /////////////////////////////////////////////////////////////////
27     DEFINE_PTR_TYPE(CapFactoryImpl)
28     /////////////////////////////////////////////////////////////////
29   } // namespace detail
30   ///////////////////////////////////////////////////////////////////
31
32   ///////////////////////////////////////////////////////////////////
33   //
34   //    CLASS NAME : CapFactory
35   //
36   /**
37    * \todo define EXCEPTIONS
38   */
39   class CapFactory
40   {
41   public:
42     /** Default ctor */
43     CapFactory();
44     /** Factory ctor */
45     explicit
46     CapFactory( detail::CapFactoryImplPtr impl_r );
47     /** Dtor */
48     ~CapFactory();
49
50   public:
51     /** Parse Capability from string (incl. ResKind).
52      * \c strval_r is expected to define a valid Capability \em including
53      * the ResKind.
54      * \throw EXCEPTION on parse error.
55     */
56     Capability parse( const std::string & strval_r ) const;
57     /** Parse Capability from string (default ResKind).
58      * \c strval_r is expected to define a valid Capability. If it does
59      * not define the ResKind, \c defaultRefers_r is used instead.
60      * \throw EXCEPTION on parse error.
61     */
62     Capability parse( const std::string & strval_r, const ResKind & defaultRefers_r ) const;
63
64   private:
65     /** Pointer to implementation */
66     detail::CapFactoryImplPtr _pimpl;
67   public:
68     /** Avoid a bunch of friend decl. */
69     detail::constCapFactoryImplPtr sayFriend() const;
70   };
71   ///////////////////////////////////////////////////////////////////
72
73   /** \relates CapFactory Stream output */
74   extern std::ostream & operator<<( std::ostream & str, const CapFactory & obj );
75
76   /////////////////////////////////////////////////////////////////
77 } // namespace zypp
78 ///////////////////////////////////////////////////////////////////
79 #endif // ZYPP_CAPFACTORY_H