blob: d693e7dc1594009989f2486827283e13c2840a00 (
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
|
// SWIG typemaps for otk::ustring
%{
#include "otk/ustring.hh"
%}
namespace otk {
class ustring;
/* Overloading check */
%typemap(typecheck) ustring = char *;
%typemap(typecheck) const ustring & = char *;
%typemap(in) ustring {
if (PyString_Check($input))
$1 = otk::ustring(PyString_AsString($input));
else
SWIG_exception(SWIG_TypeError, "ustring expected");
}
%typemap(in) const ustring & (otk::ustring temp) {
if (PyString_Check($input)) {
temp = otk::ustring(PyString_AsString($input));
$1 = &temp;
} else {
SWIG_exception(SWIG_TypeError, "ustring expected");
}
}
%typemap(out) ustring {
$result = PyString_FromString($1.c_str());
}
%typemap(out) const ustring & {
$result = PyString_FromString($1->c_str());
}
}
|