/trunk/Examples/test-suite/smart_pointer_namespace2.i
Swig | 80 lines | 71 code | 9 blank | 0 comment | 0 complexity | ff3e9ce9f899fa10d6a8395585ff5243 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %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)
- }