aboutsummaryrefslogtreecommitdiff
path: root/lib/application-service/definitions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/application-service/definitions')
-rw-r--r--lib/application-service/definitions/location.cpp23
-rw-r--r--lib/application-service/definitions/location.h18
-rw-r--r--lib/application-service/definitions/protocol.cpp59
-rw-r--r--lib/application-service/definitions/protocol.h53
-rw-r--r--lib/application-service/definitions/user.cpp23
-rw-r--r--lib/application-service/definitions/user.h18
6 files changed, 64 insertions, 130 deletions
diff --git a/lib/application-service/definitions/location.cpp b/lib/application-service/definitions/location.cpp
deleted file mode 100644
index 0a054029..00000000
--- a/lib/application-service/definitions/location.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "location.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<ThirdPartyLocation>::dumpTo(
- QJsonObject& jo, const ThirdPartyLocation& pod)
-{
- addParam<>(jo, QStringLiteral("alias"), pod.alias);
- addParam<>(jo, QStringLiteral("protocol"), pod.protocol);
- addParam<>(jo, QStringLiteral("fields"), pod.fields);
-}
-
-void JsonObjectConverter<ThirdPartyLocation>::fillFrom(const QJsonObject& jo,
- ThirdPartyLocation& result)
-{
- fromJson(jo.value("alias"_ls), result.alias);
- fromJson(jo.value("protocol"_ls), result.protocol);
- fromJson(jo.value("fields"_ls), result.fields);
-}
diff --git a/lib/application-service/definitions/location.h b/lib/application-service/definitions/location.h
index e4c2d096..6801c99f 100644
--- a/lib/application-service/definitions/location.h
+++ b/lib/application-service/definitions/location.h
@@ -6,12 +6,8 @@
#include "converters.h"
-#include <QtCore/QJsonObject>
-
namespace Quotient {
-// Data structures
-
struct ThirdPartyLocation {
/// An alias for a matrix room.
QString alias;
@@ -25,8 +21,18 @@ struct ThirdPartyLocation {
template <>
struct JsonObjectConverter<ThirdPartyLocation> {
- static void dumpTo(QJsonObject& jo, const ThirdPartyLocation& pod);
- static void fillFrom(const QJsonObject& jo, ThirdPartyLocation& pod);
+ static void dumpTo(QJsonObject& jo, const ThirdPartyLocation& pod)
+ {
+ addParam<>(jo, QStringLiteral("alias"), pod.alias);
+ addParam<>(jo, QStringLiteral("protocol"), pod.protocol);
+ addParam<>(jo, QStringLiteral("fields"), pod.fields);
+ }
+ static void fillFrom(const QJsonObject& jo, ThirdPartyLocation& pod)
+ {
+ fromJson(jo.value("alias"_ls), pod.alias);
+ fromJson(jo.value("protocol"_ls), pod.protocol);
+ fromJson(jo.value("fields"_ls), pod.fields);
+ }
};
} // namespace Quotient
diff --git a/lib/application-service/definitions/protocol.cpp b/lib/application-service/definitions/protocol.cpp
deleted file mode 100644
index 8c66aa4d..00000000
--- a/lib/application-service/definitions/protocol.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "protocol.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<FieldType>::dumpTo(QJsonObject& jo,
- const FieldType& pod)
-{
- addParam<>(jo, QStringLiteral("regexp"), pod.regexp);
- addParam<>(jo, QStringLiteral("placeholder"), pod.placeholder);
-}
-
-void JsonObjectConverter<FieldType>::fillFrom(const QJsonObject& jo,
- FieldType& result)
-{
- fromJson(jo.value("regexp"_ls), result.regexp);
- fromJson(jo.value("placeholder"_ls), result.placeholder);
-}
-
-void JsonObjectConverter<ProtocolInstance>::dumpTo(QJsonObject& jo,
- const ProtocolInstance& pod)
-{
- addParam<>(jo, QStringLiteral("desc"), pod.desc);
- addParam<IfNotEmpty>(jo, QStringLiteral("icon"), pod.icon);
- addParam<>(jo, QStringLiteral("fields"), pod.fields);
- addParam<>(jo, QStringLiteral("network_id"), pod.networkId);
-}
-
-void JsonObjectConverter<ProtocolInstance>::fillFrom(const QJsonObject& jo,
- ProtocolInstance& result)
-{
- fromJson(jo.value("desc"_ls), result.desc);
- fromJson(jo.value("icon"_ls), result.icon);
- fromJson(jo.value("fields"_ls), result.fields);
- fromJson(jo.value("network_id"_ls), result.networkId);
-}
-
-void JsonObjectConverter<ThirdPartyProtocol>::dumpTo(
- QJsonObject& jo, const ThirdPartyProtocol& pod)
-{
- addParam<>(jo, QStringLiteral("user_fields"), pod.userFields);
- addParam<>(jo, QStringLiteral("location_fields"), pod.locationFields);
- addParam<>(jo, QStringLiteral("icon"), pod.icon);
- addParam<>(jo, QStringLiteral("field_types"), pod.fieldTypes);
- addParam<>(jo, QStringLiteral("instances"), pod.instances);
-}
-
-void JsonObjectConverter<ThirdPartyProtocol>::fillFrom(const QJsonObject& jo,
- ThirdPartyProtocol& result)
-{
- fromJson(jo.value("user_fields"_ls), result.userFields);
- fromJson(jo.value("location_fields"_ls), result.locationFields);
- fromJson(jo.value("icon"_ls), result.icon);
- fromJson(jo.value("field_types"_ls), result.fieldTypes);
- fromJson(jo.value("instances"_ls), result.instances);
-}
diff --git a/lib/application-service/definitions/protocol.h b/lib/application-service/definitions/protocol.h
index ac1e50e2..6aee9c57 100644
--- a/lib/application-service/definitions/protocol.h
+++ b/lib/application-service/definitions/protocol.h
@@ -6,14 +6,7 @@
#include "converters.h"
-#include <QtCore/QHash>
-#include <QtCore/QJsonObject>
-#include <QtCore/QVector>
-
namespace Quotient {
-
-// Data structures
-
/// Definition of valid values for a field.
struct FieldType {
/// A regular expression for validation of a field's value. This may be
@@ -27,8 +20,16 @@ struct FieldType {
template <>
struct JsonObjectConverter<FieldType> {
- static void dumpTo(QJsonObject& jo, const FieldType& pod);
- static void fillFrom(const QJsonObject& jo, FieldType& pod);
+ static void dumpTo(QJsonObject& jo, const FieldType& pod)
+ {
+ addParam<>(jo, QStringLiteral("regexp"), pod.regexp);
+ addParam<>(jo, QStringLiteral("placeholder"), pod.placeholder);
+ }
+ static void fillFrom(const QJsonObject& jo, FieldType& pod)
+ {
+ fromJson(jo.value("regexp"_ls), pod.regexp);
+ fromJson(jo.value("placeholder"_ls), pod.placeholder);
+ }
};
struct ProtocolInstance {
@@ -48,8 +49,20 @@ struct ProtocolInstance {
template <>
struct JsonObjectConverter<ProtocolInstance> {
- static void dumpTo(QJsonObject& jo, const ProtocolInstance& pod);
- static void fillFrom(const QJsonObject& jo, ProtocolInstance& pod);
+ static void dumpTo(QJsonObject& jo, const ProtocolInstance& pod)
+ {
+ addParam<>(jo, QStringLiteral("desc"), pod.desc);
+ addParam<IfNotEmpty>(jo, QStringLiteral("icon"), pod.icon);
+ addParam<>(jo, QStringLiteral("fields"), pod.fields);
+ addParam<>(jo, QStringLiteral("network_id"), pod.networkId);
+ }
+ static void fillFrom(const QJsonObject& jo, ProtocolInstance& pod)
+ {
+ fromJson(jo.value("desc"_ls), pod.desc);
+ fromJson(jo.value("icon"_ls), pod.icon);
+ fromJson(jo.value("fields"_ls), pod.fields);
+ fromJson(jo.value("network_id"_ls), pod.networkId);
+ }
};
struct ThirdPartyProtocol {
@@ -84,8 +97,22 @@ struct ThirdPartyProtocol {
template <>
struct JsonObjectConverter<ThirdPartyProtocol> {
- static void dumpTo(QJsonObject& jo, const ThirdPartyProtocol& pod);
- static void fillFrom(const QJsonObject& jo, ThirdPartyProtocol& pod);
+ static void dumpTo(QJsonObject& jo, const ThirdPartyProtocol& pod)
+ {
+ addParam<>(jo, QStringLiteral("user_fields"), pod.userFields);
+ addParam<>(jo, QStringLiteral("location_fields"), pod.locationFields);
+ addParam<>(jo, QStringLiteral("icon"), pod.icon);
+ addParam<>(jo, QStringLiteral("field_types"), pod.fieldTypes);
+ addParam<>(jo, QStringLiteral("instances"), pod.instances);
+ }
+ static void fillFrom(const QJsonObject& jo, ThirdPartyProtocol& pod)
+ {
+ fromJson(jo.value("user_fields"_ls), pod.userFields);
+ fromJson(jo.value("location_fields"_ls), pod.locationFields);
+ fromJson(jo.value("icon"_ls), pod.icon);
+ fromJson(jo.value("field_types"_ls), pod.fieldTypes);
+ fromJson(jo.value("instances"_ls), pod.instances);
+ }
};
} // namespace Quotient
diff --git a/lib/application-service/definitions/user.cpp b/lib/application-service/definitions/user.cpp
deleted file mode 100644
index 17d15a20..00000000
--- a/lib/application-service/definitions/user.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
- */
-
-#include "user.h"
-
-using namespace Quotient;
-
-void JsonObjectConverter<ThirdPartyUser>::dumpTo(QJsonObject& jo,
- const ThirdPartyUser& pod)
-{
- addParam<>(jo, QStringLiteral("userid"), pod.userid);
- addParam<>(jo, QStringLiteral("protocol"), pod.protocol);
- addParam<>(jo, QStringLiteral("fields"), pod.fields);
-}
-
-void JsonObjectConverter<ThirdPartyUser>::fillFrom(const QJsonObject& jo,
- ThirdPartyUser& result)
-{
- fromJson(jo.value("userid"_ls), result.userid);
- fromJson(jo.value("protocol"_ls), result.protocol);
- fromJson(jo.value("fields"_ls), result.fields);
-}
diff --git a/lib/application-service/definitions/user.h b/lib/application-service/definitions/user.h
index 0d1984b6..3342ef80 100644
--- a/lib/application-service/definitions/user.h
+++ b/lib/application-service/definitions/user.h
@@ -6,12 +6,8 @@
#include "converters.h"
-#include <QtCore/QJsonObject>
-
namespace Quotient {
-// Data structures
-
struct ThirdPartyUser {
/// A Matrix User ID represting a third party user.
QString userid;
@@ -25,8 +21,18 @@ struct ThirdPartyUser {
template <>
struct JsonObjectConverter<ThirdPartyUser> {
- static void dumpTo(QJsonObject& jo, const ThirdPartyUser& pod);
- static void fillFrom(const QJsonObject& jo, ThirdPartyUser& pod);
+ static void dumpTo(QJsonObject& jo, const ThirdPartyUser& pod)
+ {
+ addParam<>(jo, QStringLiteral("userid"), pod.userid);
+ addParam<>(jo, QStringLiteral("protocol"), pod.protocol);
+ addParam<>(jo, QStringLiteral("fields"), pod.fields);
+ }
+ static void fillFrom(const QJsonObject& jo, ThirdPartyUser& pod)
+ {
+ fromJson(jo.value("userid"_ls), pod.userid);
+ fromJson(jo.value("protocol"_ls), pod.protocol);
+ fromJson(jo.value("fields"_ls), pod.fields);
+ }
};
} // namespace Quotient