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

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

#
Swig | 50 lines | 43 code | 7 blank | 0 comment | 0 complexity | 05225d5018d635e8a087d07fb2b7462e MD5 | raw file
 1%module template_int_const
 2
 3%warnfilter(SWIGWARN_RUBY_WRONG_NAME) interface_traits;	/* Ruby, wrong class name */
 4%warnfilter(SWIGWARN_RUBY_WRONG_NAME) module_traits;		/* Ruby, wrong class name */
 5
 6%inline %{ 
 7  enum Polarization { UnaryPolarization, BinaryPolarization }; 
 8  struct interface_traits 
 9  { 
10    static const Polarization polarization = UnaryPolarization; 
11  }; 
12  template <Polarization P> 
13    struct Interface_
14    { 
15    }; 
16 
17  typedef unsigned int Category; 
18  struct module_traits 
19  { 
20    static const Category category = 1; 
21  }; 
22  
23  template <Category C> 
24    struct Module 
25    { 
26    }; 
27%} 
28 
29%template(Interface_UP) Interface_<UnaryPolarization>; 
30%template(Module_1) Module<1>; 
31 
32%inline %{ 
33  struct ExtInterface1 :  
34    Interface_<UnaryPolarization> // works 
35  { 
36  }; 
37  struct ExtInterface2 : 
38    Interface_<interface_traits::polarization>  // doesn't work 
39  { 
40  }; 
41  struct ExtModule1 : 
42    Module<1>         // works 
43  { 
44  }; 
45  struct ExtModule2 : 
46    Module<module_traits::category>    // doesn't work 
47  { 
48  }; 
49%} 
50