Fix smart pointers and member methods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9881 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2007-08-01 00:07:23 +00:00
commit 6a13675c16
4 changed files with 60 additions and 3 deletions

View file

@ -242,6 +242,7 @@ CPP_TEST_CASES += \
smart_pointer_overload \
smart_pointer_protected \
smart_pointer_rename \
smart_pointer_templatemethods \
smart_pointer_simple \
smart_pointer_static \
smart_pointer_typedef \

View file

@ -0,0 +1,52 @@
%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
%}