summaryrefslogtreecommitdiff
path: root/Examples/test-suite/typemap_namespace.i
blob: 1fd7ce71874620f09e26d984493dd32c62196b11 (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
53
54
55
56
57
58
59
%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
#ifdef SWIGD
    %typemap(ctype) Str1 * = char *;
    %typemap(imtype) Str1 * = char *;
    %typemap(dtype) Str1 * = char *;
    %typemap(din) Str1 * = char *;
    %typemap(dout) Str1 * = char *;
#endif
    %typemap(in) Str1 * = char *;
#if !(defined(SWIGCSHARP) || defined(SWIGLUA) || defined(SWIGPHP) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGGO) || defined(SWIGD))
    %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;
    }
}
%}