2 /** Base of ResTraits. Defines the Resolvable::Kind type. */
3 /*struct ResolvableTraits
5 typedef KindOf<Resolvable> KindType;
10 /** ResTraits. Defines common types and the Kind value. */
11 template<typename _Res>
14 typedef zypp::intrusive_ptr<_Res> PtrType;
15 typedef zypp::intrusive_ptr<const _Res> constPtrType;
18 typedef ::zypp::intrusive_ptr<const ResObject> ResObject_constPtr;
19 typedef ::zypp::intrusive_ptr<ResObject> ResObject_Ptr;
20 %template(ResObject_constPtr) ::zypp::intrusive_ptr<const zypp::ResObject>;
21 %template(ResObject_Ptr) ::zypp::intrusive_ptr<zypp::ResObject>;
25 namespace zypp::ResObject::TraitsType
27 typedef ::zypp::intrusive_ptr<const zypp::ResObject> constPtrType;
29 namespace zypp::Resolvable::TraitsType
31 typedef ::zypp::intrusive_ptr<const zypp::Resolvable> constPtrType;
34 %template(ResTraitsResolvable) zypp::ResTraits<zypp::Resolvable>;
35 %template(ResTraitsResObject) zypp::ResTraits<zypp::ResObject>;
37 // Common definitions for all Resolvable types
38 // - *_Ptr and *_constPtr
39 // - isKind* to test whether a ResObject/PoolItem is
40 // of a specific kind.
41 // - asKind* to convert a ResObject/PoolItem into a
42 // specific *_constPtr.
46 typedef ::zypp::intrusive_ptr<const X> X##_constPtr;
47 typedef ::zypp::intrusive_ptr<X> X##_Ptr;
48 %template(X##_constPtr) ::zypp::intrusive_ptr<const X>;
49 %template(X##_Ptr) ::zypp::intrusive_ptr<X>;
51 bool isKind##X( const zypp::Resolvable::constPtr & p );
52 bool isKind##X( const zypp::ResObject::constPtr & p );
53 bool isKind##X( const zypp::PoolItem & p );
55 X##_constPtr asKind##X( const zypp::Resolvable::constPtr & p );
56 X##_constPtr asKind##X( const zypp::ResObject::constPtr & p );
57 X##_constPtr asKind##X( const zypp::PoolItem & p );
64 inline bool isKind##X( const zypp::Resolvable::constPtr & p )
65 { return isKind<X>( p ); }
66 inline bool isKind##X( const zypp::ResObject::constPtr & p )
67 { return isKind<X>( p ); }
68 inline bool isKind##X( const zypp::PoolItem & p )
69 { return isKind<X>( p.resolvable() ); }
70 inline X::constPtr asKind##X( const zypp::Resolvable::constPtr & p )
71 { return asKind<X>( p ); }
72 inline X::constPtr asKind##X( const zypp::ResObject::constPtr & p )
73 { return asKind<X>( p ); }
74 inline X::constPtr asKind##X( const zypp::PoolItem & p )
75 { return asKind<X>( p.resolvable() ); }
79 #if defined(SWIGPYTHON)
83 return KindOfResolvable( #X )