|
RE: Converting CString to/from std::string: msg#00265python.c++
-----Original Message----- From: Ralf W. Grosse-Kunstleve [mailto:rwgk@xxxxxxxxx] Sent: 27. mai 2003 08:46 To: c++-sig@xxxxxxxxxx Subject: Re: ÆC++-sigÅ Converting CString to/from std::string --- Nikolai Kirsebom <nikolai@xxxxxxxx> wrote: > I have a rather large set of C++ classes I want to make accessible > (initially only parts of some of the classes) from Python. I cannot > change the classes as they are defined and used throughout a large > application. Some of the methods take CString as parameters and others > return CString values. > > Does anyone have suggestion on how I can convert these parameters so > that I can use Boost.Python to generate the wrapper code. What do you want your CStrings to be in Python? Regular Python strings? If you think "yes" remind yourself that Python strings are immutable. I.e. if you have function signatures involving non-const references or pointers to CString as arguments or return values the mapping from C++ CStrings to Python strings will not work very well. More depending on your response. Ralf Some time ago I made a 'socket based' system (using BISON/FLEX for parsing) where I expose C++ objects to python. In this system CStrings are regular Python strings. So as an example I can write: --------------------------------------------- C++: class IF { CString MenuText; CString GetHelpText(); int SetHelpText(CString s); }; In Python: o = IF() # Behind the 'curtains' create a 'link' to a C++ object print o.MenuText s = o.GetHelpText(o.MenuText + "some text") ---------------------------------------------- So I would like something similar. I'm very new to the Boost system and do not really have experience in C++ Template development so I find the Reference Manual somewhat difficult to understand. This may explain if I request 'dead easy' or 'impossible' things. Thanks for any help Nikolai |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Chat rooms: 00265, David Abrahams |
|---|---|
| Next by Date: | Re: instantiating python objects within C++: 00265, David Abrahams |
| Previous by Thread: | Re: Converting CString to/from std::stringi: 00265, Ralf W. Grosse-Kunstleve |
| Next by Thread: | RE: Converting CString to/from std::string: 00265, Ralf W. Grosse-Kunstleve |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |