swig/Examples/test-suite/smart_pointer_templatemethods.i
William S Fulton 6a13675c16 Fix smart pointers and member methods
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9881 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-08-01 00:07:23 +00:00

52 lines
900 B
OpenEdge ABL

%module smart_pointer_templatemethods
%inline %{
namespace ns {
template <typename T>
class Ptr
{
public:
Ptr () {}
T *operator -> () { return 0; }
};
typedef unsigned short uint16_t;
class InterfaceId
{
public:
InterfaceId (uint16_t iid) {}
InterfaceId() {}
};
template <typename K> class Objekt
{
public:
Objekt () {}
virtual ~Objekt () {}
Ptr<K> QueryInterface (InterfaceId iid) const { return Ptr<K>(); }
void DisposeObjekt (void) {}
};
class Object
{
public:
Object () {}
virtual ~Object () {}
template <typename T> Ptr<T> QueryInterface (InterfaceId iid) const { return Ptr<T>(); }
void DisposeObject (void) {}
};
#ifdef SWIG
%template(PtrObject) Ptr<Object>;
%template(PtrInt) Ptr<int>;
%template(ObjektInt) Objekt<int>;
%template(PtrObjektInt) Ptr<Objekt<int> >;
%template(QueryInterfaceObject) Object::QueryInterface<Object>;
#endif
}; // namespace
%}