1 %module(directors="1") director_nspace_director_name_collision
2 
3 #ifdef SWIGJAVA
4 SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
5 SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
6 #endif
7 
8 %{
9 #include <string>
10 
11 namespace TopLevel
12 {
13   namespace A
14   {
15     class Foo {
16     public:
~Foo()17       virtual ~Foo() {}
ping()18       virtual std::string ping() { return "TopLevel::A::Foo::ping()"; }
19     };
20   }
21 
22   namespace B
23   {
24     class Foo {
25     public:
~Foo()26       virtual ~Foo() {}
ping()27       virtual std::string ping() { return "TopLevel::B:Foo::ping()"; }
28     };
29   }
30 }
31 
32 %}
33 
34 %include <std_string.i>
35 
36 // nspace feature only supported by these languages
37 #if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
38 %nspace TopLevel::A::Foo;
39 %nspace TopLevel::B::Foo;
40 #else
41 //#warning nspace feature not yet supported in this target language
42 %ignore TopLevel::B::Foo;
43 #endif
44 
45 %feature("director") TopLevel::A::Foo;
46 %feature("director") TopLevel::B::Foo;
47 
48 namespace TopLevel
49 {
50   namespace A
51   {
52     class Foo {
53     public:
54       virtual ~Foo();
55       virtual std::string ping();
56     };
57   }
58 
59   namespace B
60   {
61     class Foo {
62     public:
63       virtual ~Foo();
64       virtual std::string ping();
65     };
66   }
67 }
68