diff options
Diffstat (limited to 'doc/typesystemvariables.rst')
-rw-r--r-- | doc/typesystemvariables.rst | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/doc/typesystemvariables.rst b/doc/typesystemvariables.rst index 0a3da0bcb..26f05477d 100644 --- a/doc/typesystemvariables.rst +++ b/doc/typesystemvariables.rst @@ -21,13 +21,61 @@ Variables Replaced by the name of a C++ argument in the position indicated by ``#``. The argument counting starts with ``%1``, since ``%0`` represents the return - variable name. + variable name. If the number indicates a variable that was removed in the + type system description, but there is a default value for it, this value will + be used. Consider this example: + + .. code-block:: c++ + + void argRemoval(int a0, int a1 = 123); + + + .. code-block:: xml + + <modify-function signature="argRemoval(int, int)"> + <modify-argument index="2"> + <remove-argument/> + </modify-argument> + </modify-function> + + The ``%1`` will be replaced by the C++ argument name, and ``%2`` will get the + value ``123``. **%ARGUMENT_NAMES** - Replaced by a comma separated list with the names of all arguments that were - not removed on the type system description for the method/function. + Replaced by a comma separated list with the names of all C++ arguments that + were not removed on the type system description for the method/function. If + the removed argument has a default value (original or provided in the type + system), this value will be inserted in the argument list. + + Take the following method and related type system description as an example: + + .. code-block:: c++ + + void argRemoval(int a0, Point a1 = Point(1, 2), bool a2 = true, Point a3 = Point(3, 4), int a4 = 56); + + + .. code-block:: xml + + <modify-function signature="argRemoval(int, Point, bool, Point, int)"> + <modify-argument index="2"> + <remove-argument/> + <replace-default-expression with="Point(6, 9)"/> + </modify-argument> + <modify-argument index="4"> + <remove-argument/> + </modify-argument> + </modify-function> + + As seen on the XML description, the function's ``a1`` and ``a3`` arguments + were removed. If any ``inject-code`` for this function uses ``%ARGUMENT_NAMES`` + the resulting list will be the equivalent of using individual argument type + system variables this way: + + .. code-block:: c++ + + %1, Point(6, 9), %3, Point(3, 4), %5 **%CONVERTTOPYTHON[CPPTYPE]** |