PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 88 lines | 65 code | 23 blank | 0 comment | 0 complexity | b0e40040a5ef60b58a8cdca43153beeb MD5 | raw file
 1%module(ruby_minherit="1") using_namespace
 2
 3%warnfilter(SWIGWARN_RUBY_WRONG_NAME) hi::hi0;	/* Ruby, wrong class name */
 4%warnfilter(SWIGWARN_RUBY_WRONG_NAME) hi::hi1;	/* Ruby, wrong class name */
 5
 6%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
 7	    SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
 8	    SWIGWARN_D_MULTIPLE_INHERITANCE,
 9	    SWIGWARN_PHP_MULTIPLE_INHERITANCE) Hi<hello::Hello, hi::hi0>; // C#, D, Java, PHP multiple inheritance
10
11%inline %{
12  namespace hello
13  {  
14    struct Hello 
15    {
16    };
17
18    template <class _T1, class _T2>
19    struct Hi : _T1, _T2
20    {
21      int value1() const
22      {
23	return 1;
24      }      
25
26      int value2() const
27      {
28	return 2;
29      }      
30    };    
31  }
32
33  namespace hi
34  {
35
36    struct hi0
37    {
38    };
39    
40  }
41%}
42
43namespace hello
44{
45  %template(Hi_hi0) Hi<hello::Hello, hi::hi0>;
46}
47
48
49%inline %{
50  namespace hi
51  {
52    struct hi1 : private hello::Hi< hello::Hello, hi0 >
53    {
54      using hello::Hi< hello::Hello, hi::hi0 >::value1;
55      using hello::Hi< hello::Hello, hi0 >::value2;
56    };
57    
58  }
59  
60%}
61
62
63%inline {
64namespace foo {
65  typedef double mytype;
66}
67
68// global namespace
69typedef float mytype;
70
71using namespace foo;
72
73struct X {
74  ::mytype d;
75};
76
77}
78
79%inline %{
80namespace SpaceMan {
81  typedef double SpaceManDouble;
82}
83using namespace ::SpaceMan; // global namespace prefix
84
85SpaceManDouble useSpaceMan(SpaceManDouble s) { return s; }
86
87%}
88