[pygccxml-commit] source/pyplusplus/experimental declwrapper.py,1.5,1.6
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <mb...@us...> - 2006-03-20 10:52:59
|
Update of /cvsroot/pygccxml/source/pyplusplus/experimental In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6427 Modified Files: declwrapper.py Log Message: Modified the cdef() method so that it can also be called with only one argument. In this case, this argument is not quoted because it is supposed to be a valid Boost.Python construct. This can be used to wrap constructors or operators manually. Index: declwrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/experimental/declwrapper.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** declwrapper.py 20 Mar 2006 09:32:24 -0000 1.5 --- declwrapper.py 20 Mar 2006 10:52:55 -0000 1.6 *************** *** 235,239 **** # def ! def cdef(self, name, fn, *args): """Apply a raw def() statement. --- 235,239 ---- # def ! def cdef(self, name, fn=None, *args): """Apply a raw def() statement. *************** *** 245,252 **** It is up to the user to ensure that the C/C++ function cspam is declared and implemented somewhere. ! @param name: Name of the Python method @type name: str ! @param fn: Name of the C++ function that implements the method @type fn: str @param args: There can be up to three additional arguments in any order: A doc string, the call policies and the keywords. --- 245,257 ---- It is up to the user to ensure that the C/C++ function cspam is declared and implemented somewhere. + + If fn is None, the string name is not quoted. You can use this form + to wrap constructors or operators. Example: ! Class("Foo").cdef("bp::init< const MFoo& >()") ! ! @param name: Name of the Python method or a valid Boost.Python construct @type name: str ! @param fn: Name of the C++ function that implements the method or None @type fn: str @param args: There can be up to three additional arguments in any order: A doc string, the call policies and the keywords. *************** *** 256,260 **** self._checkLock() doc,policies,keywords = self._parseDefArgs(args) ! args = ['"%s"'%name, fn] if policies!=None: pass # todo --- 261,268 ---- self._checkLock() doc,policies,keywords = self._parseDefArgs(args) ! if fn==None: ! args = ['%s'%name] ! else: ! args = ['"%s"'%name, fn] if policies!=None: pass # todo |