PageRenderTime 24ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/nspace_extend.i

#
Swig | 53 lines | 42 code | 11 blank | 0 comment | 0 complexity | c4308a519f55358a130b6c676132df92 MD5 | raw file
 1// Test the nspace feature and %extend
 2%module nspace_extend
 3
 4// nspace feature only supported by these languages
 5#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
 6
 7#if defined(SWIGJAVA)
 8SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
 9#endif
10%nspace;
11
12%extend Outer::Inner1::Color {
13      Color() { return new Outer::Inner1::Color(); }
14      virtual ~Color() { delete $self; }
15      static Color* create() { return new Outer::Inner1::Color(); }
16      Color(const Color& other) { return new Outer::Inner1::Color(other); }
17
18      void colorInstanceMethod(double d) {}
19      static void colorStaticMethod(double d) {}
20}
21
22%inline %{
23
24namespace Outer {
25  namespace Inner1 {
26    struct Color {
27    };
28  }
29
30  namespace Inner2 {
31    struct Color {
32    };
33  }
34}
35%}
36
37%extend Outer::Inner2::Color {
38      Color() { return new Outer::Inner2::Color(); }
39      ~Color() { delete $self; }
40      static Color* create() { return new Outer::Inner2::Color(); }
41      Color(const Color& other) { return new Outer::Inner2::Color(other); }
42
43      void colorInstanceMethod(double d) {}
44      static void colorStaticMethod(double d) {}
45      void colors(const Inner1::Color& col1a,
46                  const Outer::Inner1::Color& col1b,
47                  const Color &col2a,
48                  const Inner2::Color& col2b,
49                  const Outer::Inner2::Color& col2c) {}
50}
51
52#endif
53