import source from 1.3.40
[external/swig.git] / Examples / test-suite / template_int_const.i
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