aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-11-07 12:26:26 +0100
committerRobert Griebl <robert.griebl@pelagicore.com>2017-11-09 22:53:45 +0000
commit431de0e66091d263b8927b9a413bc2005b1aa426 (patch)
treea7f2e4b7359737f6cd5b6ce14ec5ccbf2e80a6a0
parent4da1fec67cfaa36baa7f5e009a6e0364f63cc9e2 (diff)
doc: Add documentation for all supported filters
Change-Id: Iadf7f50892d1d066b815403336491e0920853d60 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r--src/doc/qtivi/src/filter-reference.qdoc190
-rw-r--r--src/doc/qtivi/src/generator-usage.qdoc4
-rw-r--r--src/doc/qtivi/src/ivigenerator.qdoc1
-rw-r--r--src/doc/qtivi/src/template-syntax.qdoc2
4 files changed, 194 insertions, 3 deletions
diff --git a/src/doc/qtivi/src/filter-reference.qdoc b/src/doc/qtivi/src/filter-reference.qdoc
new file mode 100644
index 0000000..eb6305a
--- /dev/null
+++ b/src/doc/qtivi/src/filter-reference.qdoc
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the QtIvi module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+\page filter-reference.html
+\title Filter Reference
+\previouspage Autogenerator Usage
+\nextpage Qmake Integration
+
+In addition to the built-in Jinja filters listed \l
+{http://jinja.pocoo.org/docs/2.9/templates/#list-of-builtin-filters} {here}, the following
+additional features are implemented in the ivigenerator.
+
+\target return_type(symbol)
+\target return_type()
+\section1 return_type(symbol)
+
+Returns the C++ type for the passed symbol.
+
+E.g. QString for a symbol of type "string".
+
+\target parameter_type(symbol)
+\section1 parameter_type(symbol)
+
+Return the C++ type for the passed symbol. This returns the same type as return_type(), but already
+prepared to be used as a parameter for methods.
+
+E.g. "const QString &<name>" for a symbol of type "string"
+
+\target getter_name(symbol)
+\section1 getter_name(symbol)
+
+Returns the getter name of the property, if defined by the \c @getter_name annotation. Otherwise
+retuns the passed symbol.
+
+\target setter_name(symbol)
+\section1 setter_name(symbol)
+
+Returns the setter name of the property, if defined by the \c @setter_name annotation. Otherwise
+retuns the passed symbol.
+
+\target default_type_value(symbol)
+\section1 default_type_value(symbol)
+
+Returns the default value for the passed symbol. Models are initialized as \c nullptr
+
+\target default_value(symbol, zone="=")
+\section1 default_value(symbol, zone="=")
+
+Returns the default value for the passed symbol set by the \c @default annotation. If not set uses
+\c default_type_value instead.
+
+The zone parameter is used to identify different default values per zone.
+
+\target model_type(symbol)
+\section1 model_type(symbol)
+
+Returns the C++ class name for this model.
+
+\target flag_type(symbol)
+\section1 flag_type(symbol)
+
+Returns the name defined by the \c @type annotation for the passed flag. If this is not set, tries to
+pluralize the passed name by adding an 's' at the end.
+
+\target parse_doc(string)
+\section1 parse_doc(string)
+
+Parses the passed comment string and adds every javadoc command into its own group. Sentences
+without tag are put into the 'description' group.
+
+\badcode
+{% with doc = comments|parse_doc -%}
+{% if doc.brief %} \brief {{doc.brief}}
+{% endif %}
+
+{% if doc.description %}
+ {{doc.description}}
+{% endif %}
+{% endwith %}
+\endcode
+
+\target lowerfirst(string)
+\section1 lowerfirst(string)
+
+Only lowers the first character of the given string.
+
+\target range_low(property)
+\section1 range_low(property)
+
+Returns the minimum value for the passed property using the \c @range or \c @minimum annotations.
+
+\target range_high(property)
+\section1 range_high(property)
+
+Returns the maximum value for the passed property using the \c @range or \c @maximum annotations.
+
+\target strip_QT(string)
+\section1 strip_QT(string)
+
+Removes the 'QT' at the beginning, if the string starts with it.
+
+\target domain_values(symbol)
+\section1 domain_values(symbol)
+
+Returns the domain values for the passed property using the \c @domain annotation.
+
+\target enum_value(value, module_name)
+\section1 enum_value(value, module_name)
+
+Returns the fully qualified C++ name of the given value. The passed module_name is used as C++ class
+name containing the enum.
+
+Also supports passing '|' connected values.
+
+\target tag_by_path(symbol, path, default_value=False)
+\section1 tag_by_path(symbol, path, default_value=False)
+
+Find the tag given by its full path in the object hierarchy, like
+\c property.config_sim.zones.right. If some parts of the path are missing, return \c None.
+
+\target conf_sim_tag(symbol, path, default_value=False)
+\section1 conf_sim_tag(symbol, path, default_value=False)
+
+Find the tag, given by its path, located under the "config_simulator" sub-object. Returns \c None,
+if parts of the path are missing.
+
+\target jsonify(obj)
+\section1 jsonify(obj)
+
+Returns a JSON representation of the given obj.
+
+\target has_domains(properties)
+\section1 has_domains(properties)
+
+Returns \c true if any of the given properties has \c @range or \c @domain annotations.
+
+\target json_domain(properties)
+\section1 json_domain(properties)
+
+Returns the property domains for the given properties formated in JSON.
+
+\target qml_type(interface)
+\section1 qml_type(interface)
+
+Returns the name of the interface for use in QML. This name is defined by the \c @qml_type
+annotation. This annotation is optional: if not provided, the interface name is used.
+
+\target qml_control(symbol, backend_obj)
+\section1 qml_control(symbol, backend_obj)
+
+Returns the QML code for the control (or group of controls) to represent the editing UI for the
+passed symbol.
+
+\target qml_binding_property(symbol)
+\section1 qml_binding_property(symbol)
+
+Returns the name of the property of the QML control to be bound with.
+
+E.g. "value" for a Slider and "checked" for a CheckBox.
+
+\target qml_control_signal_parameters(symbol)
+\section1 qml_control_signal_parameters(symbol)
+
+Returns the parameters for calling the signal using the values from the UI controls.
+*/
+
diff --git a/src/doc/qtivi/src/generator-usage.qdoc b/src/doc/qtivi/src/generator-usage.qdoc
index 8f48209..005e7aa 100644
--- a/src/doc/qtivi/src/generator-usage.qdoc
+++ b/src/doc/qtivi/src/generator-usage.qdoc
@@ -28,7 +28,7 @@
\page generator-usage.html
\title Autogenerator usage
\previouspage Jinja template syntax
-\nextpage Qmake Integration
+\nextpage Filter Reference
This page is about the usage of the QtIVI auto-generator.
@@ -360,6 +360,4 @@ for more information.
\li Control UI for this interface. Contains a interface to control every
property and method and log calls to signals.
\endtable
-
-
*/
diff --git a/src/doc/qtivi/src/ivigenerator.qdoc b/src/doc/qtivi/src/ivigenerator.qdoc
index 4e4b4ce..c87677f 100644
--- a/src/doc/qtivi/src/ivigenerator.qdoc
+++ b/src/doc/qtivi/src/ivigenerator.qdoc
@@ -37,6 +37,7 @@ library, which provides a generic autogeneration framework.
\li \l {QFace IDL syntax}
\li \l {Jinja template syntax}
\li \l {Autogenerator Usage}
+ \li \l {Filter Reference}
\li \l {QMake Integration}
\li \l {ivicore/qface-ivi-climate}{Generator Example}
\endlist
diff --git a/src/doc/qtivi/src/template-syntax.qdoc b/src/doc/qtivi/src/template-syntax.qdoc
index 14bfc9a..96f7b67 100644
--- a/src/doc/qtivi/src/template-syntax.qdoc
+++ b/src/doc/qtivi/src/template-syntax.qdoc
@@ -281,6 +281,8 @@ After that filter called lower first will be available from the template:
{{ var | lowerfirst }}
\endcode
+A list of all supported filters can be found in the \l{Filter Reference}.
+
\section2 Variables
Template variables are defined by the context dictionary passed to the template. Variables can be