summaryrefslogtreecommitdiff
path: root/Examples/test-suite/namespace_class.i
diff options
context:
space:
mode:
authorMarcelo Matus <mmatus@acms.arizona.edu>2004-11-01 08:38:21 +0000
committerMarcelo Matus <mmatus@acms.arizona.edu>2004-11-01 08:38:21 +0000
commit3fc7b773d98400b52cf8dda3c2e30f09631ca9ab (patch)
treea9c924e2ff588adbda63f39c184fae4af71434c4 /Examples/test-suite/namespace_class.i
parent7f004ad83b75d8012ef41917d3e631db347c7b09 (diff)
downloadswig-3fc7b773d98400b52cf8dda3c2e30f09631ca9ab.tar.gz
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
Diffstat (limited to 'Examples/test-suite/namespace_class.i')
-rw-r--r--Examples/test-suite/namespace_class.i150
1 files changed, 150 insertions, 0 deletions
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<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>;
+