From e49a842e877d17a1c6cbbb2349c2816639447721 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 May 2018 19:09:57 +0900 Subject: Connection, jobs/generated: Use QStringList instead of QVector QStringList's API is richer, after all. --- lib/connection.cpp | 2 +- lib/connection.h | 4 ++-- lib/jobs/generated/create_room.cpp | 2 +- lib/jobs/generated/create_room.h | 5 +++-- lib/jobs/generated/directory.cpp | 6 +++--- lib/jobs/generated/directory.h | 4 ++-- lib/jobs/generated/list_joined_rooms.cpp | 6 +++--- lib/jobs/generated/list_joined_rooms.h | 4 ++-- lib/jobs/generated/list_public_rooms.cpp | 4 ++-- lib/jobs/generated/list_public_rooms.h | 5 +++-- lib/jobs/generated/versions.cpp | 6 +++--- lib/jobs/generated/versions.h | 4 ++-- 12 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/connection.cpp b/lib/connection.cpp index 05640c66..78ce4777 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -441,7 +441,7 @@ DownloadFileJob* Connection::downloadFile(const QUrl& url, CreateRoomJob* Connection::createRoom(RoomVisibility visibility, const QString& alias, const QString& name, const QString& topic, - const QVector& invites, const QString& presetName, + const QStringList& invites, const QString& presetName, bool isDirect, bool guestsCanJoin, const QVector& initialState, const QVector& invite3pids, diff --git a/lib/connection.h b/lib/connection.h index 22f71eac..3364739b 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -272,8 +272,8 @@ namespace QMatrixClient */ CreateRoomJob* createRoom(RoomVisibility visibility, const QString& alias, const QString& name, const QString& topic, - const QVector& invites, const QString& presetName = {}, bool isDirect = false, - bool guestsCanJoin = false, + const QStringList& invites, const QString& presetName = {}, + bool isDirect = false, bool guestsCanJoin = false, const QVector& initialState = {}, const QVector& invite3pids = {}, const QJsonObject& creationContent = {}); diff --git a/lib/jobs/generated/create_room.cpp b/lib/jobs/generated/create_room.cpp index a417c2b1..0a7eb208 100644 --- a/lib/jobs/generated/create_room.cpp +++ b/lib/jobs/generated/create_room.cpp @@ -41,7 +41,7 @@ class CreateRoomJob::Private QString roomId; }; -CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QVector& invite, const QVector& invite3pid, const QJsonObject& creationContent, const QVector& initialState, const QString& preset, bool isDirect, bool guestCanJoin) +CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QStringList& invite, const QVector& invite3pid, const QJsonObject& creationContent, const QVector& initialState, const QString& preset, bool isDirect, bool guestCanJoin) : BaseJob(HttpVerb::Post, "CreateRoomJob", basePath % "/createRoom") , d(new Private) diff --git a/lib/jobs/generated/create_room.h b/lib/jobs/generated/create_room.h index 8e38774f..88ad7895 100644 --- a/lib/jobs/generated/create_room.h +++ b/lib/jobs/generated/create_room.h @@ -6,8 +6,9 @@ #include "../basejob.h" -#include #include +#include +#include #include "converters.h" @@ -36,7 +37,7 @@ namespace QMatrixClient // Construction/destruction - explicit CreateRoomJob(const QString& visibility = {}, const QString& roomAliasName = {}, const QString& name = {}, const QString& topic = {}, const QVector& invite = {}, const QVector& invite3pid = {}, const QJsonObject& creationContent = {}, const QVector& initialState = {}, const QString& preset = {}, bool isDirect = {}, bool guestCanJoin = {}); + explicit CreateRoomJob(const QString& visibility = {}, const QString& roomAliasName = {}, const QString& name = {}, const QString& topic = {}, const QStringList& invite = {}, const QVector& invite3pid = {}, const QJsonObject& creationContent = {}, const QVector& initialState = {}, const QString& preset = {}, bool isDirect = {}, bool guestCanJoin = {}); ~CreateRoomJob() override; // Result properties diff --git a/lib/jobs/generated/directory.cpp b/lib/jobs/generated/directory.cpp index 6324a1f5..3066ebe2 100644 --- a/lib/jobs/generated/directory.cpp +++ b/lib/jobs/generated/directory.cpp @@ -26,7 +26,7 @@ class GetRoomIdByAliasJob::Private { public: QString roomId; - QVector servers; + QStringList servers; }; QUrl GetRoomIdByAliasJob::makeRequestUrl(QUrl baseUrl, const QString& roomAlias) @@ -49,7 +49,7 @@ const QString& GetRoomIdByAliasJob::roomId() const return d->roomId; } -const QVector& GetRoomIdByAliasJob::servers() const +const QStringList& GetRoomIdByAliasJob::servers() const { return d->servers; } @@ -58,7 +58,7 @@ BaseJob::Status GetRoomIdByAliasJob::parseJson(const QJsonDocument& data) { auto json = data.object(); d->roomId = fromJson(json.value("room_id")); - d->servers = fromJson>(json.value("servers")); + d->servers = fromJson(json.value("servers")); return Success; } diff --git a/lib/jobs/generated/directory.h b/lib/jobs/generated/directory.h index e01ba024..861040b6 100644 --- a/lib/jobs/generated/directory.h +++ b/lib/jobs/generated/directory.h @@ -6,7 +6,7 @@ #include "../basejob.h" -#include +#include namespace QMatrixClient @@ -36,7 +36,7 @@ namespace QMatrixClient // Result properties const QString& roomId() const; - const QVector& servers() const; + const QStringList& servers() const; protected: Status parseJson(const QJsonDocument& data) override; diff --git a/lib/jobs/generated/list_joined_rooms.cpp b/lib/jobs/generated/list_joined_rooms.cpp index 8ea44721..82ec8849 100644 --- a/lib/jobs/generated/list_joined_rooms.cpp +++ b/lib/jobs/generated/list_joined_rooms.cpp @@ -15,7 +15,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); class GetJoinedRoomsJob::Private { public: - QVector joinedRooms; + QStringList joinedRooms; }; QUrl GetJoinedRoomsJob::makeRequestUrl(QUrl baseUrl) @@ -33,7 +33,7 @@ GetJoinedRoomsJob::GetJoinedRoomsJob() GetJoinedRoomsJob::~GetJoinedRoomsJob() = default; -const QVector& GetJoinedRoomsJob::joinedRooms() const +const QStringList& GetJoinedRoomsJob::joinedRooms() const { return d->joinedRooms; } @@ -44,7 +44,7 @@ BaseJob::Status GetJoinedRoomsJob::parseJson(const QJsonDocument& data) if (!json.contains("joined_rooms")) return { JsonParseError, "The key 'joined_rooms' not found in the response" }; - d->joinedRooms = fromJson>(json.value("joined_rooms")); + d->joinedRooms = fromJson(json.value("joined_rooms")); return Success; } diff --git a/lib/jobs/generated/list_joined_rooms.h b/lib/jobs/generated/list_joined_rooms.h index 3df2d1ae..442e2cf9 100644 --- a/lib/jobs/generated/list_joined_rooms.h +++ b/lib/jobs/generated/list_joined_rooms.h @@ -6,7 +6,7 @@ #include "../basejob.h" -#include +#include namespace QMatrixClient @@ -29,7 +29,7 @@ namespace QMatrixClient // Result properties - const QVector& joinedRooms() const; + const QStringList& joinedRooms() const; protected: Status parseJson(const QJsonDocument& data) override; diff --git a/lib/jobs/generated/list_public_rooms.cpp b/lib/jobs/generated/list_public_rooms.cpp index 03664def..b27bdd58 100644 --- a/lib/jobs/generated/list_public_rooms.cpp +++ b/lib/jobs/generated/list_public_rooms.cpp @@ -64,7 +64,7 @@ namespace QMatrixClient const auto& o = jv.toObject(); GetPublicRoomsJob::PublicRoomsChunk result; result.aliases = - fromJson>(o.value("aliases")); + fromJson(o.value("aliases")); result.canonicalAlias = fromJson(o.value("canonical_alias")); result.name = @@ -177,7 +177,7 @@ namespace QMatrixClient const auto& o = jv.toObject(); QueryPublicRoomsJob::PublicRoomsChunk result; result.aliases = - fromJson>(o.value("aliases")); + fromJson(o.value("aliases")); result.canonicalAlias = fromJson(o.value("canonical_alias")); result.name = diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index 3e06f21a..46c055b5 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -7,6 +7,7 @@ #include "../basejob.h" #include +#include #include "converters.h" @@ -53,7 +54,7 @@ namespace QMatrixClient struct PublicRoomsChunk { - QVector aliases; + QStringList aliases; QString canonicalAlias; QString name; qint64 numJoinedMembers; @@ -104,7 +105,7 @@ namespace QMatrixClient struct PublicRoomsChunk { - QVector aliases; + QStringList aliases; QString canonicalAlias; QString name; qint64 numJoinedMembers; diff --git a/lib/jobs/generated/versions.cpp b/lib/jobs/generated/versions.cpp index 3b03172c..7b55b94f 100644 --- a/lib/jobs/generated/versions.cpp +++ b/lib/jobs/generated/versions.cpp @@ -15,7 +15,7 @@ static const auto basePath = QStringLiteral("/_matrix/client"); class GetVersionsJob::Private { public: - QVector versions; + QStringList versions; }; QUrl GetVersionsJob::makeRequestUrl(QUrl baseUrl) @@ -33,7 +33,7 @@ GetVersionsJob::GetVersionsJob() GetVersionsJob::~GetVersionsJob() = default; -const QVector& GetVersionsJob::versions() const +const QStringList& GetVersionsJob::versions() const { return d->versions; } @@ -41,7 +41,7 @@ const QVector& GetVersionsJob::versions() const BaseJob::Status GetVersionsJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->versions = fromJson>(json.value("versions")); + d->versions = fromJson(json.value("versions")); return Success; } diff --git a/lib/jobs/generated/versions.h b/lib/jobs/generated/versions.h index 249d3de4..4fe8d9d0 100644 --- a/lib/jobs/generated/versions.h +++ b/lib/jobs/generated/versions.h @@ -6,7 +6,7 @@ #include "../basejob.h" -#include +#include namespace QMatrixClient @@ -29,7 +29,7 @@ namespace QMatrixClient // Result properties - const QVector& versions() const; + const QStringList& versions() const; protected: Status parseJson(const QJsonDocument& data) override; -- cgit v1.2.3