summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-09-06 12:40:52 +0200
committerJuergen Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-11-30 10:01:20 +0100
commitcc6023a2741478d7d764ea76178372cace42446b (patch)
tree6c6fcf4c2a16916e43a6a26734193e011b5ac432
parent15bdd1ab21b3c50ab8bb52a9d287fd428d0f382e (diff)
downloadqtivi-qface-cc6023a2741478d7d764ea76178372cace42446b.tar.gz
Update all template files to the new grammar and tests
-rw-r--r--generator/csv/templates/packages.csv4
-rw-r--r--generator/qfacegen/templates/document.qface8
-rw-r--r--generator/qtcpp/qtcpp.py8
-rw-r--r--generator/qtcpp/templates/plugin.cpp8
-rw-r--r--generator/qtcpp/templates/project.pri8
-rw-r--r--generator/qtcpp/templates/service.cpp16
-rw-r--r--generator/qtcpp/templates/service.h12
-rw-r--r--input/entertainment.tuner.Tuner.qface2
-rw-r--r--input/test.qface2
-rw-r--r--input/vehicle.climate.ClimateControl.qface4
-rw-r--r--tests/in/climate.qface4
-rw-r--r--tests/in/test.qface2
-rw-r--r--tests/in/tuner.qface2
-rw-r--r--tests/test_climate.py6
-rw-r--r--tests/test_generator.py6
-rw-r--r--tests/test_parser.py24
16 files changed, 58 insertions, 58 deletions
diff --git a/generator/csv/templates/packages.csv b/generator/csv/templates/packages.csv
index dc799e3..f69bad6 100644
--- a/generator/csv/templates/packages.csv
+++ b/generator/csv/templates/packages.csv
@@ -1,7 +1,7 @@
{# Copyright (c) Pelagicore AG 2016 #}
{% for package in system.packages %}
- {%- for service in package.services -%}
- SERVICE, {{package}}.{{service}}
+ {%- for interface in package.interfaces -%}
+ SERVICE, {{package}}.{{interface}}
{% endfor -%}
{%- for struct in package.structs -%}
STRUCT , {{package}}.{{struct}}
diff --git a/generator/qfacegen/templates/document.qface b/generator/qfacegen/templates/document.qface
index fa38985..645eac7 100644
--- a/generator/qfacegen/templates/document.qface
+++ b/generator/qfacegen/templates/document.qface
@@ -1,16 +1,16 @@
{# Copyright (c) Pelagicore AG 2016 #}
package {{package}}{{counter}};
-{%for service in package.services %}
-service {{service}} {
- {% for attribute in service.attributes %}
+{%for interface in package.interfaces %}
+interface {{interface}} {
+ {% for attribute in interface.attributes %}
{%+ if attribute.is_readonly %}readonly {% endif %}
{%if attribute.type.is_list or attribute.type.is_model -%}
{{attribute.type}}<{{attribute.type.nested}}> {{attribute}};
{% else %}{{attribute.type}} {{attribute}};
{% endif %}
{% endfor %}
- {% for operation in service.operations %}
+ {% for operation in interface.operations %}
{{operation.type}} {{operation}}();
{% endfor %}
}
diff --git a/generator/qtcpp/qtcpp.py b/generator/qtcpp/qtcpp.py
index e5381fc..6e5f5e3 100644
--- a/generator/qtcpp/qtcpp.py
+++ b/generator/qtcpp/qtcpp.py
@@ -67,10 +67,10 @@ def generate(input, output):
generator.write('{{path}}/{{package|lower}}.pro', 'project.pro', ctx)
generator.write('{{path}}/{{module|lower}}module.h', 'module.h', ctx)
generator.write('{{path}}/{{module|lower}}module.cpp', 'module.cpp', ctx)
- for service in package.services:
- ctx.update({'service': service})
- generator.write('{{path}}/{{service|lower}}.h', 'service.h', ctx)
- generator.write('{{path}}/{{service|lower}}.cpp', 'service.cpp', ctx)
+ for interface in package.interfaces:
+ ctx.update({'interface': interface})
+ generator.write('{{path}}/{{interface|lower}}.h', 'interface.h', ctx)
+ generator.write('{{path}}/{{interface|lower}}.cpp', 'interface.cpp', ctx)
for struct in package.structs:
ctx.update({'struct': struct})
generator.write('{{path}}/{{struct|lower}}.h', 'struct.h', ctx)
diff --git a/generator/qtcpp/templates/plugin.cpp b/generator/qtcpp/templates/plugin.cpp
index 77f8b17..cdc3533 100644
--- a/generator/qtcpp/templates/plugin.cpp
+++ b/generator/qtcpp/templates/plugin.cpp
@@ -12,16 +12,16 @@
#include "{{module|lower}}.h"
-{% for service in package.services %}
-#include "{{service|lower}}.h"
+{% for interface in package.interfaces %}
+#include "{{interface|lower}}.h"
{% endfor %}
void Plugin::registerTypes(const char *uri)
{
Qml{{module}}::registerTypes();
// @uri {{package|lower}}
- {% for service in package.services %}
+ {% for interface in package.interfaces %}
Qml{{module}}::registerQmlTypes(uri, 1, 0);
- Qml{{service}}::registerQmlTypes(uri, 1, 0);
+ Qml{{interface}}::registerQmlTypes(uri, 1, 0);
{% endfor %}
}
diff --git a/generator/qtcpp/templates/project.pri b/generator/qtcpp/templates/project.pri
index 638e78f..52ffa76 100644
--- a/generator/qtcpp/templates/project.pri
+++ b/generator/qtcpp/templates/project.pri
@@ -11,8 +11,8 @@ CONFIG += c++11
HEADERS += \
{{module(package)|lower}}.h \
-{% for service in package.services %}
- {{service|lower}}.h \
+{% for interface in package.interfaces %}
+ {{interface|lower}}.h \
{% endfor %}
{% for struct in package.structs %}
{{struct|lower}}.h \
@@ -22,8 +22,8 @@ HEADERS += \
SOURCES += \
{{module(package)|lower}}.cpp \
-{% for service in package.services %}
- {{service|lower}}.cpp \
+{% for interface in package.interfaces %}
+ {{interface|lower}}.cpp \
{% endfor %}
{% for struct in package.structs %}
{{struct|lower}}.cpp \
diff --git a/generator/qtcpp/templates/service.cpp b/generator/qtcpp/templates/service.cpp
index 91f070f..9a601e8 100644
--- a/generator/qtcpp/templates/service.cpp
+++ b/generator/qtcpp/templates/service.cpp
@@ -4,23 +4,23 @@
** Do not edit! All changes made to it will be lost.
****************************************************************************/
-#include <{{service|lower}}.h>
+#include <{{interface|lower}}.h>
#include <QtQml>
-{% set class = 'Qml{0}'.format(service) %}
+{% set class = 'Qml{0}'.format(interface) %}
-QObject* {{service|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
+QObject* {{interface|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
{
return new {{class}}();
}
-{{service.comment}}
+{{interface.comment}}
{{class}}::{{class}}(QObject *parent)
: QObject(parent)
{
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
{% if attribute.type.is_model %}
m_{{attribute}} = new {{attribute.type.nested}}Model(this);
{% endif %}
@@ -29,10 +29,10 @@ QObject* {{service|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion)
{
- qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{service}}", {{service|lower}}_singletontype_provider);
+ qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}", {{interface|lower}}_singletontype_provider);
}
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
void {{class}}::set{{attribute|upperfirst}}({{ attribute|parameterType }})
{
if(m_{{attribute}} == {{attribute}}) {
@@ -49,7 +49,7 @@ void {{class}}::set{{attribute|upperfirst}}({{ attribute|parameterType }})
{% endfor %}
-{% for operation in service.operations %}
+{% for operation in interface.operations %}
{{operation.comment}}
{{operation.type}} {{class}}::{{operation}}()
{
diff --git a/generator/qtcpp/templates/service.h b/generator/qtcpp/templates/service.h
index 7ba194f..7b39dfc 100644
--- a/generator/qtcpp/templates/service.h
+++ b/generator/qtcpp/templates/service.h
@@ -1,7 +1,7 @@
{# Copyright (c) Pelagicore AG 2016 #}
{% from 'helper.tpl' import module %}
{% set module = module(package) %}
-{% set class = 'Qml{0}'.format(service) %}
+{% set class = 'Qml{0}'.format(interface) %}
/****************************************************************************
** This is an auto-generated file.
** Do not edit! All changes made to it will be lost.
@@ -16,7 +16,7 @@
class {{class}} : public QObject
{
Q_OBJECT
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
Q_PROPERTY({{attribute|returnType}} {{attribute}} READ {{attribute}} {%if not attribute.is_readonly%}WRITE set{{attribute|upperfirst}} {%endif%}NOTIFY {{attribute}}Changed)
{% endfor %}
@@ -26,23 +26,23 @@ public:
static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0);
public Q_SLOTS:
-{% for operation in service.operations %}
+{% for operation in interface.operations %}
{{operation|returnType}} {{operation}}();
{% endfor %}
public:
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
void set{{attribute|upperfirst}}({{ attribute|parameterType }});
{{attribute|returnType}} {{attribute}}() const;
{% endfor %}
Q_SIGNALS:
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
void {{attribute}}Changed({{attribute|parameterType}});
{% endfor %}
private:
-{% for attribute in service.attributes %}
+{% for attribute in interface.attributes %}
{{attribute|returnType}} m_{{attribute}};
{% endfor %}
};
diff --git a/input/entertainment.tuner.Tuner.qface b/input/entertainment.tuner.Tuner.qface
index 54a6381..4b37f3a 100644
--- a/input/entertainment.tuner.Tuner.qface
+++ b/input/entertainment.tuner.Tuner.qface
@@ -1,7 +1,7 @@
package entertainment.tuner;
/*! Service Tuner */
-service Tuner {
+interface Tuner {
/*! attribute currentStation */
readonly Station currentStation;
/*! operation nextStation */
diff --git a/input/test.qface b/input/test.qface
index 399bb6d..f1c90b9 100644
--- a/input/test.qface
+++ b/input/test.qface
@@ -1,6 +1,6 @@
package com.pelagicore.test;
-service ContactService {
+interface ContactService {
State state;
int intValue;
readonly string stringValue;
diff --git a/input/vehicle.climate.ClimateControl.qface b/input/vehicle.climate.ClimateControl.qface
index d3b6091..dba8df4 100644
--- a/input/vehicle.climate.ClimateControl.qface
+++ b/input/vehicle.climate.ClimateControl.qface
@@ -4,7 +4,7 @@ package vehicle.climate;
* The ClimateControl provides a QML interface to the climate control
* of the vehicle.
*/
-service ClimateControl {
+interface ClimateControl {
/*!
* Value is true if the air conditioning is enabled.
*/
@@ -106,6 +106,6 @@ enum ClimateMode {
AutoClimate = 0x2
}
-service Extra {
+interface Extra {
}
diff --git a/tests/in/climate.qface b/tests/in/climate.qface
index d3b6091..dba8df4 100644
--- a/tests/in/climate.qface
+++ b/tests/in/climate.qface
@@ -4,7 +4,7 @@ package vehicle.climate;
* The ClimateControl provides a QML interface to the climate control
* of the vehicle.
*/
-service ClimateControl {
+interface ClimateControl {
/*!
* Value is true if the air conditioning is enabled.
*/
@@ -106,6 +106,6 @@ enum ClimateMode {
AutoClimate = 0x2
}
-service Extra {
+interface Extra {
}
diff --git a/tests/in/test.qface b/tests/in/test.qface
index 399bb6d..f1c90b9 100644
--- a/tests/in/test.qface
+++ b/tests/in/test.qface
@@ -1,6 +1,6 @@
package com.pelagicore.test;
-service ContactService {
+interface ContactService {
State state;
int intValue;
readonly string stringValue;
diff --git a/tests/in/tuner.qface b/tests/in/tuner.qface
index 54a6381..4b37f3a 100644
--- a/tests/in/tuner.qface
+++ b/tests/in/tuner.qface
@@ -1,7 +1,7 @@
package entertainment.tuner;
/*! Service Tuner */
-service Tuner {
+interface Tuner {
/*! attribute currentStation */
readonly Station currentStation;
/*! operation nextStation */
diff --git a/tests/test_climate.py b/tests/test_climate.py
index ec660f3..9468695 100644
--- a/tests/test_climate.py
+++ b/tests/test_climate.py
@@ -17,10 +17,10 @@ def load_system():
return FileSystem.parse_document(path)
-def test_service():
+def test_interface():
system = load_system()
- service = system.lookup_service('vehicle.climate.ClimateControl')
- assert service.name == 'ClimateControl'
+ interface = system.lookup_interface('vehicle.climate.ClimateControl')
+ assert interface.name == 'ClimateControl'
diff --git a/tests/test_generator.py b/tests/test_generator.py
index c346753..62c9fa6 100644
--- a/tests/test_generator.py
+++ b/tests/test_generator.py
@@ -26,12 +26,12 @@ def test_gen_package():
assert text == 'entertainment.tuner'
-def test_gen_service():
+def test_gen_interface():
system = loadSystem()
gen = Generator(searchpath='tests/templates')
template = """
- {%- for service in package.services -%}
- {{service}}
+ {%- for interface in package.interfaces -%}
+ {{interface}}
{%- endfor -%}
"""
package = system.lookup_package('entertainment.tuner')
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 0f5c1ee..da378ee 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -35,19 +35,19 @@ def test_package():
assert package in system.packages
-def test_service():
+def test_interface():
system = loadTuner()
package = system.lookup_package('entertainment.tuner')
- service = system.lookup_service('entertainment.tuner.Tuner')
- assert service in package.services
- assert service.comment == '/*! Service Tuner */'
+ interface = system.lookup_interface('entertainment.tuner.Tuner')
+ assert interface in package.interfaces
+ assert interface.comment == '/*! Service Tuner */'
def test_attribute():
system = loadTuner()
- service = system.lookup_service('entertainment.tuner.Tuner')
+ interface = system.lookup_interface('entertainment.tuner.Tuner')
package = system.lookup_package('entertainment.tuner')
- attr = service.attributeMap['currentStation']
+ attr = interface.attributeMap['currentStation']
assert attr.type.name == 'Station'
assert attr.package == package
assert attr.type.qualifiedName == 'entertainment.tuner.Station'
@@ -86,14 +86,14 @@ def test_flag():
def test_list():
system = loadTuner()
- service = system.lookup_service('entertainment.tuner.Tuner')
- attr = service.attributeMap['primitiveList']
+ interface = system.lookup_interface('entertainment.tuner.Tuner')
+ attr = interface.attributeMap['primitiveList']
assert attr.type.name == 'list'
assert attr.type.is_list is True
assert attr.type.nested.is_primitive
assert attr.type.nested.name == 'int'
- attr = service.attributeMap['complexList']
+ attr = interface.attributeMap['complexList']
assert attr.type.name == 'list'
assert attr.type.is_list is True
assert attr.type.nested.is_complex
@@ -102,14 +102,14 @@ def test_list():
def test_model():
system = loadTuner()
- service = system.lookup_service('entertainment.tuner.Tuner')
- attr = service.attributeMap['primitiveModel']
+ interface = system.lookup_interface('entertainment.tuner.Tuner')
+ attr = interface.attributeMap['primitiveModel']
assert attr.type.name == 'model'
assert attr.type.is_model is True
assert attr.type.nested.is_primitive
assert attr.type.nested.name == 'int'
- attr = service.attributeMap['complexModel']
+ attr = interface.attributeMap['complexModel']
assert attr.type.name == 'model'
assert attr.type.is_model is True
assert attr.type.nested.is_complex