From 4534151926c4f3887ba9e37ae67df16f1eb039ef Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 17 Feb 2003 21:25:52 +0000 Subject: split up the otk stuff into separate files. wrap otk::Property properly with typemaps so that it is usable. wrap otk::Timer properly so that you can use it with a python callback --- wrap/otk_ustring.i | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 wrap/otk_ustring.i (limited to 'wrap/otk_ustring.i') diff --git a/wrap/otk_ustring.i b/wrap/otk_ustring.i new file mode 100644 index 00000000..fbd0cbfa --- /dev/null +++ b/wrap/otk_ustring.i @@ -0,0 +1,40 @@ +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- + +%module otk_rendertexture + +%{ +#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, "string 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, "string expected"); + } + } + + %typemap(out) ustring { + $result = PyString_FromString($1.c_str()); + } + + %typemap(out) const ustring & { + $result = PyString_FromString($1->c_str()); + } +} -- cgit v1.2.3