new tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5175 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
603a9e5076
commit
7db499562b
3 changed files with 160 additions and 0 deletions
80
Examples/test-suite/smart_pointer_namespace2.i
Normal file
80
Examples/test-suite/smart_pointer_namespace2.i
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
%module smart_pointer_namespace2
|
||||
%{
|
||||
namespace one
|
||||
{
|
||||
template <typename T>
|
||||
class Ptr
|
||||
{
|
||||
T* p;
|
||||
public:
|
||||
Ptr(T *tp) : p(tp) {}
|
||||
~Ptr() { };
|
||||
T* operator->() { return p; }
|
||||
};
|
||||
}
|
||||
namespace one
|
||||
{
|
||||
class Obj1
|
||||
{
|
||||
public:
|
||||
Obj1() {}
|
||||
void donothing() {}
|
||||
};
|
||||
typedef one::Ptr<Obj1> Obj1_ptr;
|
||||
}
|
||||
|
||||
namespace two
|
||||
{
|
||||
class Obj2
|
||||
{
|
||||
public:
|
||||
Obj2() {}
|
||||
void donothing() {}
|
||||
};
|
||||
typedef one::Ptr<Obj2> Obj2_ptr;
|
||||
}
|
||||
%}
|
||||
|
||||
namespace one
|
||||
{
|
||||
template <typename T>
|
||||
class Ptr
|
||||
{
|
||||
T* p;
|
||||
public:
|
||||
Ptr(T *tp) : p(tp) {}
|
||||
~Ptr() { };
|
||||
T* operator->() { return p; }
|
||||
};
|
||||
}
|
||||
|
||||
%define PTR_DEF(o)
|
||||
typedef one::Ptr<o> o ## _ptr;
|
||||
%template(o ## _ptr) one::Ptr<o>;
|
||||
%enddef
|
||||
|
||||
namespace one
|
||||
{
|
||||
class Obj1
|
||||
{
|
||||
public:
|
||||
Obj1() {}
|
||||
void donothing() {}
|
||||
};
|
||||
|
||||
PTR_DEF(Obj1)
|
||||
}
|
||||
|
||||
namespace two
|
||||
{
|
||||
class Obj2
|
||||
{
|
||||
public:
|
||||
Obj2() {}
|
||||
void donothing() {}
|
||||
};
|
||||
|
||||
PTR_DEF(Obj2)
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue