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-06 19:24:03 +0900 |
commit | 21952d689db64bfb11e1cd11a7da802b649f9ae8 (patch) | |
tree | 6983bdff75a28f465f64d67c2ed8cf6ff5b385df /jobs/generated/profile.cpp | |
parent | 905263ceb5e2e13b862bec0a64f6d84eca3c2e9d (diff) | |
download | libquotient-21952d689db64bfb11e1cd11a7da802b649f9ae8.tar.gz libquotient-21952d689db64bfb11e1cd11a7da802b649f9ae8.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; } |