]> icculus.org git repositories - mikachu/openbox.git/blob - wrap/ustring.i
rm this thing
[mikachu/openbox.git] / 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, "ustring 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, "ustring 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 }