/** Base of ResTraits. Defines the Resolvable::Kind type. */ /*struct ResolvableTraits { typedef KindOf KindType; };*/ /** ResTraits. Defines common types and the Kind value. */ template struct ResTraits { typedef intrusive_ptr<_Res> PtrType; typedef intrusive_ptr constPtrType; }; %template(ResTraitsResolvable) ResTraits; %template(ResObject_constPtr) intrusive_ptr; %template(ResObject_Ptr) intrusive_ptr; // Common definitions for all Resolvable types // - *_Ptr and *_constPtr // - isKind* to test whether a ResObject/PoolItem is // of a specific kind. // - asKind* to convert a ResObject/PoolItem into a // specific *_constPtr. %define %STUFF(X) typedef intrusive_ptr X##_constPtr; typedef intrusive_ptr X##_Ptr; %template(X##_constPtr) intrusive_ptr; %template(X##_Ptr) intrusive_ptr; bool isKind##X( const Resolvable::constPtr & p ); bool isKind##X( const PoolItem & p ); X##_constPtr asKind##X( const Resolvable::constPtr & p ); X##_constPtr asKind##X( const PoolItem & p ); %header { inline bool isKind##X( const Resolvable::constPtr & p ) { return isKind( p ); } inline bool isKind##X( const PoolItem & p ) { return isKind( p.resolvable() ); } inline X::constPtr asKind##X( const Resolvable::constPtr & p ) { return asKind( p ); } inline X::constPtr asKind##X( const PoolItem & p ) { return asKind( p.resolvable() ); } } #if defined(SWIGPYTHON) %pythoncode { def KindOf##X(): return KindOfResolvable( #X ) } #endif %enddef %STUFF(Package) %STUFF(Patch) %STUFF(SrcPackage) %STUFF(Pattern) %STUFF(Product)