PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 43 lines | 18 code | 8 blank | 17 comment | 0 complexity | 717c2021734d5bc9af050d1ae151ce34 MD5 | raw file
 1%module enum_template
 2
 3%warnfilter(SWIGWARN_RUBY_WRONG_NAME) eTest0;        /* Ruby, wrong class name */
 4%warnfilter(SWIGWARN_RUBY_WRONG_NAME) eTest1;        /* Ruby, wrong class name */
 5%warnfilter(SWIGWARN_RUBY_WRONG_NAME) eTest2;        /* Ruby, wrong class name */
 6
 7/*
 8From bug report 992329:
 9
10In Python I see
11
12>>> import enum_template
13>>> enum_template.MakeETest()
14'_60561408_p_ETest'
15>>> enum_template.TakeETest(0)
16Traceback (most recent call last):
17File "<stdin>", line 1, in ?
18TypeError: Expected a pointer
19
20Without the %template, things work fine: the first
21function call returns an integer, and the second
22succeeds.
23*/
24
25%inline %{
26
27enum ETest
28{
29eTest0,
30eTest1,
31eTest2
32};
33
34void TakeETest(ETest test) {}
35ETest MakeETest(void) {return eTest1;}
36
37template<class T> class CTempl
38{
39};
40
41%}
42
43%template(CTempl_ETest) CTempl<ETest>;