summaryrefslogtreecommitdiff
path: root/otk/wrap/ustring.i
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-05 10:39:14 +0000
committerDana Jansens <danakj@orodu.net>2003-02-05 10:39:14 +0000
commit423367e8cda46f9d0f69932f617054cc15702aeb (patch)
tree6ea6f46496246767adf5f488307f4c6427f21a97 /otk/wrap/ustring.i
parenta5a712f9ae652e500c81b42db548d213bde4712e (diff)
move the otk wrapper stuff into its own dir
Diffstat (limited to 'otk/wrap/ustring.i')
-rw-r--r--otk/wrap/ustring.i40
1 files changed, 40 insertions, 0 deletions
diff --git a/otk/wrap/ustring.i b/otk/wrap/ustring.i
new file mode 100644
index 00000000..d693e7dc
--- /dev/null
+++ b/otk/wrap/ustring.i
@@ -0,0 +1,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());
+ }
+
+}