diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-10-29 18:26:23 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-10-29 18:27:00 -0200 |
commit | 64f7ae3334171168ff803f339d55a179a6e06001 (patch) | |
tree | a7fe860a2dd20845c9d8d2654ae96fe4501f4315 /doc/typesystem_arguments.rst | |
parent | 4329d974ec98b74b74358718cf17055a00672e2b (diff) |
Updated documentation of conversion-rule for argument-modification.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'doc/typesystem_arguments.rst')
-rw-r--r-- | doc/typesystem_arguments.rst | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/typesystem_arguments.rst b/doc/typesystem_arguments.rst index b3f3e0b59..21e2574a8 100644 --- a/doc/typesystem_arguments.rst +++ b/doc/typesystem_arguments.rst @@ -3,6 +3,39 @@ Modifying Arguments ------------------- +.. _conversion-rule: + +conversion-rule +^^^^^^^^^^^^^^^ + + The conversion-rule node allows you to write customized code to convert + the given argument between the target language and C++, and it is a child of the modify-argument node. + + .. code-block:: xml + + <modify-argument ...> + <conversion-rule class="target | native"> + // the code + </conversion-rule> + </modify-argument> + + This node is typically used in combination with the replace-type and + remove-argument nodes. The given code is used instead of the generator's + conversion code. + + Writing %N in the code (where N is a number), will insert the name of the + nth argument. Alternatively, %in and %out which will be replaced with the + name of the conversion's input and output variable, respectively. Note the + output variable must be declared explicitly, for example: + + .. code-block:: xml + + <conversion-rule class="native"> + bool %out = (bool) %in; + </conversion-rule> + + .. note:: You can also use the conversion-rule node to specify :ref:`a conversion code which will be used instead of the generator's conversion code everywhere for a given type <conversion-rule-on-types>`. + remove-argument ^^^^^^^^^^^^^^^ |