From 3fc7b773d98400b52cf8dda3c2e30f09631ca9ab Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 1 Nov 2004 08:38:21 +0000 Subject: 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 --- Examples/test-suite/namespace_class.i | 150 ++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 Examples/test-suite/namespace_class.i (limited to 'Examples/test-suite/namespace_class.i') diff --git a/Examples/test-suite/namespace_class.i b/Examples/test-suite/namespace_class.i new file mode 100644 index 000000000..77b6a8b9d --- /dev/null +++ b/Examples/test-suite/namespace_class.i @@ -0,0 +1,150 @@ +%module namespace_class + +%inline %{ + template void foobar(T t) {} + namespace test { + template void barfoo(T t) {} + } +%} + +%template(FooBarInt) ::foobar; +%template(BarFooInt) test::barfoo; + + +%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 struct BarT { + }; + + template class FooT; + } + + template + class hola::FooT { + public: + Hello foo(Hello h) { + return h; + } + + T bar(T h) { + return h; + } + }; + + namespace hola { + template <> class FooT; + template <> class FooT; + } + + template <> + class hola::FooT { + 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 { + public: + int quack(int h) { + return h; + } + }; + +%} + + +namespace test +{ + namespace hola { + %template(FooT_i) FooT; + } + + %template(FooT_H) hola::FooT; +} + +%template(FooT_d) test::hola::FooT; +%template(BarT_H) test::hola::BarT; + +%inline %{ + + namespace hi { + namespace hello { + template struct PooT; + } + + namespace hello { + template struct PooT + { + }; + } + } +%} + +%template(Poo_i) hi::hello::PooT; + +%inline %{ + + template struct BooT { + }; + + namespace test { + + typedef ::BooT BooT_H; + } + +%} + +namespace test { + + %template(BooT_H) ::BooT; +} +%template(BooT_i) ::BooT; + -- cgit v1.2.1