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/event_context.cpp | 52 +++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'lib/csapi/event_context.cpp') diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp index bb1f5301..9ead6ac6 100644 --- a/lib/csapi/event_context.cpp +++ b/lib/csapi/event_context.cpp @@ -15,12 +15,12 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); class GetEventContextJob::Private { public: - QString begin; - QString end; - RoomEvents eventsBefore; - RoomEventPtr event; - RoomEvents eventsAfter; - StateEvents state; + QString begin; + QString end; + RoomEvents eventsBefore; + RoomEventPtr event; + RoomEvents eventsAfter; + StateEvents state; }; BaseJob::Query queryToGetEventContext(Omittable limit) @@ -30,54 +30,47 @@ BaseJob::Query queryToGetEventContext(Omittable limit) return _q; } -QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, Omittable limit) +QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& eventId, + Omittable limit) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)); + basePath % "/rooms/" % roomId % "/context/" + % eventId, + queryToGetEventContext(limit)); } static const auto GetEventContextJobName = QStringLiteral("GetEventContextJob"); -GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, Omittable limit) +GetEventContextJob::GetEventContextJob(const QString& roomId, + const QString& eventId, + Omittable limit) : BaseJob(HttpVerb::Get, GetEventContextJobName, - basePath % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)) - , d(new Private) + basePath % "/rooms/" % roomId % "/context/" % eventId, + queryToGetEventContext(limit)), + d(new Private) { } GetEventContextJob::~GetEventContextJob() = default; -const QString& GetEventContextJob::begin() const -{ - return d->begin; -} +const QString& GetEventContextJob::begin() const { return d->begin; } -const QString& GetEventContextJob::end() const -{ - return d->end; -} +const QString& GetEventContextJob::end() const { return d->end; } RoomEvents&& GetEventContextJob::eventsBefore() { return std::move(d->eventsBefore); } -RoomEventPtr&& GetEventContextJob::event() -{ - return std::move(d->event); -} +RoomEventPtr&& GetEventContextJob::event() { return std::move(d->event); } RoomEvents&& GetEventContextJob::eventsAfter() { return std::move(d->eventsAfter); } -StateEvents&& GetEventContextJob::state() -{ - return std::move(d->state); -} +StateEvents&& GetEventContextJob::state() { return std::move(d->state); } BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data) { @@ -90,4 +83,3 @@ BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data) fromJson(json.value("state"_ls), d->state); 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/event_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/event_context.cpp') diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp index 936b2430..d233eedb 100644 --- a/lib/csapi/event_context.cpp +++ b/lib/csapi/event_context.cpp @@ -8,7 +8,7 @@ #include -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -- 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/event_context.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/csapi/event_context.cpp') diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp index d233eedb..5bb2222e 100644 --- a/lib/csapi/event_context.cpp +++ b/lib/csapi/event_context.cpp @@ -12,8 +12,7 @@ using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -class GetEventContextJob::Private -{ +class GetEventContextJob::Private { public: QString begin; QString end; @@ -40,12 +39,10 @@ QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, queryToGetEventContext(limit)); } -static const auto GetEventContextJobName = QStringLiteral("GetEventContextJob"); - GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, Omittable limit) - : BaseJob(HttpVerb::Get, GetEventContextJobName, + : BaseJob(HttpVerb::Get, QStringLiteral("GetEventContextJob"), basePath % "/rooms/" % roomId % "/context/" % eventId, queryToGetEventContext(limit)) , d(new Private) -- 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/event_context.cpp | 67 ++++++++------------------------------------- 1 file changed, 12 insertions(+), 55 deletions(-) (limited to 'lib/csapi/event_context.cpp') diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp index 5bb2222e..d2a5f522 100644 --- a/lib/csapi/event_context.cpp +++ b/lib/csapi/event_context.cpp @@ -4,79 +4,36 @@ #include "event_context.h" -#include "converters.h" - #include using namespace Quotient; -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class GetEventContextJob::Private { -public: - QString begin; - QString end; - RoomEvents eventsBefore; - RoomEventPtr event; - RoomEvents eventsAfter; - StateEvents state; -}; - -BaseJob::Query queryToGetEventContext(Omittable limit) +auto queryToGetEventContext(Omittable limit, const QString& filter) { BaseJob::Query _q; addParam(_q, QStringLiteral("limit"), limit); + addParam(_q, QStringLiteral("filter"), filter); return _q; } QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, - Omittable limit) + Omittable limit, + const QString& filter) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/rooms/" % roomId % "/context/" + QStringLiteral("/_matrix/client/r0") + % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)); + queryToGetEventContext(limit, filter)); } GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, - Omittable limit) + Omittable limit, + const QString& filter) : BaseJob(HttpVerb::Get, QStringLiteral("GetEventContextJob"), - basePath % "/rooms/" % roomId % "/context/" % eventId, - queryToGetEventContext(limit)) - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/rooms/" % roomId + % "/context/" % eventId, + queryToGetEventContext(limit, filter)) {} - -GetEventContextJob::~GetEventContextJob() = default; - -const QString& GetEventContextJob::begin() const { return d->begin; } - -const QString& GetEventContextJob::end() const { return d->end; } - -RoomEvents&& GetEventContextJob::eventsBefore() -{ - return std::move(d->eventsBefore); -} - -RoomEventPtr&& GetEventContextJob::event() { return std::move(d->event); } - -RoomEvents&& GetEventContextJob::eventsAfter() -{ - return std::move(d->eventsAfter); -} - -StateEvents&& GetEventContextJob::state() { return std::move(d->state); } - -BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - fromJson(json.value("start"_ls), d->begin); - fromJson(json.value("end"_ls), d->end); - fromJson(json.value("events_before"_ls), d->eventsBefore); - fromJson(json.value("event"_ls), d->event); - fromJson(json.value("events_after"_ls), d->eventsAfter); - fromJson(json.value("state"_ls), d->state); - - return Success; -} -- cgit v1.2.3