1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Capability.h
12 #ifndef ZYPP_CAPABILITY_H
13 #define ZYPP_CAPABILITY_H
18 #include "zypp/base/PtrTypes.h"
20 #include "zypp/Resolvable.h"
21 #include "zypp/SolverContextFwd.h"
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
29 DEFINE_PTR_TYPE(CapabilityImpl);
30 /////////////////////////////////////////////////////////////////
31 } // namespace capability
32 ///////////////////////////////////////////////////////////////////
36 ///////////////////////////////////////////////////////////////////
38 // CLASS NAME : Capability
40 /** Resolvable capabilitiy.
41 * \invariant Nonzero \c _pimpl
42 * \invariant Unified \c _pimpl asserted by CapFactory
47 friend class CapFactory;
48 /** Ordering for use in std::container */
49 friend class CapOrder;
50 friend bool operator==( const Capability & lhs, const Capability & rhs );
52 typedef capability::CapabilityImplPtr ImplPtr;
53 typedef capability::constCapabilityImplPtr constImplPtr;
56 Capability( ImplPtr impl_r );
59 typedef CapFactory Factory;
61 virtual ~Capability();
65 const ResKind & refers() const;
67 std::string asString() const;
69 bool matches( Resolvable::constPtr resolvable_r,
70 const SolverContext & colverContext_r ) const;
72 bool matches( Resolvable::constPtr resolvable_r ) const;
75 /** Pointer to implementation */
78 /** Avoid a bunch of friend decl. */
79 constImplPtr sayFriend() const;
81 ///////////////////////////////////////////////////////////////////
83 struct CapOrder : public std::binary_function<Capability, Capability, bool>
85 bool operator()( const Capability & lhs, const Capability & rhs ) const
86 { return lhs._pimpl < rhs._pimpl; }
89 ///////////////////////////////////////////////////////////////////
91 /** \relates Capability */
92 inline bool operator==( const Capability & lhs, const Capability & rhs )
93 { return lhs._pimpl == rhs._pimpl; }
95 /** \relates Capability */
96 inline bool operator!=( const Capability & lhs, const Capability & rhs )
97 { return ! (lhs == rhs); }
99 /** \relates Capability Stream output */
100 extern std::ostream & operator<<( std::ostream & str, const Capability & obj );
102 /////////////////////////////////////////////////////////////////
104 ///////////////////////////////////////////////////////////////////
105 #endif // ZYPP_CAPABILITY_H