aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-13 10:52:19 +0100
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-13 10:52:19 +0100
commitaf48c23a7180285e4159c0235b8f1a3c09fe8309 (patch)
treefd5f31c0b6c488467e3df8124683b79f28c81aaf /examples
parent440e3fe4818100d9164491f609148fdcca8f7089 (diff)
Extracted the qtcpp builtin generator into own folder started to re-layout the examples folder.
Diffstat (limited to 'examples')
-rw-r--r--examples/echo/echo.pro (renamed from examples/qtcpp/src/echo/echo.pro)0
-rw-r--r--examples/echo/main.cpp (renamed from examples/qtcpp/src/echo/main.cpp)0
-rw-r--r--examples/examples.pro7
-rw-r--r--examples/interfaces/echo.qface (renamed from examples/qtcpp/interface/echo.qface)0
-rw-r--r--examples/plugins/plugins.pro (renamed from examples/qtcpp/src/plugins/plugins.pro)0
-rw-r--r--examples/qtcpp/generator/log.yaml18
-rwxr-xr-xexamples/qtcpp/generator/qtcpp.py67
-rw-r--r--examples/qtcpp/generator/templates/abstractinterface.cpp53
-rw-r--r--examples/qtcpp/generator/templates/abstractinterface.h51
-rw-r--r--examples/qtcpp/generator/templates/generated.pri31
-rw-r--r--examples/qtcpp/generator/templates/interface.cpp35
-rw-r--r--examples/qtcpp/generator/templates/interface.h23
-rw-r--r--examples/qtcpp/generator/templates/module.cpp46
-rw-r--r--examples/qtcpp/generator/templates/module.h40
-rw-r--r--examples/qtcpp/generator/templates/plugin.cpp26
-rw-r--r--examples/qtcpp/generator/templates/plugin.h18
-rw-r--r--examples/qtcpp/generator/templates/plugin.pro47
-rw-r--r--examples/qtcpp/generator/templates/qmldir3
-rw-r--r--examples/qtcpp/generator/templates/struct.cpp21
-rw-r--r--examples/qtcpp/generator/templates/struct.h29
-rw-r--r--examples/qtcpp/generator/templates/structmodel.cpp106
-rw-r--r--examples/qtcpp/generator/templates/structmodel.h40
-rw-r--r--examples/qtcpp/qtcpp.pro2
-rw-r--r--examples/qtcpp/src/plugins/.gitkeep0
-rw-r--r--examples/qtcpp/src/src.pro2
25 files changed, 7 insertions, 658 deletions
diff --git a/examples/qtcpp/src/echo/echo.pro b/examples/echo/echo.pro
index cfc7aef..cfc7aef 100644
--- a/examples/qtcpp/src/echo/echo.pro
+++ b/examples/echo/echo.pro
diff --git a/examples/qtcpp/src/echo/main.cpp b/examples/echo/main.cpp
index 2e15127..2e15127 100644
--- a/examples/qtcpp/src/echo/main.cpp
+++ b/examples/echo/main.cpp
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 0000000..e2ec514
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ echo \
+ plugins
+
+echo.depends = plugins
diff --git a/examples/qtcpp/interface/echo.qface b/examples/interfaces/echo.qface
index bbde9d6..bbde9d6 100644
--- a/examples/qtcpp/interface/echo.qface
+++ b/examples/interfaces/echo.qface
diff --git a/examples/qtcpp/src/plugins/plugins.pro b/examples/plugins/plugins.pro
index c945fe3..c945fe3 100644
--- a/examples/qtcpp/src/plugins/plugins.pro
+++ b/examples/plugins/plugins.pro
diff --git a/examples/qtcpp/generator/log.yaml b/examples/qtcpp/generator/log.yaml
deleted file mode 100644
index 21b5bba..0000000
--- a/examples/qtcpp/generator/log.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-version: 1
-formatters:
- simple:
- format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
-handlers:
- console:
- class: logging.StreamHandler
- level: INFO
- formatter: simple
- stream: ext://sys.stdout
-loggers:
- qface.generator:
- level: WARN
- handlers: [console]
- propagate: no
-root:
- level: DEBUG
- handlers: [console]
diff --git a/examples/qtcpp/generator/qtcpp.py b/examples/qtcpp/generator/qtcpp.py
deleted file mode 100755
index 7bf642d..0000000
--- a/examples/qtcpp/generator/qtcpp.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) Pelagicore AB 2016
-
-import click
-import logging
-import logging.config
-import yaml
-from path import Path
-
-from qface.generator import FileSystem, Generator
-from qface.helper.qtcpp import Filters
-
-
-here = Path(__file__).dirname()
-
-logging.config.dictConfig(yaml.load(open(here / 'log.yaml')))
-
-log = logging.getLogger(__file__)
-
-
-def run(input, output):
- log.debug('run {0} {1}'.format(input, output))
- system = FileSystem.parse(input)
- generator = Generator(searchpath=here / 'templates')
- generator.register_filter('returnType', Filters.returnType)
- generator.register_filter('parameterType', Filters.parameterType)
- generator.register_filter('defaultValue', Filters.defaultValue)
- ctx = {'output': output}
- for module in system.modules:
- log.debug('generate code for module %s', module)
- ctx.update({'module': module})
- dst = generator.apply('{{output}}/{{module|lower|replace(".", "-")}}', ctx)
- ctx.update({'dst': dst})
- generator.write('{{dst}}/qmldir', 'qmldir', ctx, preserve=True)
- generator.write('{{dst}}/plugin.cpp', 'plugin.cpp', ctx, preserve=True)
- generator.write('{{dst}}/plugin.h', 'plugin.h', ctx, preserve=True)
- generator.write('{{dst}}/{{module|lower|replace(".", "-")}}.pro', 'plugin.pro', ctx, preserve=True)
- generator.write('{{dst}}/generated/generated.pri', 'generated.pri', ctx)
- generator.write('{{dst}}/generated/qml{{module.module_name|lower}}module.h', 'module.h', ctx)
- generator.write('{{dst}}/generated/qml{{module.module_name|lower}}module.cpp', 'module.cpp', ctx)
- for interface in module.interfaces:
- log.debug('generate code for interface %s', interface)
- ctx.update({'interface': interface})
- generator.write('{{dst}}/qml{{interface|lower}}.h', 'interface.h', ctx, preserve=True)
- generator.write('{{dst}}/qml{{interface|lower}}.cpp', 'interface.cpp', ctx, preserve=True)
- generator.write('{{dst}}/generated/qmlabstract{{interface|lower}}.h', 'abstractinterface.h', ctx)
- generator.write('{{dst}}/generated/qmlabstract{{interface|lower}}.cpp', 'abstractinterface.cpp', ctx)
- for struct in module.structs:
- log.debug('generate code for struct %s', struct)
- ctx.update({'struct': struct})
- generator.write('{{dst}}/generated/qml{{struct|lower}}.h', 'struct.h', ctx)
- generator.write('{{dst}}/generated/qml{{struct|lower}}.cpp', 'struct.cpp', ctx)
- generator.write('{{dst}}/generated/qml{{struct|lower}}model.h', 'structmodel.h', ctx)
- generator.write('{{dst}}/generated/qml{{struct|lower}}model.cpp', 'structmodel.cpp', ctx)
-
-
-@click.command()
-@click.argument('input', nargs=-1, type=click.Path(exists=True))
-@click.argument('output', nargs=1, type=click.Path(exists=True))
-def app(input, output):
- """Takes several files or directories as input and generates the code
- in the given output directory."""
- run(input, output)
-
-
-if __name__ == '__main__':
- app()
diff --git a/examples/qtcpp/generator/templates/abstractinterface.cpp b/examples/qtcpp/generator/templates/abstractinterface.cpp
deleted file mode 100644
index e0ac7cc..0000000
--- a/examples/qtcpp/generator/templates/abstractinterface.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'QmlAbstract{0}'.format(interface) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#include "{{class|lower}}.h"
-
-#include <QtQml>
-
-{{interface.comment}}
-{{class}}::{{class}}(QObject *parent)
- : QObject(parent)
-{% for property in interface.properties %}
- , m_{{property}}({{property|defaultValue}})
-{% endfor %}
-{
-}
-
-{{class}}::~{{class}}()
-{
-}
-
-{% for property in interface.properties %}
-{% if not property.is_readonly %}
-void {{class}}::set{{property|upperfirst}}({{ property|parameterType }})
-{
- if(m_{{property}} == {{property}}) {
- return;
- }
- m_{{property}} = {{property}};
- emit {{property}}Changed();
-}
-{% endif %}
-
-{{property|returnType}} {{class}}::{{property}}() const
-{
- return m_{{property}};
-}
-{% endfor %}
-
-{%- for operation in interface.operations %}
-{{operation|returnType}} {{class}}::{{operation}}({{operation.parameters|map('parameterType')|join(', ')}})
-{
- {% for parameter in operation.parameters %}
- Q_UNUSED({{parameter.name}});
- {% endfor %}
- qWarning() << "{{class}}::{{operation}}(...) not implemented";
- return {{operation|defaultValue}};
-}
-{% endfor %}
-
diff --git a/examples/qtcpp/generator/templates/abstractinterface.h b/examples/qtcpp/generator/templates/abstractinterface.h
deleted file mode 100644
index 1f8474e..0000000
--- a/examples/qtcpp/generator/templates/abstractinterface.h
+++ /dev/null
@@ -1,51 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'QmlAbstract{0}'.format(interface) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#pragma once
-
-#include <QtCore>
-
-#include "qml{{module.module_name|lower}}module.h"
-
-class {{class}} : public QObject
-{
- Q_OBJECT
-{% for property in interface.properties %}
- Q_PROPERTY({{property|returnType}} {{property}} READ {{property}} {%if not property.is_readonly%}WRITE set{{property|upperfirst}} {%endif%}NOTIFY {{property}}Changed)
-{% endfor %}
-
-public:
- {{class}}(QObject *parent=0);
- ~{{class}}();
-
-public Q_SLOTS:
-{% for operation in interface.operations %}
- virtual {{operation|returnType}} {{operation}}({{operation.parameters|map('parameterType')|join(', ')}});
-{% endfor %}
-
-public:
-{% for property in interface.properties %}
-{% if not property.is_readonly %}
- virtual void set{{property|upperfirst}}({{ property|parameterType }});
-{% endif %}
-{% endfor %}
-
-public:
-{% for property in interface.properties %}
- virtual {{property|returnType}} {{property}}() const;
-{% endfor %}
-
-Q_SIGNALS:
-{% for property in interface.properties %}
- void {{property}}Changed();
-{% endfor %}
-
-protected:
-{% for property in interface.properties %}
- {{property|returnType}} m_{{property}};
-{% endfor %}
-};
diff --git a/examples/qtcpp/generator/templates/generated.pri b/examples/qtcpp/generator/templates/generated.pri
deleted file mode 100644
index 31f9aac..0000000
--- a/examples/qtcpp/generator/templates/generated.pri
+++ /dev/null
@@ -1,31 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-#############################################################################
-## This is an auto-generated file.
-## Do not edit! All changes made to it will be lost.
-#############################################################################
-
-QT += qml quick
-CONFIG += c++11
-
-HEADERS += \
- $$PWD/qml{{module.module_name|lower}}module.h \
-{% for interface in module.interfaces %}
- $$PWD/qmlabstract{{interface|lower}}.h \
-{% endfor %}
-{% for struct in module.structs %}
- $$PWD/qml{{struct|lower}}.h \
- $$PWD/qml{{struct|lower}}model.h {% if not loop.last %}\{% endif %}
-{% endfor %}
-
-
-SOURCES += \
- $$PWD/qml{{module.module_name|lower}}module.cpp \
-{% for interface in module.interfaces %}
- $$PWD/qmlabstract{{interface|lower}}.cpp \
-{% endfor %}
-{% for struct in module.structs %}
- $$PWD/qml{{struct|lower}}.cpp \
- $$PWD/qml{{struct|lower}}model.cpp {% if not loop.last %}\{% endif %}
-{% endfor %}
-
-
diff --git a/examples/qtcpp/generator/templates/interface.cpp b/examples/qtcpp/generator/templates/interface.cpp
deleted file mode 100644
index abde3d7..0000000
--- a/examples/qtcpp/generator/templates/interface.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(interface) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#include "{{class|lower}}.h"
-
-#include <QtQml>
-
-QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
-{
- return new {{class}}();
-}
-
-
-{{interface.comment}}
-{{class}}::{{class}}(QObject *parent)
- : QmlAbstract{{interface}}(parent)
-{
-}
-
-{{class}}::~{{class}}()
-{
-}
-
-void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion)
-{
- {% if 'singleton' in interface.tags %}
- qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}", {{class|lower}}_singletontype_provider);
- {% else %}
- qmlRegisterType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}");
- {% endif %}
-}
diff --git a/examples/qtcpp/generator/templates/interface.h b/examples/qtcpp/generator/templates/interface.h
deleted file mode 100644
index 8978be5..0000000
--- a/examples/qtcpp/generator/templates/interface.h
+++ /dev/null
@@ -1,23 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(interface) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#pragma once
-
-#include <QtCore>
-
-#include "generated/qml{{module.module_name|lower}}module.h"
-#include "generated/qmlabstract{{interface|lower}}.h"
-
-class {{class}} : public QmlAbstract{{interface}}
-{
- Q_OBJECT
-public:
- {{class}}(QObject *parent=0);
- virtual ~{{class}}();
-
- static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0);
-};
diff --git a/examples/qtcpp/generator/templates/module.cpp b/examples/qtcpp/generator/templates/module.cpp
deleted file mode 100644
index 6579b2c..0000000
--- a/examples/qtcpp/generator/templates/module.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-{% set class = 'Qml{0}Module'.format(module.module_name) %}
-
-
-#include "{{class|lower}}.h"
-
-#include <QtQml>
-
-QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
-{
- return new {{class}}();
-}
-
-{{class}}::{{class}}(QObject *parent)
- : QObject(parent)
-{
-}
-
-{% for struct in module.structs %}
-Qml{{struct}} {{class}}::create{{struct}}()
-{
- return Qml{{struct}}();
-}
-{% endfor %}
-
-void {{class}}::registerTypes()
-{
- {% for struct in module.structs %}
- qRegisterMetaType<Qml{{struct}}>();
- {% endfor %}
- {% for enum in module.enums %}
- qRegisterMetaType<{{class}}::{{enum}}>();
- {% endfor %}
-}
-
-void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion)
-{
- {% for struct in module.structs %}
- qmlRegisterUncreatableType<Qml{{struct}}Model>(uri.toLatin1(), majorVersion, minorVersion, "{{struct}}Model", "Model can not be instantiated from QML");
- {% endfor %}
- qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{module.module_name}}Module", {{class|lower}}_singletontype_provider);
-}
diff --git a/examples/qtcpp/generator/templates/module.h b/examples/qtcpp/generator/templates/module.h
deleted file mode 100644
index 65ba2db..0000000
--- a/examples/qtcpp/generator/templates/module.h
+++ /dev/null
@@ -1,40 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-{% set class = 'Qml{0}Module'.format(module.module_name) %}
-
-#pragma once
-
-#include <QtCore>
-
-{% for struct in module.structs %}
-#include "qml{{struct|lower}}.h"
-#include "qml{{struct|lower}}model.h"
-{% endfor %}
-
-class {{class}} : public QObject {
- Q_OBJECT
-public:
- {{class}}(QObject *parent=0);
-
-{% for enum in module.enums %}
- {% set comma = joiner(",") %}
- enum {{enum}} {
- {%- for member in enum.members -%}
- {{ comma() }}
- {{member.name}} = {{member.value}}
- {%- endfor %}
-
- };
- Q_ENUM({{enum}})
-{% endfor %}
-
-{% for struct in module.structs %}
- Q_INVOKABLE Qml{{struct}} create{{struct}}();
-{% endfor %}
-
- static void registerTypes();
- static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0);
-};
diff --git a/examples/qtcpp/generator/templates/plugin.cpp b/examples/qtcpp/generator/templates/plugin.cpp
deleted file mode 100644
index aa8fb9a..0000000
--- a/examples/qtcpp/generator/templates/plugin.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set module_name = 'Qml{0}Module'.format(module.module_name) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#include "plugin.h"
-
-#include <qqml.h>
-
-#include "generated/{{module_name|lower}}.h"
-
-{% for interface in module.interfaces %}
-#include "qml{{interface|lower}}.h"
-{% endfor %}
-
-void Plugin::registerTypes(const char *uri)
-{
- {{module_name}}::registerTypes();
- // @uri {{module|lower}}
- {{module_name}}::registerQmlTypes(uri, 1, 0);
-{% for interface in module.interfaces %}
- Qml{{interface}}::registerQmlTypes(uri, 1, 0);
-{% endfor %}
-}
diff --git a/examples/qtcpp/generator/templates/plugin.h b/examples/qtcpp/generator/templates/plugin.h
deleted file mode 100644
index 1952c35..0000000
--- a/examples/qtcpp/generator/templates/plugin.h
+++ /dev/null
@@ -1,18 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#pragma once
-
-#include <QtQml>
-
-class Plugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
-
-public:
- void registerTypes(const char *uri);
-};
diff --git a/examples/qtcpp/generator/templates/plugin.pro b/examples/qtcpp/generator/templates/plugin.pro
deleted file mode 100644
index 00c9d6e..0000000
--- a/examples/qtcpp/generator/templates/plugin.pro
+++ /dev/null
@@ -1,47 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-#############################################################################
-## This is an auto-generated file.
-## Do not edit! All changes made to it will be lost.
-#############################################################################
-
-TEMPLATE = lib
-QT += qml quick
-CONFIG += qt plugin c++11
-TARGET = $$qtLibraryTarget({{module|lower}})
-
-uri = {{module}}
-
-
-HEADERS += \
-{% for interface in module.interfaces %}
- qml{{interface|lower}}.h \
-{% endfor %}
- plugin.h
-
-
-SOURCES += \
-{% for interface in module.interfaces %}
- qml{{interface|lower}}.cpp \
-{% endfor %}
- plugin.cpp
-
-
-include( generated/generated.pri )
-
-DISTFILES = qmldir
-
-!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
- copy_qmldir.target = $$OUT_PWD/qmldir
- copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
- copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
- QMAKE_EXTRA_TARGETS += copy_qmldir
- PRE_TARGETDEPS += $$copy_qmldir.target
-}
-
-qmldir.files = qmldir
-unix {
- installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
- qmldir.path = $$installPath
- target.path = $$installPath
- INSTALLS += target qmldir
-}
diff --git a/examples/qtcpp/generator/templates/qmldir b/examples/qtcpp/generator/templates/qmldir
deleted file mode 100644
index 9fe5d2b..0000000
--- a/examples/qtcpp/generator/templates/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-module {{module}}
-plugin {{module}} \ No newline at end of file
diff --git a/examples/qtcpp/generator/templates/struct.cpp b/examples/qtcpp/generator/templates/struct.cpp
deleted file mode 100644
index 5b132ec..0000000
--- a/examples/qtcpp/generator/templates/struct.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(struct) %}
-{% set ampersand = joiner(" &&") %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#include "{{class|lower}}.h"
-
-
-{{struct.comment}}
-
-bool {{class}}::operator==(const {{class}} &other) const
-{
- return (
- {%- for field in struct.fields %}{{ ampersand() }}
- m_{{field}} == other.m_{{field}}
- {%- endfor %} );
-}
-
diff --git a/examples/qtcpp/generator/templates/struct.h b/examples/qtcpp/generator/templates/struct.h
deleted file mode 100644
index 2e0d6d1..0000000
--- a/examples/qtcpp/generator/templates/struct.h
+++ /dev/null
@@ -1,29 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(struct) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#pragma once
-
-#include <QtCore>
-
-class {{class}}
-{
- Q_GADGET
-{% for field in struct.fields %}
- Q_PROPERTY({{field|returnType}} {{field}} MEMBER m_{{field}})
-{% endfor %}
-
-public:
-{% for field in struct.fields %}
- {{field|returnType}} m_{{field}};
-{% endfor %}
-
- bool operator==(const {{class}} &other) const;
-};
-
-Q_DECLARE_METATYPE({{class}})
-
-
diff --git a/examples/qtcpp/generator/templates/structmodel.cpp b/examples/qtcpp/generator/templates/structmodel.cpp
deleted file mode 100644
index 3f13cb6..0000000
--- a/examples/qtcpp/generator/templates/structmodel.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}Model'.format(struct) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#include "{{class|lower}}.h"
-
-{{class}}::{{class}}(QObject *parent)
- : QAbstractListModel(parent)
-{
- {% for field in struct.fields %}
- m_roleNames.insert(Roles::{{field|upperfirst}}, QByteArray("{{field}}"));
- {% endfor %}
-}
-
-int {{class}}::count() const
-{
- return m_data.count();
-}
-
-Qml{{struct}} {{class}}::get(int index)
-{
- return m_data.value(index);
-}
-
-int {{class}}::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent)
- return m_data.count();
-}
-
-QVariant {{class}}::data(const QModelIndex &index, int role) const
-{
- if(index.row() < 0 || index.row() >= count()) {
- return QVariant();
- }
- const Qml{{struct}} &{{struct|lower}} = m_data.at(index.row());
- switch(role) {
- {% for field in struct.fields %}
- case Roles::{{field|upperfirst}}:
- return QVariant::fromValue({{struct|lower}}.m_{{field}});
- {% endfor %}
- }
- return QVariant();
-}
-
-QHash<int, QByteArray> {{class}}::roleNames() const
-{
- return m_roleNames;
-}
-
-
-void {{class}}::insert(int row, const Qml{{struct}} &{{struct|lower}})
-{
- if (row < 0)
- row = 0;
- if (row >= m_data.count())
- row = m_data.count();
-
- beginInsertRows(QModelIndex(), row, row);
- m_data.insert(row, {{struct|lower}});
- endInsertRows();
- emit countChanged(count());
-}
-
-void {{class}}::reset(const QList<Qml{{struct}}> data)
-{
- beginResetModel();
- m_data = data;
- endResetModel();
-}
-
-void {{class}}::append(const Qml{{struct}} &{{struct|lower}})
-{
- insert(m_data.count(), {{struct|lower}});
-}
-
-void {{class}}::update(int row, const Qml{{struct}} &{{struct|lower}})
-{
- if(row < 0 || row >= m_data.count()) {
- return;
- }
- m_data[row] = {{struct|lower}};
- const QModelIndex &index = createIndex(row, 0);
- emit dataChanged(index, index);
-}
-
-void {{class}}::remove(int row)
-{
- if(row < 0 || row >= m_data.count()) {
- return;
- }
- beginRemoveRows(QModelIndex(), row, row);
- m_data.removeAt(row);
- endRemoveRows();
-}
-
-void {{class}}::clear()
-{
- beginResetModel();
- m_data.clear();
- endResetModel();
-}
-
diff --git a/examples/qtcpp/generator/templates/structmodel.h b/examples/qtcpp/generator/templates/structmodel.h
deleted file mode 100644
index d212265..0000000
--- a/examples/qtcpp/generator/templates/structmodel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}Model'.format(struct) %}
-/****************************************************************************
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-****************************************************************************/
-
-#pragma once
-
-#include <QtCore>
-
-#include "qml{{struct|lower}}.h"
-
-class {{class}} : public QAbstractListModel
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged)
-public:
- enum Roles { {{struct.fields|map('upperfirst')|join(', ')}} };
- {{class}}(QObject *parent=0);
- Q_INVOKABLE Qml{{struct}} get(int index);
- int count() const;
- Q_INVOKABLE void insert(int row, const Qml{{struct}} &{{struct|lower}});
- Q_INVOKABLE void append(const Qml{{struct}} &{{struct|lower}});
- Q_INVOKABLE void update(int row, const Qml{{struct}} &{{struct|lower}});
- Q_INVOKABLE void remove(int row);
- void reset(const QList<Qml{{struct}}> data);
- Q_INVOKABLE void clear();
-public: // from QAbstractListModel
- virtual int rowCount(const QModelIndex &parent) const;
- virtual QVariant data(const QModelIndex &index, int role) const;
- virtual QHash<int, QByteArray> roleNames() const;
-Q_SIGNALS:
- void countChanged(int count);
-private:
- QList<Qml{{struct}}> m_data;
- QHash<int, QByteArray> m_roleNames;
-};
-
-
diff --git a/examples/qtcpp/qtcpp.pro b/examples/qtcpp/qtcpp.pro
deleted file mode 100644
index 65d9262..0000000
--- a/examples/qtcpp/qtcpp.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = src
diff --git a/examples/qtcpp/src/plugins/.gitkeep b/examples/qtcpp/src/plugins/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/examples/qtcpp/src/plugins/.gitkeep
+++ /dev/null
diff --git a/examples/qtcpp/src/src.pro b/examples/qtcpp/src/src.pro
deleted file mode 100644
index 64db4ad..0000000
--- a/examples/qtcpp/src/src.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = plugins