fixes for namespaces + class declarations + %template directive

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6576 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-11-01 08:38:21 +00:00
commit 3fc7b773d9
6 changed files with 377 additions and 100 deletions

View file

@ -46,8 +46,7 @@ LIBPREFIX = lib
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
CPP_TEST_BROKEN += \
namespace_union \
overload_complicated \
smart_pointer_namespace2
overload_complicated
# Broken C test cases. (Can be run individually using make testcase.ctest.)
C_TEST_BROKEN += \
@ -157,6 +156,7 @@ CPP_TEST_CASES += \
name_cxx \
name_inherit \
name_warnings \
namespace_class \
namespace_enum \
namespace_extend \
namespace_nested \
@ -187,6 +187,7 @@ CPP_TEST_CASES += \
smart_pointer_multi \
smart_pointer_multi_typedef \
smart_pointer_namespace \
smart_pointer_namespace2 \
smart_pointer_not \
smart_pointer_overload \
smart_pointer_protected \

View file

@ -0,0 +1,150 @@
%module namespace_class
%inline %{
template<class T> void foobar(T t) {}
namespace test {
template<class T> void barfoo(T t) {}
}
%}
%template(FooBarInt) ::foobar<int>;
%template(BarFooInt) test::barfoo<int>;
%inline %{
namespace test {
enum Hello {
Hi
};
struct Test;
struct Bar {
Hello foo(Hello h) {
return h;
}
};
namespace hola {
struct Bor;
struct Foo;
struct Foobar;
template <class T> struct BarT {
};
template <class T> class FooT;
}
template <class T>
class hola::FooT {
public:
Hello foo(Hello h) {
return h;
}
T bar(T h) {
return h;
}
};
namespace hola {
template <> class FooT<double>;
template <> class FooT<int>;
}
template <>
class hola::FooT<double> {
public:
double moo(double h) {
return h;
}
};
int a;
struct hola::Foo : Bar {
Hello bar(Hello h) {
return h;
}
};
}
struct test::Test {
Hello foo(Hello h) {
return h;
}
};
struct test::hola::Bor {
Hello foo(Hello h) {
return h;
}
};
namespace test {
struct hola::Foobar : Bar {
Hello bar(Hello h) {
return h;
}
};
}
template <>
class test::hola::FooT<int> {
public:
int quack(int h) {
return h;
}
};
%}
namespace test
{
namespace hola {
%template(FooT_i) FooT<int>;
}
%template(FooT_H) hola::FooT<Hello>;
}
%template(FooT_d) test::hola::FooT<double>;
%template(BarT_H) test::hola::BarT<test::Hello>;
%inline %{
namespace hi {
namespace hello {
template <class T> struct PooT;
}
namespace hello {
template <class T> struct PooT
{
};
}
}
%}
%template(Poo_i) hi::hello::PooT<int>;
%inline %{
template <class T> struct BooT {
};
namespace test {
typedef ::BooT<Hello> BooT_H;
}
%}
namespace test {
%template(BooT_H) ::BooT<Hello>;
}
%template(BooT_i) ::BooT<int>;