aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-06 19:24:03 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-06 19:24:03 +0900
commit21952d689db64bfb11e1cd11a7da802b649f9ae8 (patch)
tree6983bdff75a28f465f64d67c2ed8cf6ff5b385df
parent905263ceb5e2e13b862bec0a64f6d84eca3c2e9d (diff)
downloadlibquotient-21952d689db64bfb11e1cd11a7da802b649f9ae8.tar.gz
libquotient-21952d689db64bfb11e1cd11a7da802b649f9ae8.zip
jobs/generated: don't rely on QString's COW; firmer formatting
-rw-r--r--jobs/generated/banning.cpp5
-rw-r--r--jobs/generated/banning.h9
-rw-r--r--jobs/generated/inviting.cpp3
-rw-r--r--jobs/generated/inviting.h5
-rw-r--r--jobs/generated/kicking.cpp3
-rw-r--r--jobs/generated/kicking.h5
-rw-r--r--jobs/generated/leaving.cpp5
-rw-r--r--jobs/generated/leaving.h9
-rw-r--r--jobs/generated/login.cpp9
-rw-r--r--jobs/generated/login.h5
-rw-r--r--jobs/generated/logout.cpp1
-rw-r--r--jobs/generated/logout.h3
-rw-r--r--jobs/generated/profile.cpp21
-rw-r--r--jobs/generated/profile.h21
14 files changed, 37 insertions, 67 deletions
diff --git a/jobs/generated/banning.cpp b/jobs/generated/banning.cpp
index 67b0e8a1..61677da6 100644
--- a/jobs/generated/banning.cpp
+++ b/jobs/generated/banning.cpp
@@ -6,13 +6,14 @@
#include "banning.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-BanJob::BanJob(QString roomId, QString userId, QString reason)
+BanJob::BanJob(const QString& roomId, const QString& userId, const QString& reason)
: BaseJob(HttpVerb::Post, "BanJob",
basePath % "/rooms/" % roomId % "/ban",
Query { }
@@ -25,7 +26,7 @@ BanJob::BanJob(QString roomId, QString userId, QString reason)
setRequestData(_data);
}
-UnbanJob::UnbanJob(QString roomId, QString userId)
+UnbanJob::UnbanJob(const QString& roomId, const QString& userId)
: BaseJob(HttpVerb::Post, "UnbanJob",
basePath % "/rooms/" % roomId % "/unban",
Query { }
diff --git a/jobs/generated/banning.h b/jobs/generated/banning.h
index e225a6ef..6db096ee 100644
--- a/jobs/generated/banning.h
+++ b/jobs/generated/banning.h
@@ -12,20 +12,17 @@
namespace QMatrixClient
{
-
// Operations
class BanJob : public BaseJob
{
public:
- explicit BanJob(QString roomId, QString userId, QString reason = {});
-
+ explicit BanJob(const QString& roomId, const QString& userId, const QString& reason = {});
};
+
class UnbanJob : public BaseJob
{
public:
- explicit UnbanJob(QString roomId, QString userId);
-
+ explicit UnbanJob(const QString& roomId, const QString& userId);
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/inviting.cpp b/jobs/generated/inviting.cpp
index e72bf734..78c9a2f6 100644
--- a/jobs/generated/inviting.cpp
+++ b/jobs/generated/inviting.cpp
@@ -6,13 +6,14 @@
#include "inviting.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-InviteUserJob::InviteUserJob(QString roomId, QString userId)
+InviteUserJob::InviteUserJob(const QString& roomId, const QString& userId)
: BaseJob(HttpVerb::Post, "InviteUserJob",
basePath % "/rooms/" % roomId % "/invite",
Query { }
diff --git a/jobs/generated/inviting.h b/jobs/generated/inviting.h
index e4b61beb..225cb516 100644
--- a/jobs/generated/inviting.h
+++ b/jobs/generated/inviting.h
@@ -12,14 +12,11 @@
namespace QMatrixClient
{
-
// Operations
class InviteUserJob : public BaseJob
{
public:
- explicit InviteUserJob(QString roomId, QString userId);
-
+ explicit InviteUserJob(const QString& roomId, const QString& userId);
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp
index a0719aa2..5d6f1a64 100644
--- a/jobs/generated/kicking.cpp
+++ b/jobs/generated/kicking.cpp
@@ -6,13 +6,14 @@
#include "kicking.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-KickJob::KickJob(QString roomId, QString userId, QString reason)
+KickJob::KickJob(const QString& roomId, const QString& userId, const QString& reason)
: BaseJob(HttpVerb::Post, "KickJob",
basePath % "/rooms/" % roomId % "/kick",
Query { }
diff --git a/jobs/generated/kicking.h b/jobs/generated/kicking.h
index e7daada8..7c834e45 100644
--- a/jobs/generated/kicking.h
+++ b/jobs/generated/kicking.h
@@ -12,14 +12,11 @@
namespace QMatrixClient
{
-
// Operations
class KickJob : public BaseJob
{
public:
- explicit KickJob(QString roomId, QString userId, QString reason = {});
-
+ explicit KickJob(const QString& roomId, const QString& userId, const QString& reason = {});
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/leaving.cpp b/jobs/generated/leaving.cpp
index 392f1ca8..2cf7fda3 100644
--- a/jobs/generated/leaving.cpp
+++ b/jobs/generated/leaving.cpp
@@ -6,20 +6,21 @@
#include "leaving.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-LeaveRoomJob::LeaveRoomJob(QString roomId)
+LeaveRoomJob::LeaveRoomJob(const QString& roomId)
: BaseJob(HttpVerb::Post, "LeaveRoomJob",
basePath % "/rooms/" % roomId % "/leave",
Query { }
)
{ }
-ForgetRoomJob::ForgetRoomJob(QString roomId)
+ForgetRoomJob::ForgetRoomJob(const QString& roomId)
: BaseJob(HttpVerb::Post, "ForgetRoomJob",
basePath % "/rooms/" % roomId % "/forget",
Query { }
diff --git a/jobs/generated/leaving.h b/jobs/generated/leaving.h
index 96304084..28ba3d92 100644
--- a/jobs/generated/leaving.h
+++ b/jobs/generated/leaving.h
@@ -12,20 +12,17 @@
namespace QMatrixClient
{
-
// Operations
class LeaveRoomJob : public BaseJob
{
public:
- explicit LeaveRoomJob(QString roomId);
-
+ explicit LeaveRoomJob(const QString& roomId);
};
+
class ForgetRoomJob : public BaseJob
{
public:
- explicit ForgetRoomJob(QString roomId);
-
+ explicit ForgetRoomJob(const QString& roomId);
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/login.cpp b/jobs/generated/login.cpp
index 7bd905ee..892d0c81 100644
--- a/jobs/generated/login.cpp
+++ b/jobs/generated/login.cpp
@@ -6,6 +6,7 @@
#include "login.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
@@ -19,10 +20,9 @@ class LoginJob::Private
QString accessToken;
QString homeServer;
QString deviceId;
-
};
-LoginJob::LoginJob(QString type, QString user, QString medium, QString address, QString password, QString token, QString deviceId, QString initialDeviceDisplayName)
+LoginJob::LoginJob(const QString& type, const QString& user, const QString& medium, const QString& address, const QString& password, const QString& token, const QString& deviceId, const QString& initialDeviceDisplayName)
: BaseJob(HttpVerb::Post, "LoginJob",
basePath % "/login",
Query { }, Data { }, false
@@ -75,15 +75,10 @@ const QString& LoginJob::deviceId() const
BaseJob::Status LoginJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
-
d->userId = fromJson<QString>(json.value("user_id"));
-
d->accessToken = fromJson<QString>(json.value("access_token"));
-
d->homeServer = fromJson<QString>(json.value("home_server"));
-
d->deviceId = fromJson<QString>(json.value("device_id"));
-
return Success;
}
diff --git a/jobs/generated/login.h b/jobs/generated/login.h
index 8fcca09a..1c017877 100644
--- a/jobs/generated/login.h
+++ b/jobs/generated/login.h
@@ -12,14 +12,12 @@
namespace QMatrixClient
{
-
// Operations
class LoginJob : public BaseJob
{
public:
- explicit LoginJob(QString type, QString user = {}, QString medium = {}, QString address = {}, QString password = {}, QString token = {}, QString deviceId = {}, QString initialDeviceDisplayName = {});
-
+ explicit LoginJob(const QString& type, const QString& user = {}, const QString& medium = {}, const QString& address = {}, const QString& password = {}, const QString& token = {}, const QString& deviceId = {}, const QString& initialDeviceDisplayName = {});
~LoginJob() override;
const QString& userId() const;
@@ -34,5 +32,4 @@ namespace QMatrixClient
class Private;
Private* d;
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/logout.cpp b/jobs/generated/logout.cpp
index c2480ff9..c250bddf 100644
--- a/jobs/generated/logout.cpp
+++ b/jobs/generated/logout.cpp
@@ -6,6 +6,7 @@
#include "logout.h"
#include "converters.h"
+
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
diff --git a/jobs/generated/logout.h b/jobs/generated/logout.h
index 28e85d8f..ae9e54b8 100644
--- a/jobs/generated/logout.h
+++ b/jobs/generated/logout.h
@@ -11,14 +11,11 @@
namespace QMatrixClient
{
-
// Operations
class LogoutJob : public BaseJob
{
public:
explicit LogoutJob();
-
};
-
} // namespace QMatrixClient
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;
}
diff --git a/jobs/generated/profile.h b/jobs/generated/profile.h
index cd460ac3..30e858de 100644
--- a/jobs/generated/profile.h
+++ b/jobs/generated/profile.h
@@ -12,20 +12,18 @@
namespace QMatrixClient
{
-
// Operations
class SetDisplayNameJob : public BaseJob
{
public:
- explicit SetDisplayNameJob(QString userId, QString displayname = {});
-
+ explicit SetDisplayNameJob(const QString& userId, const QString& displayname = {});
};
+
class GetDisplayNameJob : public BaseJob
{
public:
- explicit GetDisplayNameJob(QString userId);
-
+ explicit GetDisplayNameJob(const QString& userId);
~GetDisplayNameJob() override;
const QString& displayname() const;
@@ -37,17 +35,17 @@ namespace QMatrixClient
class Private;
Private* d;
};
+
class SetAvatarUrlJob : public BaseJob
{
public:
- explicit SetAvatarUrlJob(QString userId, QString avatarUrl = {});
-
+ explicit SetAvatarUrlJob(const QString& userId, const QString& avatarUrl = {});
};
+
class GetAvatarUrlJob : public BaseJob
{
public:
- explicit GetAvatarUrlJob(QString userId);
-
+ explicit GetAvatarUrlJob(const QString& userId);
~GetAvatarUrlJob() override;
const QString& avatarUrl() const;
@@ -59,11 +57,11 @@ namespace QMatrixClient
class Private;
Private* d;
};
+
class GetUserProfileJob : public BaseJob
{
public:
- explicit GetUserProfileJob(QString userId);
-
+ explicit GetUserProfileJob(const QString& userId);
~GetUserProfileJob() override;
const QString& avatarUrl() const;
@@ -76,5 +74,4 @@ namespace QMatrixClient
class Private;
Private* d;
};
-
} // namespace QMatrixClient