summaryrefslogtreecommitdiff
path: root/Examples/test-suite/typemap_namespace.i
blob: 6614e037203111c054d040ab6f79dcd62f2a6211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
%module typemap_namespace

/* Secret typedefs */
%{
namespace Foo {
   typedef char    Str1;
   typedef char    Str2;
}
%}

namespace Foo {
    struct Str1;
    struct Str2;

#ifdef SWIGCSHARP
    %typemap(ctype) Str1 * = char *;
    %typemap(imtype) Str1 * = char *;
    %typemap(cstype) Str1 * = char *;
    %typemap(csin) Str1 * = char *;
    %typemap(csout) Str1 * = char *;
#endif
#ifdef SWIGJAVA
    %typemap(jni) Str1 * = char *;
    %typemap(jtype) Str1 * = char *;
    %typemap(jstype) Str1 * = char *;
    %typemap(javain) Str1 * = char *;
    %typemap(javaout) Str1 * = char *;
#endif
#ifdef SWIGGO
    %typemap(gotype) Str1 * = char *;
#endif
    %typemap(in) Str1 * = char *;
#if !(defined(SWIGCSHARP) || defined(SWIGLUA) || defined(SWIGPHP) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGGO))
    %typemap(freearg) Str1 * = char *;
#endif
    %typemap(typecheck) Str1 * = char *;
    %apply char * { Str2 * };
}

%inline %{
namespace Foo {
    char *test1(Str1 *s) {
          return s;
    }
    char *test2(Str2 *s) {
          return s;
    }
}
%}