1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/CapFactory.h
12 #ifndef ZYPP_CAPFACTORY_H
13 #define ZYPP_CAPFACTORY_H
17 #include "zypp/base/PtrTypes.h"
19 #include "zypp/Capability.h"
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////
27 // CLASS NAME : CapFactory
29 /** Factory for creating Capability.
31 * Besides parsing, CapFactory asserts that equal capabilites
32 * share the same implementation.
34 * \todo define EXCEPTIONS
35 * \todo Parser needs improvement in speed and accuracy.
39 friend std::ostream & operator<<( std::ostream & str, const CapFactory & obj );
49 /** Parse Capability from string providing Resolvable::Kind.
50 * \a strval_r is expected to define a valid Capability.
51 * \throw EXCEPTION on parse error.
53 Capability parse( const Resolvable::Kind & refers_r,
54 const std::string & strval_r ) const;
57 /** Parse Capability providing Resolvable::Kind, name, Rel and Edition as strings.
58 * \throw EXCEPTION on parse error.
60 Capability parse( const Resolvable::Kind & refers_r,
61 const std::string & name_r,
62 const std::string & op_r,
63 const std::string & edition_r ) const;
65 /** Parse Capability providing Resolvable::Kind, name, Rel and Edition.
66 * \throw EXCEPTION on parse error.
68 Capability parse( const Resolvable::Kind & refers_r,
69 const std::string & name_r,
71 const Edition & edition_r ) const;
73 /** Special Capability, triggering evaluation of Hal
74 * capabilities when matched.
76 Capability halEvalCap() const;
78 /** Special Capability, triggering evaluation of modalias
79 * capabilities when matched.
81 Capability modaliasEvalCap() const;
84 /** Provide a parsable string representation of \a cap_r. */
85 std::string encode( const Capability & cap_r ) const;
90 /** Pointer to implementation */
91 RW_pointer<Impl> _pimpl;
93 ///////////////////////////////////////////////////////////////////
95 /** \relates CapFactory Stream output */
96 extern std::ostream & operator<<( std::ostream & str, const CapFactory & obj );
98 /////////////////////////////////////////////////////////////////
100 ///////////////////////////////////////////////////////////////////
101 #endif // ZYPP_CAPFACTORY_H