diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 17:50:30 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 18:21:41 +0200 |
commit | 980715d46755fb670fd7b57529fa498340910105 (patch) | |
tree | 09e979332b9b91b15d8e4c104dd05087205a00ab /sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst | |
parent | b68f2b96866c0422c2c02c9ca93874c0081d857b (diff) |
move everying into sources/shiboken2 (dev edition)
in preparation for a subtree merge.
this should not be necessary to do in a separate commit, but git is a
tad stupid about following history correctly without it.
Diffstat (limited to 'sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst')
-rw-r--r-- | sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst b/sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst new file mode 100644 index 000000000..31b155c5a --- /dev/null +++ b/sources/shiboken2/ApiExtractor/doc/typesystem_templates.rst @@ -0,0 +1,55 @@ +.. _using-code-templates: + +Using Code Templates +-------------------- + +template +^^^^^^^^ + + The template node registers a template that can be used to avoid duplicate + code when extending the generated code, and it is a child of the typesystem + node. + + .. code-block:: xml + + <typesystem> + <template name="my_template"> + // the code + </template> + </typesystem> + + Use the insert-template node to insert the template code (identified by the + template's ``name`` attribute) into the generated code base. + + +insert-template +^^^^^^^^^^^^^^^ + + The insert-template node includes the code template identified by the name + attribute, and it can be a child of the inject-code, conversion-rule, template, + custom-constructor and custom-destructor nodes. + + .. code-block:: xml + + <inject-code class="target" position="beginning"> + <insert-template name="my_template" /> + </inject-code> + + Use the replace node to modify the template code. + + +replace +^^^^^^^ + + The replace node allows you to modify template code before inserting it into + the generated code, and it can be a child of the insert-template node. + + .. code-block:: xml + + <insert-template name="my_template"> + <replace from="..." to="..." /> + </insert-template> + + This node will replace the attribute ``from`` with the value pointed by + ``to``. + |