/tags/rel-1-3-15/SWIG/Examples/test-suite/constover.i
Swig | 38 lines | 30 code | 8 blank | 0 comment | 0 complexity | d366286e031eb40d1a1f76ca849592b7 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1// This test checks SWIG's code generation for C++ functions
2// and methods that differ only in constness.
3
4%module constover
5
6%rename(test_pconst) test(const char *);
7%rename(test_constm) test(char *) const;
8%rename(test_pconstm) test(const char *) const;
9
10%inline %{
11
12char *test(char *x) {
13 return (char *) "test";
14}
15
16char *test(const char *x) {
17 return (char *) "test_pconst";
18}
19
20 class Foo {
21 public:
22 Foo() { }
23 char *test(char *x) {
24 return (char *) "test";
25 }
26 char *test(const char *x) {
27 return (char *) "test_pconst";
28 }
29 char *test(char *x) const {
30 return (char *) "test_constmethod";
31 }
32 char *test(const char *x) const {
33 return (char *) "test_pconstmethod";
34 }
35 };
36
37%}
38