diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-08-03 17:29:52 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-03 17:29:52 +0900 |
commit | 66e116b7b1e848e80577a0229c8995db0a54932e (patch) | |
tree | 763340439a0f4034e9c829d76cb1ffe9766b83c5 /lib/csapi/definitions/wellknown | |
parent | 5b236dfe895c7766002559570aa29c9033009228 (diff) | |
parent | c05ade838f0fce81f2bbe80a3295618a8a26ff52 (diff) | |
download | libquotient-66e116b7b1e848e80577a0229c8995db0a54932e.tar.gz libquotient-66e116b7b1e848e80577a0229c8995db0a54932e.zip |
Merge pull request #295 from marcdeop/140_impose_coding_standard
140 impose coding standard
Diffstat (limited to 'lib/csapi/definitions/wellknown')
-rw-r--r-- | lib/csapi/definitions/wellknown/full.cpp | 7 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/full.h | 48 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.cpp | 3 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.h | 28 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.cpp | 3 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.h | 28 |
6 files changed, 61 insertions, 56 deletions
diff --git a/lib/csapi/definitions/wellknown/full.cpp b/lib/csapi/definitions/wellknown/full.cpp index 5ecef34f..34d3bfbe 100644 --- a/lib/csapi/definitions/wellknown/full.cpp +++ b/lib/csapi/definitions/wellknown/full.cpp @@ -7,11 +7,12 @@ using namespace QMatrixClient; void JsonObjectConverter<DiscoveryInformation>::dumpTo( - QJsonObject& jo, const DiscoveryInformation& pod) + QJsonObject& jo, const DiscoveryInformation& pod) { fillJson(jo, pod.additionalProperties); addParam<>(jo, QStringLiteral("m.homeserver"), pod.homeserver); - addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"), pod.identityServer); + addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"), + pod.identityServer); } void JsonObjectConverter<DiscoveryInformation>::fillFrom( @@ -19,7 +20,5 @@ void JsonObjectConverter<DiscoveryInformation>::fillFrom( { fromJson(jo.take("m.homeserver"_ls), result.homeserver); fromJson(jo.take("m.identity_server"_ls), result.identityServer); - fromJson(jo, result.additionalProperties); } - diff --git a/lib/csapi/definitions/wellknown/full.h b/lib/csapi/definitions/wellknown/full.h index d9346acb..ddc06653 100644 --- a/lib/csapi/definitions/wellknown/full.h +++ b/lib/csapi/definitions/wellknown/full.h @@ -6,33 +6,37 @@ #include "converters.h" -#include <QtCore/QJsonObject> -#include "converters.h" #include "csapi/definitions/wellknown/homeserver.h" #include "csapi/definitions/wellknown/identity_server.h" + #include <QtCore/QHash> +#include <QtCore/QJsonObject> namespace QMatrixClient { - // Data structures - - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - struct DiscoveryInformation - { - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - HomeserverInformation homeserver; - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - Omittable<IdentityServerInformation> identityServer; - /// Application-dependent keys using Java package naming convention. - QHash<QString, QJsonObject> additionalProperties; - }; - template <> struct JsonObjectConverter<DiscoveryInformation> - { - static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod); - static void fillFrom(QJsonObject jo, DiscoveryInformation& pod); - }; + +// Data structures + +/// Used by clients to determine the homeserver, identity server, and other/// +/// optional components they should be interacting with. +struct DiscoveryInformation +{ + /// Used by clients to determine the homeserver, identity server, and + /// otheroptional components they should be interacting with. + HomeserverInformation homeserver; + /// Used by clients to determine the homeserver, identity server, and + /// otheroptional components they should be interacting with. + Omittable<IdentityServerInformation> identityServer; + + /// Application-dependent keys using Java package naming convention. + QHash<QString, QJsonObject> additionalProperties; +}; + +template <> +struct JsonObjectConverter<DiscoveryInformation> +{ + static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod); + static void fillFrom(QJsonObject jo, DiscoveryInformation& pod); +}; } // namespace QMatrixClient diff --git a/lib/csapi/definitions/wellknown/homeserver.cpp b/lib/csapi/definitions/wellknown/homeserver.cpp index 0783f11b..f5746ede 100644 --- a/lib/csapi/definitions/wellknown/homeserver.cpp +++ b/lib/csapi/definitions/wellknown/homeserver.cpp @@ -7,7 +7,7 @@ using namespace QMatrixClient; void JsonObjectConverter<HomeserverInformation>::dumpTo( - QJsonObject& jo, const HomeserverInformation& pod) + QJsonObject& jo, const HomeserverInformation& pod) { addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl); } @@ -17,4 +17,3 @@ void JsonObjectConverter<HomeserverInformation>::fillFrom( { fromJson(jo.value("base_url"_ls), result.baseUrl); } - diff --git a/lib/csapi/definitions/wellknown/homeserver.h b/lib/csapi/definitions/wellknown/homeserver.h index f6761c30..b73cee17 100644 --- a/lib/csapi/definitions/wellknown/homeserver.h +++ b/lib/csapi/definitions/wellknown/homeserver.h @@ -6,21 +6,23 @@ #include "converters.h" - namespace QMatrixClient { - // Data structures - /// Used by clients to discover homeserver information. - struct HomeserverInformation - { - /// The base URL for the homeserver for client-server connections. - QString baseUrl; - }; - template <> struct JsonObjectConverter<HomeserverInformation> - { - static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod); - static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod); - }; +// Data structures + +/// Used by clients to discover homeserver information. +struct HomeserverInformation +{ + /// The base URL for the homeserver for client-server connections. + QString baseUrl; +}; + +template <> +struct JsonObjectConverter<HomeserverInformation> +{ + static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod); + static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod); +}; } // namespace QMatrixClient diff --git a/lib/csapi/definitions/wellknown/identity_server.cpp b/lib/csapi/definitions/wellknown/identity_server.cpp index 99f36641..922d4665 100644 --- a/lib/csapi/definitions/wellknown/identity_server.cpp +++ b/lib/csapi/definitions/wellknown/identity_server.cpp @@ -7,7 +7,7 @@ using namespace QMatrixClient; void JsonObjectConverter<IdentityServerInformation>::dumpTo( - QJsonObject& jo, const IdentityServerInformation& pod) + QJsonObject& jo, const IdentityServerInformation& pod) { addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl); } @@ -17,4 +17,3 @@ void JsonObjectConverter<IdentityServerInformation>::fillFrom( { fromJson(jo.value("base_url"_ls), result.baseUrl); } - diff --git a/lib/csapi/definitions/wellknown/identity_server.h b/lib/csapi/definitions/wellknown/identity_server.h index 67d8b08d..a35644fc 100644 --- a/lib/csapi/definitions/wellknown/identity_server.h +++ b/lib/csapi/definitions/wellknown/identity_server.h @@ -6,21 +6,23 @@ #include "converters.h" - namespace QMatrixClient { - // Data structures - /// Used by clients to discover identity server information. - struct IdentityServerInformation - { - /// The base URL for the identity server for client-server connections. - QString baseUrl; - }; - template <> struct JsonObjectConverter<IdentityServerInformation> - { - static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod); - static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod); - }; +// Data structures + +/// Used by clients to discover identity server information. +struct IdentityServerInformation +{ + /// The base URL for the identity server for client-server connections. + QString baseUrl; +}; + +template <> +struct JsonObjectConverter<IdentityServerInformation> +{ + static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod); + static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod); +}; } // namespace QMatrixClient |