From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/csapi/login.cpp | 65 ++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) (limited to 'lib/csapi/login.cpp') diff --git a/lib/csapi/login.cpp b/lib/csapi/login.cpp index 5e369b9a..77652e64 100644 --- a/lib/csapi/login.cpp +++ b/lib/csapi/login.cpp @@ -12,13 +12,12 @@ using namespace QMatrixClient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -namespace QMatrixClient -{ +namespace QMatrixClient { // Converters - template <> struct JsonObjectConverter - { - static void fillFrom(const QJsonObject& jo, GetLoginFlowsJob::LoginFlow& result) + template <> struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + GetLoginFlowsJob::LoginFlow& result) { fromJson(jo.value("type"_ls), result.type); } @@ -28,21 +27,19 @@ namespace QMatrixClient class GetLoginFlowsJob::Private { public: - QVector flows; + QVector flows; }; QUrl GetLoginFlowsJob::makeRequestUrl(QUrl baseUrl) { - return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/login"); + return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/login"); } static const auto GetLoginFlowsJobName = QStringLiteral("GetLoginFlowsJob"); GetLoginFlowsJob::GetLoginFlowsJob() - : BaseJob(HttpVerb::Get, GetLoginFlowsJobName, - basePath % "/login", false) - , d(new Private) + : BaseJob(HttpVerb::Get, GetLoginFlowsJobName, basePath % "/login", false), + d(new Private) { } @@ -63,19 +60,23 @@ BaseJob::Status GetLoginFlowsJob::parseJson(const QJsonDocument& data) class LoginJob::Private { public: - QString userId; - QString accessToken; - QString homeServer; - QString deviceId; - Omittable wellKnown; + QString userId; + QString accessToken; + QString homeServer; + QString deviceId; + Omittable wellKnown; }; static const auto LoginJobName = QStringLiteral("LoginJob"); -LoginJob::LoginJob(const QString& type, const Omittable& identifier, const QString& password, const QString& token, const QString& deviceId, const QString& initialDeviceDisplayName, const QString& user, const QString& medium, const QString& address) - : BaseJob(HttpVerb::Post, LoginJobName, - basePath % "/login", false) - , d(new Private) +LoginJob::LoginJob(const QString& type, + const Omittable& identifier, + const QString& password, const QString& token, + const QString& deviceId, + const QString& initialDeviceDisplayName, const QString& user, + const QString& medium, const QString& address) + : BaseJob(HttpVerb::Post, LoginJobName, basePath % "/login", false), + d(new Private) { QJsonObject _data; addParam<>(_data, QStringLiteral("type"), type); @@ -83,7 +84,8 @@ LoginJob::LoginJob(const QString& type, const Omittable& identif addParam(_data, QStringLiteral("password"), password); addParam(_data, QStringLiteral("token"), token); addParam(_data, QStringLiteral("device_id"), deviceId); - addParam(_data, QStringLiteral("initial_device_display_name"), initialDeviceDisplayName); + addParam(_data, QStringLiteral("initial_device_display_name"), + initialDeviceDisplayName); addParam(_data, QStringLiteral("user"), user); addParam(_data, QStringLiteral("medium"), medium); addParam(_data, QStringLiteral("address"), address); @@ -92,25 +94,13 @@ LoginJob::LoginJob(const QString& type, const Omittable& identif LoginJob::~LoginJob() = default; -const QString& LoginJob::userId() const -{ - return d->userId; -} +const QString& LoginJob::userId() const { return d->userId; } -const QString& LoginJob::accessToken() const -{ - return d->accessToken; -} +const QString& LoginJob::accessToken() const { return d->accessToken; } -const QString& LoginJob::homeServer() const -{ - return d->homeServer; -} +const QString& LoginJob::homeServer() const { return d->homeServer; } -const QString& LoginJob::deviceId() const -{ - return d->deviceId; -} +const QString& LoginJob::deviceId() const { return d->deviceId; } const Omittable& LoginJob::wellKnown() const { @@ -127,4 +117,3 @@ BaseJob::Status LoginJob::parseJson(const QJsonDocument& data) fromJson(json.value("well_known"_ls), d->wellKnown); return Success; } - -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/csapi/login.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/csapi/login.cpp') diff --git a/lib/csapi/login.cpp b/lib/csapi/login.cpp index 29ee4ab5..02730ff0 100644 --- a/lib/csapi/login.cpp +++ b/lib/csapi/login.cpp @@ -8,12 +8,12 @@ #include -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); // Converters -namespace QMatrixClient +namespace Quotient { template <> @@ -26,7 +26,7 @@ struct JsonObjectConverter } }; -} // namespace QMatrixClient +} // namespace Quotient class GetLoginFlowsJob::Private { -- cgit v1.2.3 From 7036ed0dcb137cb5cbb6b426dd338c5e2e4c6424 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 17 Apr 2020 07:42:13 +0200 Subject: Regenerate API files using new GTAD and refreshed templates No functional changes. --- lib/csapi/login.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'lib/csapi/login.cpp') diff --git a/lib/csapi/login.cpp b/lib/csapi/login.cpp index 02730ff0..3e98f56b 100644 --- a/lib/csapi/login.cpp +++ b/lib/csapi/login.cpp @@ -13,12 +13,10 @@ using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); // Converters -namespace Quotient -{ +namespace Quotient { template <> -struct JsonObjectConverter -{ +struct JsonObjectConverter { static void fillFrom(const QJsonObject& jo, GetLoginFlowsJob::LoginFlow& result) { @@ -28,8 +26,7 @@ struct JsonObjectConverter } // namespace Quotient -class GetLoginFlowsJob::Private -{ +class GetLoginFlowsJob::Private { public: QVector flows; }; @@ -39,10 +36,9 @@ QUrl GetLoginFlowsJob::makeRequestUrl(QUrl baseUrl) return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/login"); } -static const auto GetLoginFlowsJobName = QStringLiteral("GetLoginFlowsJob"); - GetLoginFlowsJob::GetLoginFlowsJob() - : BaseJob(HttpVerb::Get, GetLoginFlowsJobName, basePath % "/login", false) + : BaseJob(HttpVerb::Get, QStringLiteral("GetLoginFlowsJob"), + basePath % "/login", false) , d(new Private) {} @@ -61,8 +57,7 @@ BaseJob::Status GetLoginFlowsJob::parseJson(const QJsonDocument& data) return Success; } -class LoginJob::Private -{ +class LoginJob::Private { public: QString userId; QString accessToken; @@ -71,15 +66,14 @@ public: Omittable wellKnown; }; -static const auto LoginJobName = QStringLiteral("LoginJob"); - LoginJob::LoginJob(const QString& type, const Omittable& identifier, const QString& password, const QString& token, const QString& deviceId, const QString& initialDeviceDisplayName, const QString& user, const QString& medium, const QString& address) - : BaseJob(HttpVerb::Post, LoginJobName, basePath % "/login", false) + : BaseJob(HttpVerb::Post, QStringLiteral("LoginJob"), basePath % "/login", + false) , d(new Private) { QJsonObject _data; -- cgit v1.2.3 From 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jun 2020 19:46:40 +0200 Subject: Update generated files according to gtad/* changes --- lib/csapi/login.cpp | 94 +++++------------------------------------------------ 1 file changed, 8 insertions(+), 86 deletions(-) (limited to 'lib/csapi/login.cpp') diff --git a/lib/csapi/login.cpp b/lib/csapi/login.cpp index 3e98f56b..a5bac9ea 100644 --- a/lib/csapi/login.cpp +++ b/lib/csapi/login.cpp @@ -4,77 +4,29 @@ #include "login.h" -#include "converters.h" - #include using namespace Quotient; -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -// Converters -namespace Quotient { - -template <> -struct JsonObjectConverter { - static void fillFrom(const QJsonObject& jo, - GetLoginFlowsJob::LoginFlow& result) - { - fromJson(jo.value("type"_ls), result.type); - } -}; - -} // namespace Quotient - -class GetLoginFlowsJob::Private { -public: - QVector flows; -}; - QUrl GetLoginFlowsJob::makeRequestUrl(QUrl baseUrl) { - return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/login"); + return BaseJob::makeRequestUrl(std::move(baseUrl), + QStringLiteral("/_matrix/client/r0") + % "/login"); } GetLoginFlowsJob::GetLoginFlowsJob() : BaseJob(HttpVerb::Get, QStringLiteral("GetLoginFlowsJob"), - basePath % "/login", false) - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/login", false) {} -GetLoginFlowsJob::~GetLoginFlowsJob() = default; - -const QVector& GetLoginFlowsJob::flows() const -{ - return d->flows; -} - -BaseJob::Status GetLoginFlowsJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - fromJson(json.value("flows"_ls), d->flows); - - return Success; -} - -class LoginJob::Private { -public: - QString userId; - QString accessToken; - QString homeServer; - QString deviceId; - Omittable wellKnown; -}; - LoginJob::LoginJob(const QString& type, const Omittable& identifier, const QString& password, const QString& token, const QString& deviceId, - const QString& initialDeviceDisplayName, const QString& user, - const QString& medium, const QString& address) - : BaseJob(HttpVerb::Post, QStringLiteral("LoginJob"), basePath % "/login", - false) - , d(new Private) + const QString& initialDeviceDisplayName) + : BaseJob(HttpVerb::Post, QStringLiteral("LoginJob"), + QStringLiteral("/_matrix/client/r0") % "/login", false) { QJsonObject _data; addParam<>(_data, QStringLiteral("type"), type); @@ -84,35 +36,5 @@ LoginJob::LoginJob(const QString& type, addParam(_data, QStringLiteral("device_id"), deviceId); addParam(_data, QStringLiteral("initial_device_display_name"), initialDeviceDisplayName); - addParam(_data, QStringLiteral("user"), user); - addParam(_data, QStringLiteral("medium"), medium); - addParam(_data, QStringLiteral("address"), address); - setRequestData(_data); -} - -LoginJob::~LoginJob() = default; - -const QString& LoginJob::userId() const { return d->userId; } - -const QString& LoginJob::accessToken() const { return d->accessToken; } - -const QString& LoginJob::homeServer() const { return d->homeServer; } - -const QString& LoginJob::deviceId() const { return d->deviceId; } - -const Omittable& LoginJob::wellKnown() const -{ - return d->wellKnown; -} - -BaseJob::Status LoginJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - fromJson(json.value("user_id"_ls), d->userId); - fromJson(json.value("access_token"_ls), d->accessToken); - fromJson(json.value("home_server"_ls), d->homeServer); - fromJson(json.value("device_id"_ls), d->deviceId); - fromJson(json.value("well_known"_ls), d->wellKnown); - - return Success; + setRequestData(std::move(_data)); } -- cgit v1.2.3