From 4ced9792f27ed3d891c1f7772ae30d9fe452dd79 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 14 Apr 2018 14:12:03 +0900 Subject: jobs/generated: Overload toJson() instead of operator QJsonObject()/QJsonValue() It slightly reduces the header interface and shortcuts the actual call chain (not that it had any performance implications, just easier reasoning). --- lib/jobs/generated/list_public_rooms.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'lib/jobs/generated/list_public_rooms.h') diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index 5c281de3..c8adccb4 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -14,6 +14,35 @@ namespace QMatrixClient { // Operations + class GetRoomVisibilityOnDirectoryJob : public BaseJob + { + public: + /** Construct a URL out of baseUrl and usual parameters passed to + * GetRoomVisibilityOnDirectoryJob. This function can be used when + * a URL for GetRoomVisibilityOnDirectoryJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); + + explicit GetRoomVisibilityOnDirectoryJob(const QString& roomId); + ~GetRoomVisibilityOnDirectoryJob() override; + + const QString& visibility() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer d; + }; + + class SetRoomVisibilityOnDirectoryJob : public BaseJob + { + public: + explicit SetRoomVisibilityOnDirectoryJob(const QString& roomId, const QString& visibility = {}); + }; + class GetPublicRoomsJob : public BaseJob { public: @@ -31,7 +60,6 @@ namespace QMatrixClient bool guestCanJoin; QString avatarUrl; - operator QJsonObject() const; }; // End of inner data structures @@ -68,7 +96,6 @@ namespace QMatrixClient { QString genericSearchTerm; - operator QJsonObject() const; }; struct PublicRoomsChunk @@ -83,7 +110,6 @@ namespace QMatrixClient bool guestCanJoin; QString avatarUrl; - operator QJsonObject() const; }; // End of inner data structures -- cgit v1.2.3 From 38934c2310b426be640988dc10f48de88a3d92bc Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 1 May 2018 20:04:51 +0900 Subject: jobs/generated: use std::move in baseURL; type updates from the API files The type updates are a matter of pending PR to matrix-doc yet. --- lib/jobs/generated/list_public_rooms.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/jobs/generated/list_public_rooms.h') diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index c8adccb4..1e44e8b2 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -53,7 +53,7 @@ namespace QMatrixClient QVector aliases; QString canonicalAlias; QString name; - double numJoinedMembers; + qint64 numJoinedMembers; QString roomId; QString topic; bool worldReadable; @@ -69,15 +69,15 @@ namespace QMatrixClient * a URL for GetPublicRoomsJob is necessary but the job * itself isn't. */ - static QUrl makeRequestUrl(QUrl baseUrl, double limit = {}, const QString& since = {}, const QString& server = {}); + static QUrl makeRequestUrl(QUrl baseUrl, int limit = {}, const QString& since = {}, const QString& server = {}); - explicit GetPublicRoomsJob(double limit = {}, const QString& since = {}, const QString& server = {}); + explicit GetPublicRoomsJob(int limit = {}, const QString& since = {}, const QString& server = {}); ~GetPublicRoomsJob() override; const QVector& chunk() const; const QString& nextBatch() const; const QString& prevBatch() const; - double totalRoomCountEstimate() const; + qint64 totalRoomCountEstimate() const; protected: Status parseJson(const QJsonDocument& data) override; @@ -103,7 +103,7 @@ namespace QMatrixClient QVector aliases; QString canonicalAlias; QString name; - double numJoinedMembers; + qint64 numJoinedMembers; QString roomId; QString topic; bool worldReadable; @@ -114,13 +114,13 @@ namespace QMatrixClient // End of inner data structures - explicit QueryPublicRoomsJob(const QString& server = {}, double limit = {}, const QString& since = {}, const Filter& filter = {}); + explicit QueryPublicRoomsJob(const QString& server = {}, int limit = {}, const QString& since = {}, const Filter& filter = {}); ~QueryPublicRoomsJob() override; const QVector& chunk() const; const QString& nextBatch() const; const QString& prevBatch() const; - double totalRoomCountEstimate() const; + qint64 totalRoomCountEstimate() const; protected: Status parseJson(const QJsonDocument& data) override; -- cgit v1.2.3 From f3927ca0c16a61fcb0933333ecff8095917a5b47 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 May 2018 20:10:14 +0900 Subject: jobs/generated: Drop unused code --- lib/jobs/generated/list_public_rooms.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/jobs/generated/list_public_rooms.h') diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index 1e44e8b2..8e8fddca 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -59,7 +59,6 @@ namespace QMatrixClient bool worldReadable; bool guestCanJoin; QString avatarUrl; - }; // End of inner data structures @@ -95,7 +94,6 @@ namespace QMatrixClient struct Filter { QString genericSearchTerm; - }; struct PublicRoomsChunk @@ -109,7 +107,6 @@ namespace QMatrixClient bool worldReadable; bool guestCanJoin; QString avatarUrl; - }; // End of inner data structures -- cgit v1.2.3 From c71c4eb027cc7bb3b6b1a9bd41c048fcdfe4aa90 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 May 2018 19:02:39 +0900 Subject: jobs/generated: code ordering, more comments --- lib/jobs/generated/list_public_rooms.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/jobs/generated/list_public_rooms.h') diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h index 8e8fddca..3e06f21a 100644 --- a/lib/jobs/generated/list_public_rooms.h +++ b/lib/jobs/generated/list_public_rooms.h @@ -17,6 +17,8 @@ namespace QMatrixClient class GetRoomVisibilityOnDirectoryJob : public BaseJob { public: + explicit GetRoomVisibilityOnDirectoryJob(const QString& roomId); + /** Construct a URL out of baseUrl and usual parameters passed to * GetRoomVisibilityOnDirectoryJob. This function can be used when * a URL for GetRoomVisibilityOnDirectoryJob is necessary but the job @@ -24,9 +26,10 @@ namespace QMatrixClient */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - explicit GetRoomVisibilityOnDirectoryJob(const QString& roomId); ~GetRoomVisibilityOnDirectoryJob() override; + // Result properties + const QString& visibility() const; protected: @@ -61,7 +64,9 @@ namespace QMatrixClient QString avatarUrl; }; - // End of inner data structures + // Construction/destruction + + explicit GetPublicRoomsJob(int limit = {}, const QString& since = {}, const QString& server = {}); /** Construct a URL out of baseUrl and usual parameters passed to * GetPublicRoomsJob. This function can be used when @@ -70,9 +75,10 @@ namespace QMatrixClient */ static QUrl makeRequestUrl(QUrl baseUrl, int limit = {}, const QString& since = {}, const QString& server = {}); - explicit GetPublicRoomsJob(int limit = {}, const QString& since = {}, const QString& server = {}); ~GetPublicRoomsJob() override; + // Result properties + const QVector& chunk() const; const QString& nextBatch() const; const QString& prevBatch() const; @@ -109,11 +115,13 @@ namespace QMatrixClient QString avatarUrl; }; - // End of inner data structures + // Construction/destruction explicit QueryPublicRoomsJob(const QString& server = {}, int limit = {}, const QString& since = {}, const Filter& filter = {}); ~QueryPublicRoomsJob() override; + // Result properties + const QVector& chunk() const; const QString& nextBatch() const; const QString& prevBatch() const; -- cgit v1.2.3 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/jobs/generated/list_public_rooms.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/jobs/generated/list_public_rooms.h') 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; -- cgit v1.2.3 From 49022915fde72b83d9f18944c268110b01fa3469 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 May 2018 23:04:04 +0900 Subject: New home for the generated code - lib/csapi --- lib/jobs/generated/list_public_rooms.h | 138 --------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 lib/jobs/generated/list_public_rooms.h (limited to 'lib/jobs/generated/list_public_rooms.h') diff --git a/lib/jobs/generated/list_public_rooms.h b/lib/jobs/generated/list_public_rooms.h deleted file mode 100644 index 46c055b5..00000000 --- a/lib/jobs/generated/list_public_rooms.h +++ /dev/null @@ -1,138 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "../basejob.h" - -#include -#include - -#include "converters.h" - -namespace QMatrixClient -{ - // Operations - - class GetRoomVisibilityOnDirectoryJob : public BaseJob - { - public: - explicit GetRoomVisibilityOnDirectoryJob(const QString& roomId); - - /** Construct a URL out of baseUrl and usual parameters passed to - * GetRoomVisibilityOnDirectoryJob. This function can be used when - * a URL for GetRoomVisibilityOnDirectoryJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - - ~GetRoomVisibilityOnDirectoryJob() override; - - // Result properties - - const QString& visibility() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer d; - }; - - class SetRoomVisibilityOnDirectoryJob : public BaseJob - { - public: - explicit SetRoomVisibilityOnDirectoryJob(const QString& roomId, const QString& visibility = {}); - }; - - class GetPublicRoomsJob : public BaseJob - { - public: - // Inner data structures - - struct PublicRoomsChunk - { - QStringList aliases; - QString canonicalAlias; - QString name; - qint64 numJoinedMembers; - QString roomId; - QString topic; - bool worldReadable; - bool guestCanJoin; - QString avatarUrl; - }; - - // Construction/destruction - - explicit GetPublicRoomsJob(int limit = {}, const QString& since = {}, const QString& server = {}); - - /** Construct a URL out of baseUrl and usual parameters passed to - * GetPublicRoomsJob. This function can be used when - * a URL for GetPublicRoomsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, int limit = {}, const QString& since = {}, const QString& server = {}); - - ~GetPublicRoomsJob() override; - - // Result properties - - const QVector& chunk() const; - const QString& nextBatch() const; - const QString& prevBatch() const; - qint64 totalRoomCountEstimate() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer d; - }; - - class QueryPublicRoomsJob : public BaseJob - { - public: - // Inner data structures - - struct Filter - { - QString genericSearchTerm; - }; - - struct PublicRoomsChunk - { - QStringList aliases; - QString canonicalAlias; - QString name; - qint64 numJoinedMembers; - QString roomId; - QString topic; - bool worldReadable; - bool guestCanJoin; - QString avatarUrl; - }; - - // Construction/destruction - - explicit QueryPublicRoomsJob(const QString& server = {}, int limit = {}, const QString& since = {}, const Filter& filter = {}); - ~QueryPublicRoomsJob() override; - - // Result properties - - const QVector& chunk() const; - const QString& nextBatch() const; - const QString& prevBatch() const; - qint64 totalRoomCountEstimate() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer d; - }; -} // namespace QMatrixClient -- cgit v1.2.3