]> Dogcows Code - chaz/openbox/blob - wrap/ustring.i
change the exception message
[chaz/openbox] / wrap / ustring.i
1 // SWIG typemaps for otk::ustring
2
3 %{
4 #include "otk/ustring.hh"
5 %}
6
7 namespace otk {
8
9 class ustring;
10
11 /* Overloading check */
12
13 %typemap(typecheck) ustring = char *;
14 %typemap(typecheck) const ustring & = char *;
15
16 %typemap(in) ustring {
17 if (PyString_Check($input))
18 $1 = otk::ustring(PyString_AsString($input));
19 else
20 SWIG_exception(SWIG_TypeError, "string expected");
21 }
22
23 %typemap(in) const ustring & (otk::ustring temp) {
24 if (PyString_Check($input)) {
25 temp = otk::ustring(PyString_AsString($input));
26 $1 = &temp;
27 } else {
28 SWIG_exception(SWIG_TypeError, "string expected");
29 }
30 }
31
32 %typemap(out) ustring {
33 $result = PyString_FromString($1.c_str());
34 }
35
36 %typemap(out) const ustring & {
37 $result = PyString_FromString($1->c_str());
38 }
39
40 }
This page took 0.038845 seconds and 4 git commands to generate.