new tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5175 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
95f07cfd24
commit
c3c78b8fec
3 changed files with 160 additions and 0 deletions
|
|
@ -49,6 +49,7 @@ CPP_TEST_BROKEN += \
|
||||||
defvalue_constructor \
|
defvalue_constructor \
|
||||||
exception_order \
|
exception_order \
|
||||||
namespace_union \
|
namespace_union \
|
||||||
|
smart_pointer_namespace2 \
|
||||||
template_default_arg \
|
template_default_arg \
|
||||||
template_specialization_defarg \
|
template_specialization_defarg \
|
||||||
template_specialization_enum \
|
template_specialization_enum \
|
||||||
|
|
@ -171,6 +172,7 @@ CPP_TEST_CASES += \
|
||||||
smart_pointer_const2 \
|
smart_pointer_const2 \
|
||||||
smart_pointer_multi \
|
smart_pointer_multi \
|
||||||
smart_pointer_multi_typedef \
|
smart_pointer_multi_typedef \
|
||||||
|
smart_pointer_namespace \
|
||||||
smart_pointer_not \
|
smart_pointer_not \
|
||||||
smart_pointer_overload \
|
smart_pointer_overload \
|
||||||
smart_pointer_protected \
|
smart_pointer_protected \
|
||||||
|
|
|
||||||
78
SWIG/Examples/test-suite/smart_pointer_namespace.i
Normal file
78
SWIG/Examples/test-suite/smart_pointer_namespace.i
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
|
||||||
|
%module smart_pointer_namespace
|
||||||
|
%{
|
||||||
|
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; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace one
|
||||||
|
{
|
||||||
|
class Obj1
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Obj1() {}
|
||||||
|
void donothing() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef one::Ptr<Obj1> Obj1;
|
||||||
|
}
|
||||||
|
|
||||||
|
%template(Obj1_ptr) one::Ptr<one::Obj1>;
|
||||||
|
|
||||||
|
namespace two
|
||||||
|
{
|
||||||
|
class Obj2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Obj2() {}
|
||||||
|
void donothing() {}
|
||||||
|
};
|
||||||
|
typedef one::Ptr<Obj2> Obj2;
|
||||||
|
}
|
||||||
|
|
||||||
|
%template(Obj2_ptr) one::Ptr<two::Obj2>;
|
||||||
|
|
||||||
80
SWIG/Examples/test-suite/smart_pointer_namespace2.i
Normal file
80
SWIG/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