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"
20 #include "zypp/capability/CapabilityImpl.h"
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
28 // CLASS NAME : CapFactory
30 /** Factory for creating Capability.
32 * Besides parsing, CapFactory asserts that equal capabilites
33 * share the same implementation.
35 * \todo define EXCEPTIONS
36 * \todo Parser needs improvement in speed and accuracy.
40 friend std::ostream & operator<<( std::ostream & str, const CapFactory & obj );
51 /** Create capability from Implementation
52 * \a impl is a valid \ref CapabilityImpl Ptr
53 * \throw EXCEPTION on null capability
55 Capability fromImpl( capability::CapabilityImpl::Ptr impl ) const;
57 /** Parse Capability from string providing Resolvable::Kind.
58 * \a strval_r is expected to define a valid Capability.
59 * \throw EXCEPTION on parse error.
61 Capability parse( const Resolvable::Kind & refers_r,
62 const std::string & strval_r ) const;
65 /** Parse Capability providing Resolvable::Kind, name, Rel and Edition as strings.
66 * \throw EXCEPTION on parse error.
68 Capability parse( const Resolvable::Kind & refers_r,
69 const std::string & name_r,
70 const std::string & op_r,
71 const std::string & edition_r ) const;
73 /** Parse Capability providing Resolvable::Kind, name, Rel and Edition.
74 * \throw EXCEPTION on parse error.
76 Capability parse( const Resolvable::Kind & refers_r,
77 const std::string & name_r,
79 const Edition & edition_r ) const;
81 /** Special Capability, triggering evaluation of Hal
82 * capabilities when matched.
84 Capability halEvalCap() const;
86 /** Special Capability, triggering evaluation of modalias
87 * capabilities when matched.
89 Capability modaliasEvalCap() const;
92 /** Provide a parsable string representation of \a cap_r. */
93 std::string encode( const Capability & cap_r ) const;
98 /** Pointer to implementation */
99 RW_pointer<Impl> _pimpl;
101 ///////////////////////////////////////////////////////////////////
103 /** \relates CapFactory Stream output */
104 extern std::ostream & operator<<( std::ostream & str, const CapFactory & obj );
106 /////////////////////////////////////////////////////////////////
108 ///////////////////////////////////////////////////////////////////
109 #endif // ZYPP_CAPFACTORY_H