diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-06 19:24:03 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 12:35:50 +0900 |
commit | c18b0c5be800a39898b6f6619209d1f96d022afa (patch) | |
tree | 1076eac90f1bc1918b3adbb82a17f8b6ad9b86d7 /jobs/generated/profile.cpp | |
parent | 15b2ea9e4e7077b8547f5f7f39156b0227c338e8 (diff) | |
download | libquotient-c18b0c5be800a39898b6f6619209d1f96d022afa.tar.gz libquotient-c18b0c5be800a39898b6f6619209d1f96d022afa.zip |
jobs/generated: don't rely on QString's COW; firmer formatting
Diffstat (limited to 'jobs/generated/profile.cpp')
-rw-r--r-- | jobs/generated/profile.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/jobs/generated/profile.cpp b/jobs/generated/profile.cpp index f682ad31..42a2350f 100644 --- a/jobs/generated/profile.cpp +++ b/jobs/generated/profile.cpp @@ -6,13 +6,14 @@ #include "profile.h" #include "converters.h" + #include <QtCore/QStringBuilder> using namespace QMatrixClient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -SetDisplayNameJob::SetDisplayNameJob(QString userId, QString displayname) +SetDisplayNameJob::SetDisplayNameJob(const QString& userId, const QString& displayname) : BaseJob(HttpVerb::Put, "SetDisplayNameJob", basePath % "/profile/" % userId % "/displayname", Query { } @@ -28,10 +29,9 @@ class GetDisplayNameJob::Private { public: QString displayname; - }; -GetDisplayNameJob::GetDisplayNameJob(QString userId) +GetDisplayNameJob::GetDisplayNameJob(const QString& userId) : BaseJob(HttpVerb::Get, "GetDisplayNameJob", basePath % "/profile/" % userId % "/displayname", Query { }, Data { }, false @@ -51,13 +51,11 @@ const QString& GetDisplayNameJob::displayname() const BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->displayname = fromJson<QString>(json.value("displayname")); - return Success; } -SetAvatarUrlJob::SetAvatarUrlJob(QString userId, QString avatarUrl) +SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl) : BaseJob(HttpVerb::Put, "SetAvatarUrlJob", basePath % "/profile/" % userId % "/avatar_url", Query { } @@ -73,10 +71,9 @@ class GetAvatarUrlJob::Private { public: QString avatarUrl; - }; -GetAvatarUrlJob::GetAvatarUrlJob(QString userId) +GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId) : BaseJob(HttpVerb::Get, "GetAvatarUrlJob", basePath % "/profile/" % userId % "/avatar_url", Query { }, Data { }, false @@ -96,9 +93,7 @@ const QString& GetAvatarUrlJob::avatarUrl() const BaseJob::Status GetAvatarUrlJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->avatarUrl = fromJson<QString>(json.value("avatar_url")); - return Success; } @@ -107,10 +102,9 @@ class GetUserProfileJob::Private public: QString avatarUrl; QString displayname; - }; -GetUserProfileJob::GetUserProfileJob(QString userId) +GetUserProfileJob::GetUserProfileJob(const QString& userId) : BaseJob(HttpVerb::Get, "GetUserProfileJob", basePath % "/profile/" % userId, Query { }, Data { }, false @@ -135,11 +129,8 @@ const QString& GetUserProfileJob::displayname() const BaseJob::Status GetUserProfileJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->avatarUrl = fromJson<QString>(json.value("avatar_url")); - d->displayname = fromJson<QString>(json.value("displayname")); - return Success; } |