aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-19 10:55:04 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-19 10:55:04 -0300
commitb60132d7da4dbf0c2d06b84b1cfc9586cca3eef6 (patch)
treee7b51ec483e2ae12af82d677dcd5c9912f0097a7 /doc
parent7909835691c3589364169c3c8b8e06263490cb07 (diff)
Fixed type system variable replacement for %# and %ARGUMENT_NAMES
to handle correctly removed arguments and also consider variable values with default values. The documentation was updated with the new information.
Diffstat (limited to 'doc')
-rw-r--r--doc/typesystemvariables.rst54
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]**