Continues migration with DDS, Common

This commit is contained in:
torsten committed 2026-07-17 12:41:42 +02:00
1 parent 9b15cee841
commit fa48db111e
668 files changed
+111841 -2

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
/**
* Json <-> DDS conversion routines
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-11-30
*/
{% autoescape off %}
// filename: {{ namespace_abbr }}_json.h
#pragma once
#include "{{ namespace_abbr }}.hpp"
#include "{{ namespace_abbr }}_export.h"
#include <QJsonObject>
#include <QJsonValue>
namespace {{ namespace }}
{
template<typename T>
struct type{};
template<typename T>
T fromJson(const QJsonValue &val, type<T>);
template<typename T>
T fromJson(const QJsonValue &val)
{
return fromJson(val, type<T>{});
}
{% for dt in jsonTopics %}
// {{ dt.name }}
{{ namespace_abbr_upper }}_COMMON_EXPORT QJsonObject toJson(const {{ dt.name }} &element);
template<> {{ namespace_abbr_upper }}_COMMON_EXPORT {{ dt.name }} fromJson(const QJsonValue &val, type<{{ dt.name }}>);
{{ namespace_abbr_upper }}_COMMON_EXPORT QJsonValue toJson(const std::vector< {{ dt.name }} > &element);
template<> {{ namespace_abbr_upper }}_COMMON_EXPORT std::vector<{{ dt.name }}> fromJson(const QJsonValue &value, type< std::vector< {{ dt.name }} > >);
{% endfor %}
//
// extensions to support sequence of seqence of Non-POD :
//
} // namespace {{ namespace }}
{% endautoescape %}