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

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

#
Swig | 76 lines | 56 code | 20 blank | 0 comment | 0 complexity | 85074e0c1de8e8fa43fa5c09e416e8d1 MD5 | raw file
 1%module static_const_member_2
 2
 3%warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::modules::CavityPackFlags::forward_field;
 4%warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::modules::CavityPackFlags::backward_field;
 5%warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::modules::Test::current_profile;
 6
 7%inline %{ 
 8 namespace oss 
 9 {   
10   namespace modules
11   {
12     struct CavityPackFlags 
13     {
14       typedef unsigned int viewflags;
15       static const viewflags forward_field  = 1 << 0;
16       static const viewflags backward_field = 1 << 1;
17       static const viewflags cavity_flags;
18       static viewflags flags;
19       static const int &reftest;
20     };     
21
22     template <class T>
23     struct Test : CavityPackFlags
24     {
25       enum {LeftIndex, RightIndex};
26       static const viewflags current_profile  = 1 << 2;
27     };
28   }
29 }
30
31%} 
32
33%{
34
35int refvalue = 42;
36const int &oss::modules::CavityPackFlags::reftest = refvalue;
37
38%}
39
40%{
41  using oss::modules::CavityPackFlags;
42  
43  const CavityPackFlags::viewflags 
44    CavityPackFlags::cavity_flags = 
45    CavityPackFlags::forward_field | CavityPackFlags::backward_field;
46
47  CavityPackFlags::viewflags 
48    CavityPackFlags::flags = 0;
49
50%}
51
52%template(Test_int) oss::modules::Test<int>;
53
54
55
56
57%inline %{
58
59class Foo
60{
61public:
62  int val;
63  
64  Foo(int v) : val(v)
65  {
66  }
67  
68  static const Foo BAR;
69  static const Foo BAZ;
70};
71
72%}
73%{
74  const Foo Foo::BAR = Foo(1);
75  const Foo Foo::BAZ = Foo(2);
76%}