[pygccxml-development] How to manage wrapper classes?
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-03-24 17:02:33
|
Hi, let me first state the problem I'm currently trying to solve. The Maya SDK defines its own string class MString which is part of my bindings. Any function that expects a string as input actually expects a MString object. But for the Python version I would also like the functions to accept regular Python strings as well (and maybe even return Python strings instead of MStrings but I leave that up for later). I tried to use the implicitly_convertible construct but it didn't work. I could get it to work with a string class that also accepts a std::string in its constructor but the MString class only accepts const char* which didn't work for me. My conclusion was that I need to write wrappers for those functions that expect an MString as input so that they also accept a str object. I'm not liking the idea of having to do that manually on each function, so I wonder if there's an easy way to specify that in my script and have pyplusplus do the real work. I think it's easy to identify the functions that need those wrappers as I can just inspect the argument list of those functions. But what then? If I could add new C++ functions to a generated source file then I think I could create automatic wrappers and use cdef to add those "overloaded" functions to the original object. But what if a function already has a wrapper generated by pyplusplus? How are they concatenated? Could pyplusplus handle that automatically? Any ideas? - Matthias - |