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/list_public_rooms.cpp | 98 ++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 45 deletions(-) (limited to 'lib/csapi/list_public_rooms.cpp') diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index 71b3c541..2649b9f8 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -15,21 +15,24 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); class GetRoomVisibilityOnDirectoryJob::Private { public: - QString visibility; + QString visibility; }; -QUrl GetRoomVisibilityOnDirectoryJob::makeRequestUrl(QUrl baseUrl, const QString& roomId) +QUrl GetRoomVisibilityOnDirectoryJob::makeRequestUrl(QUrl baseUrl, + const QString& roomId) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/directory/list/room/" % roomId); + basePath % "/directory/list/room/" % roomId); } -static const auto GetRoomVisibilityOnDirectoryJobName = QStringLiteral("GetRoomVisibilityOnDirectoryJob"); +static const auto GetRoomVisibilityOnDirectoryJobName = + QStringLiteral("GetRoomVisibilityOnDirectoryJob"); -GetRoomVisibilityOnDirectoryJob::GetRoomVisibilityOnDirectoryJob(const QString& roomId) +GetRoomVisibilityOnDirectoryJob::GetRoomVisibilityOnDirectoryJob( + const QString& roomId) : BaseJob(HttpVerb::Get, GetRoomVisibilityOnDirectoryJobName, - basePath % "/directory/list/room/" % roomId, false) - , d(new Private) + basePath % "/directory/list/room/" % roomId, false), + d(new Private) { } @@ -40,18 +43,21 @@ const QString& GetRoomVisibilityOnDirectoryJob::visibility() const return d->visibility; } -BaseJob::Status GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data) +BaseJob::Status +GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data) { auto json = data.object(); fromJson(json.value("visibility"_ls), d->visibility); return Success; } -static const auto SetRoomVisibilityOnDirectoryJobName = QStringLiteral("SetRoomVisibilityOnDirectoryJob"); +static const auto SetRoomVisibilityOnDirectoryJobName = + QStringLiteral("SetRoomVisibilityOnDirectoryJob"); -SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob(const QString& roomId, const QString& visibility) +SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob( + const QString& roomId, const QString& visibility) : BaseJob(HttpVerb::Put, SetRoomVisibilityOnDirectoryJobName, - basePath % "/directory/list/room/" % roomId) + basePath % "/directory/list/room/" % roomId) { QJsonObject _data; addParam(_data, QStringLiteral("visibility"), visibility); @@ -61,10 +67,11 @@ SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob(const QString& class GetPublicRoomsJob::Private { public: - PublicRoomsResponse data; + PublicRoomsResponse data; }; -BaseJob::Query queryToGetPublicRooms(Omittable limit, const QString& since, const QString& server) +BaseJob::Query queryToGetPublicRooms(Omittable limit, const QString& since, + const QString& server) { BaseJob::Query _q; addParam(_q, QStringLiteral("limit"), limit); @@ -73,30 +80,28 @@ BaseJob::Query queryToGetPublicRooms(Omittable limit, const QString& since, return _q; } -QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable limit, const QString& since, const QString& server) +QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable limit, + const QString& since, + const QString& server) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/publicRooms", - queryToGetPublicRooms(limit, since, server)); + basePath % "/publicRooms", + queryToGetPublicRooms(limit, since, server)); } static const auto GetPublicRoomsJobName = QStringLiteral("GetPublicRoomsJob"); -GetPublicRoomsJob::GetPublicRoomsJob(Omittable limit, const QString& since, const QString& server) - : BaseJob(HttpVerb::Get, GetPublicRoomsJobName, - basePath % "/publicRooms", - queryToGetPublicRooms(limit, since, server), - {}, false) - , d(new Private) +GetPublicRoomsJob::GetPublicRoomsJob(Omittable limit, const QString& since, + const QString& server) + : BaseJob(HttpVerb::Get, GetPublicRoomsJobName, basePath % "/publicRooms", + queryToGetPublicRooms(limit, since, server), {}, false), + d(new Private) { } GetPublicRoomsJob::~GetPublicRoomsJob() = default; -const PublicRoomsResponse& GetPublicRoomsJob::data() const -{ - return d->data; -} +const PublicRoomsResponse& GetPublicRoomsJob::data() const { return d->data; } BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) { @@ -104,15 +109,15 @@ BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) return Success; } -namespace QMatrixClient -{ +namespace QMatrixClient { // Converters - template <> struct JsonObjectConverter - { - static void dumpTo(QJsonObject& jo, const QueryPublicRoomsJob::Filter& pod) + template <> struct JsonObjectConverter { + static void dumpTo(QJsonObject& jo, + const QueryPublicRoomsJob::Filter& pod) { - addParam(jo, QStringLiteral("generic_search_term"), pod.genericSearchTerm); + addParam(jo, QStringLiteral("generic_search_term"), + pod.genericSearchTerm); } }; } // namespace QMatrixClient @@ -120,7 +125,7 @@ namespace QMatrixClient class QueryPublicRoomsJob::Private { public: - PublicRoomsResponse data; + PublicRoomsResponse data; }; BaseJob::Query queryToQueryPublicRooms(const QString& server) @@ -130,33 +135,36 @@ BaseJob::Query queryToQueryPublicRooms(const QString& server) return _q; } -static const auto QueryPublicRoomsJobName = QStringLiteral("QueryPublicRoomsJob"); +static const auto QueryPublicRoomsJobName = + QStringLiteral("QueryPublicRoomsJob"); -QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable limit, const QString& since, const Omittable& filter, Omittable includeAllNetworks, const QString& thirdPartyInstanceId) +QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, + Omittable limit, + const QString& since, + const Omittable& filter, + Omittable includeAllNetworks, + const QString& thirdPartyInstanceId) : BaseJob(HttpVerb::Post, QueryPublicRoomsJobName, - basePath % "/publicRooms", - queryToQueryPublicRooms(server)) - , d(new Private) + basePath % "/publicRooms", queryToQueryPublicRooms(server)), + d(new Private) { QJsonObject _data; addParam(_data, QStringLiteral("limit"), limit); addParam(_data, QStringLiteral("since"), since); addParam(_data, QStringLiteral("filter"), filter); - addParam(_data, QStringLiteral("include_all_networks"), includeAllNetworks); - addParam(_data, QStringLiteral("third_party_instance_id"), thirdPartyInstanceId); + addParam(_data, QStringLiteral("include_all_networks"), + includeAllNetworks); + addParam(_data, QStringLiteral("third_party_instance_id"), + thirdPartyInstanceId); setRequestData(_data); } QueryPublicRoomsJob::~QueryPublicRoomsJob() = default; -const PublicRoomsResponse& QueryPublicRoomsJob::data() const -{ - return d->data; -} +const PublicRoomsResponse& QueryPublicRoomsJob::data() const { return d->data; } BaseJob::Status QueryPublicRoomsJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); 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/list_public_rooms.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/csapi/list_public_rooms.cpp') diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index 4d96dac3..0e065440 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -8,7 +8,7 @@ #include -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); @@ -108,7 +108,7 @@ BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) } // Converters -namespace QMatrixClient +namespace Quotient { template <> @@ -121,7 +121,7 @@ struct JsonObjectConverter } }; -} // namespace QMatrixClient +} // namespace Quotient class QueryPublicRoomsJob::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/list_public_rooms.cpp | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'lib/csapi/list_public_rooms.cpp') diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index 0e065440..83320ec0 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -12,8 +12,7 @@ using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -class GetRoomVisibilityOnDirectoryJob::Private -{ +class GetRoomVisibilityOnDirectoryJob::Private { public: QString visibility; }; @@ -25,12 +24,9 @@ QUrl GetRoomVisibilityOnDirectoryJob::makeRequestUrl(QUrl baseUrl, basePath % "/directory/list/room/" % roomId); } -static const auto GetRoomVisibilityOnDirectoryJobName = - QStringLiteral("GetRoomVisibilityOnDirectoryJob"); - GetRoomVisibilityOnDirectoryJob::GetRoomVisibilityOnDirectoryJob( const QString& roomId) - : BaseJob(HttpVerb::Get, GetRoomVisibilityOnDirectoryJobName, + : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomVisibilityOnDirectoryJob"), basePath % "/directory/list/room/" % roomId, false) , d(new Private) {} @@ -51,12 +47,9 @@ GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data) return Success; } -static const auto SetRoomVisibilityOnDirectoryJobName = - QStringLiteral("SetRoomVisibilityOnDirectoryJob"); - SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob( const QString& roomId, const QString& visibility) - : BaseJob(HttpVerb::Put, SetRoomVisibilityOnDirectoryJobName, + : BaseJob(HttpVerb::Put, QStringLiteral("SetRoomVisibilityOnDirectoryJob"), basePath % "/directory/list/room/" % roomId) { QJsonObject _data; @@ -64,8 +57,7 @@ SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob( setRequestData(_data); } -class GetPublicRoomsJob::Private -{ +class GetPublicRoomsJob::Private { public: PublicRoomsResponse data; }; @@ -88,11 +80,10 @@ QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable limit, queryToGetPublicRooms(limit, since, server)); } -static const auto GetPublicRoomsJobName = QStringLiteral("GetPublicRoomsJob"); - GetPublicRoomsJob::GetPublicRoomsJob(Omittable limit, const QString& since, const QString& server) - : BaseJob(HttpVerb::Get, GetPublicRoomsJobName, basePath % "/publicRooms", + : BaseJob(HttpVerb::Get, QStringLiteral("GetPublicRoomsJob"), + basePath % "/publicRooms", queryToGetPublicRooms(limit, since, server), {}, false) , d(new Private) {} @@ -104,16 +95,15 @@ const PublicRoomsResponse& GetPublicRoomsJob::data() const { return d->data; } BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); + return Success; } // Converters -namespace Quotient -{ +namespace Quotient { template <> -struct JsonObjectConverter -{ +struct JsonObjectConverter { static void dumpTo(QJsonObject& jo, const QueryPublicRoomsJob::Filter& pod) { addParam(jo, QStringLiteral("generic_search_term"), @@ -123,8 +113,7 @@ struct JsonObjectConverter } // namespace Quotient -class QueryPublicRoomsJob::Private -{ +class QueryPublicRoomsJob::Private { public: PublicRoomsResponse data; }; @@ -136,16 +125,13 @@ BaseJob::Query queryToQueryPublicRooms(const QString& server) return _q; } -static const auto QueryPublicRoomsJobName = - QStringLiteral("QueryPublicRoomsJob"); - QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable limit, const QString& since, const Omittable& filter, Omittable includeAllNetworks, const QString& thirdPartyInstanceId) - : BaseJob(HttpVerb::Post, QueryPublicRoomsJobName, + : BaseJob(HttpVerb::Post, QStringLiteral("QueryPublicRoomsJob"), basePath % "/publicRooms", queryToQueryPublicRooms(server)) , d(new Private) { @@ -167,5 +153,6 @@ const PublicRoomsResponse& QueryPublicRoomsJob::data() const { return d->data; } BaseJob::Status QueryPublicRoomsJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); + return Success; } -- 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/list_public_rooms.cpp | 104 ++++++++-------------------------------- 1 file changed, 19 insertions(+), 85 deletions(-) (limited to 'lib/csapi/list_public_rooms.cpp') diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index 83320ec0..cdc5c716 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -4,66 +4,39 @@ #include "list_public_rooms.h" -#include "converters.h" - #include using namespace Quotient; -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class GetRoomVisibilityOnDirectoryJob::Private { -public: - QString visibility; -}; - QUrl GetRoomVisibilityOnDirectoryJob::makeRequestUrl(QUrl baseUrl, const QString& roomId) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/directory/list/room/" % roomId); + QStringLiteral("/_matrix/client/r0") + % "/directory/list/room/" % roomId); } GetRoomVisibilityOnDirectoryJob::GetRoomVisibilityOnDirectoryJob( const QString& roomId) : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomVisibilityOnDirectoryJob"), - basePath % "/directory/list/room/" % roomId, false) - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/directory/list/room/" + % roomId, + false) {} -GetRoomVisibilityOnDirectoryJob::~GetRoomVisibilityOnDirectoryJob() = default; - -const QString& GetRoomVisibilityOnDirectoryJob::visibility() const -{ - return d->visibility; -} - -BaseJob::Status -GetRoomVisibilityOnDirectoryJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - fromJson(json.value("visibility"_ls), d->visibility); - - return Success; -} - SetRoomVisibilityOnDirectoryJob::SetRoomVisibilityOnDirectoryJob( const QString& roomId, const QString& visibility) : BaseJob(HttpVerb::Put, QStringLiteral("SetRoomVisibilityOnDirectoryJob"), - basePath % "/directory/list/room/" % roomId) + QStringLiteral("/_matrix/client/r0") % "/directory/list/room/" + % roomId) { QJsonObject _data; addParam(_data, QStringLiteral("visibility"), visibility); - setRequestData(_data); + setRequestData(std::move(_data)); } -class GetPublicRoomsJob::Private { -public: - PublicRoomsResponse data; -}; - -BaseJob::Query queryToGetPublicRooms(Omittable limit, const QString& since, - const QString& server) +auto queryToGetPublicRooms(Omittable limit, const QString& since, + const QString& server) { BaseJob::Query _q; addParam(_q, QStringLiteral("limit"), limit); @@ -76,49 +49,20 @@ QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable limit, const QString& since, const QString& server) { - return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/publicRooms", + return BaseJob::makeRequestUrl(std::move(baseUrl), + QStringLiteral("/_matrix/client/r0") + % "/publicRooms", queryToGetPublicRooms(limit, since, server)); } GetPublicRoomsJob::GetPublicRoomsJob(Omittable limit, const QString& since, const QString& server) : BaseJob(HttpVerb::Get, QStringLiteral("GetPublicRoomsJob"), - basePath % "/publicRooms", + QStringLiteral("/_matrix/client/r0") % "/publicRooms", queryToGetPublicRooms(limit, since, server), {}, false) - , d(new Private) {} -GetPublicRoomsJob::~GetPublicRoomsJob() = default; - -const PublicRoomsResponse& GetPublicRoomsJob::data() const { return d->data; } - -BaseJob::Status GetPublicRoomsJob::parseJson(const QJsonDocument& data) -{ - fromJson(data, d->data); - - return Success; -} - -// Converters -namespace Quotient { - -template <> -struct JsonObjectConverter { - static void dumpTo(QJsonObject& jo, const QueryPublicRoomsJob::Filter& pod) - { - addParam(jo, QStringLiteral("generic_search_term"), - pod.genericSearchTerm); - } -}; - -} // namespace Quotient - -class QueryPublicRoomsJob::Private { -public: - PublicRoomsResponse data; -}; - -BaseJob::Query queryToQueryPublicRooms(const QString& server) +auto queryToQueryPublicRooms(const QString& server) { BaseJob::Query _q; addParam(_q, QStringLiteral("server"), server); @@ -132,8 +76,8 @@ QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable includeAllNetworks, const QString& thirdPartyInstanceId) : BaseJob(HttpVerb::Post, QStringLiteral("QueryPublicRoomsJob"), - basePath % "/publicRooms", queryToQueryPublicRooms(server)) - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/publicRooms", + queryToQueryPublicRooms(server)) { QJsonObject _data; addParam(_data, QStringLiteral("limit"), limit); @@ -143,16 +87,6 @@ QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, includeAllNetworks); addParam(_data, QStringLiteral("third_party_instance_id"), thirdPartyInstanceId); - setRequestData(_data); -} - -QueryPublicRoomsJob::~QueryPublicRoomsJob() = default; - -const PublicRoomsResponse& QueryPublicRoomsJob::data() const { return d->data; } - -BaseJob::Status QueryPublicRoomsJob::parseJson(const QJsonDocument& data) -{ - fromJson(data, d->data); - - return Success; + setRequestData(std::move(_data)); + addExpectedKey("chunk"); } -- cgit v1.2.3 From e17764a1ae81393968dfb747c7b67353c109bc71 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 19 Jun 2020 15:01:33 +0200 Subject: csapi/: generated using the latest GTAD and matrix-doc For matrix-doc, specifically, it is master (5cb4b086) merged with https://github.com/matrix-org/matrix-doc/pull/2518. --- lib/csapi/list_public_rooms.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/csapi/list_public_rooms.cpp') diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index cdc5c716..415d816c 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -60,7 +60,9 @@ GetPublicRoomsJob::GetPublicRoomsJob(Omittable limit, const QString& since, : BaseJob(HttpVerb::Get, QStringLiteral("GetPublicRoomsJob"), QStringLiteral("/_matrix/client/r0") % "/publicRooms", queryToGetPublicRooms(limit, since, server), {}, false) -{} +{ + addExpectedKey("chunk"); +} auto queryToQueryPublicRooms(const QString& server) { -- cgit v1.2.3