[C++-sig] Simple rvalue_from_python_data usage example availabe?
franke at ableton.com
Sat Jun 14 03:21:59 CEST 2003
I'm currently trying to implement a bidirectional conversion
from Python unicode strings to our library's own unicode string
type, called 'TString'.
The 'TString -> Python Unicode Object' part was easy. Just had to
register a to_python_converter as shown in the manual examples.
Unfortunately, being a BPL newbie, I'm unable to figure out the
'Python Unicode Object -> TString' part. At least I have spotted
the rvalue_from_python_data mechanism which I believe is the right
one for the job.
But I'm clueless how to set it up for correct usage. I've checked
the reference to the "scitbx" in the FAQ, but there it's done in a
totally generic way, from which I'm too stupid to derive my special
Dear SIG, can you help me? This is what I have so far:
static PyObject* convert(const TString& s)
return PyUnicode_FromWideChar(s.FirstChar(), s.Length());
static TString extract(PyObject* o)
// Test string without any actual PyUnicode_Type instance access
rvalue_from_python_data<PythonUnicodeToTString>( ??? );
// What to place here? ^^^^^^^
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cplusplus-sig