aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-02 19:59:40 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-02 19:59:40 +0900
commitc05ade838f0fce81f2bbe80a3295618a8a26ff52 (patch)
tree763340439a0f4034e9c829d76cb1ffe9766b83c5 /lib/jobs
parent1a1ea8fc87e827fa44c80ff30277e3bee62f4ebb (diff)
downloadlibquotient-c05ade838f0fce81f2bbe80a3295618a8a26ff52.tar.gz
libquotient-c05ade838f0fce81f2bbe80a3295618a8a26ff52.zip
Apply the new brace wrapping to source files
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/basejob.cpp6
-rw-r--r--lib/jobs/basejob.h35
-rw-r--r--lib/jobs/downloadfilejob.cpp7
-rw-r--r--lib/jobs/downloadfilejob.h11
-rw-r--r--lib/jobs/mediathumbnailjob.h6
-rw-r--r--lib/jobs/postreadmarkersjob.h3
-rw-r--r--lib/jobs/requestdata.cpp12
-rw-r--r--lib/jobs/requestdata.h9
-rw-r--r--lib/jobs/syncjob.h6
9 files changed, 27 insertions, 68 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index e4a74954..a6471ece 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -32,8 +32,7 @@
using namespace QMatrixClient;
-struct NetworkReplyDeleter : public QScopedPointerDeleteLater
-{
+struct NetworkReplyDeleter : public QScopedPointerDeleteLater {
static inline void cleanup(QNetworkReply* reply)
{
if (reply && reply->isRunning())
@@ -42,8 +41,7 @@ struct NetworkReplyDeleter : public QScopedPointerDeleteLater
}
};
-class BaseJob::Private
-{
+class BaseJob::Private {
public:
// Using an idiom from clang-tidy:
// http://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html
diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h
index f445d087..c85d2d90 100644
--- a/lib/jobs/basejob.h
+++ b/lib/jobs/basejob.h
@@ -28,32 +28,22 @@
class QNetworkReply;
class QSslError;
-namespace QMatrixClient
-{
+namespace QMatrixClient {
class ConnectionData;
-enum class HttpVerb
-{
- Get,
- Put,
- Post,
- Delete
-};
+enum class HttpVerb { Get, Put, Post, Delete };
-struct JobTimeoutConfig
-{
+struct JobTimeoutConfig {
int jobTimeout;
int nextRetryInterval;
};
-class BaseJob : public QObject
-{
+class BaseJob : public QObject {
Q_OBJECT
Q_PROPERTY(QUrl requestUrl READ requestUrl CONSTANT)
Q_PROPERTY(int maxRetries READ maxRetries WRITE setMaxRetries)
public:
- enum StatusCode
- {
+ enum StatusCode {
NoError = 0 // To be compatible with Qt conventions
,
Success = 0,
@@ -93,8 +83,7 @@ public:
* A simple wrapper around QUrlQuery that allows its creation from
* a list of string pairs
*/
- class Query : public QUrlQuery
- {
+ class Query : public QUrlQuery {
public:
using QUrlQuery::QUrlQuery;
Query() = default;
@@ -115,16 +104,10 @@ public:
* along the lines of StatusCode, with additional values
* starting at UserDefinedError
*/
- class Status
- {
+ class Status {
public:
- Status(StatusCode c)
- : code(c)
- {}
- Status(int c, QString m)
- : code(c)
- , message(std::move(m))
- {}
+ Status(StatusCode c) : code(c) {}
+ Status(int c, QString m) : code(c), message(std::move(m)) {}
bool good() const { return code < ErrorLevel; }
friend QDebug operator<<(QDebug dbg, const Status& s)
diff --git a/lib/jobs/downloadfilejob.cpp b/lib/jobs/downloadfilejob.cpp
index 3dff5a68..9722186c 100644
--- a/lib/jobs/downloadfilejob.cpp
+++ b/lib/jobs/downloadfilejob.cpp
@@ -6,12 +6,9 @@
using namespace QMatrixClient;
-class DownloadFileJob::Private
-{
+class DownloadFileJob::Private {
public:
- Private()
- : tempFile(new QTemporaryFile())
- {}
+ Private() : tempFile(new QTemporaryFile()) {}
explicit Private(const QString& localFilename)
: targetFile(new QFile(localFilename))
diff --git a/lib/jobs/downloadfilejob.h b/lib/jobs/downloadfilejob.h
index 58858448..ebfe5a0d 100644
--- a/lib/jobs/downloadfilejob.h
+++ b/lib/jobs/downloadfilejob.h
@@ -2,15 +2,10 @@
#include "csapi/content-repo.h"
-namespace QMatrixClient
-{
-class DownloadFileJob : public GetContentJob
-{
+namespace QMatrixClient {
+class DownloadFileJob : public GetContentJob {
public:
- enum
- {
- FileError = BaseJob::UserDefinedError + 1
- };
+ enum { FileError = BaseJob::UserDefinedError + 1 };
using GetContentJob::makeRequestUrl;
static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri);
diff --git a/lib/jobs/mediathumbnailjob.h b/lib/jobs/mediathumbnailjob.h
index eeabe7a9..df0a7f31 100644
--- a/lib/jobs/mediathumbnailjob.h
+++ b/lib/jobs/mediathumbnailjob.h
@@ -22,10 +22,8 @@
#include <QtGui/QPixmap>
-namespace QMatrixClient
-{
-class MediaThumbnailJob : public GetContentThumbnailJob
-{
+namespace QMatrixClient {
+class MediaThumbnailJob : public GetContentThumbnailJob {
public:
using GetContentThumbnailJob::makeRequestUrl;
static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri,
diff --git a/lib/jobs/postreadmarkersjob.h b/lib/jobs/postreadmarkersjob.h
index d53ae66c..cf482a9a 100644
--- a/lib/jobs/postreadmarkersjob.h
+++ b/lib/jobs/postreadmarkersjob.h
@@ -24,8 +24,7 @@
using namespace QMatrixClient;
-class PostReadMarkersJob : public BaseJob
-{
+class PostReadMarkersJob : public BaseJob {
public:
explicit PostReadMarkersJob(const QString& roomId,
const QString& readUpToEventId)
diff --git a/lib/jobs/requestdata.cpp b/lib/jobs/requestdata.cpp
index 8248d6b1..6ad7c007 100644
--- a/lib/jobs/requestdata.cpp
+++ b/lib/jobs/requestdata.cpp
@@ -23,16 +23,10 @@ inline auto fromJson(const JsonDataT& jdata)
return fromData(QJsonDocument(jdata).toJson(QJsonDocument::Compact));
}
-RequestData::RequestData(const QByteArray& a)
- : _source(fromData(a))
-{}
+RequestData::RequestData(const QByteArray& a) : _source(fromData(a)) {}
-RequestData::RequestData(const QJsonObject& jo)
- : _source(fromJson(jo))
-{}
+RequestData::RequestData(const QJsonObject& jo) : _source(fromJson(jo)) {}
-RequestData::RequestData(const QJsonArray& ja)
- : _source(fromJson(ja))
-{}
+RequestData::RequestData(const QJsonArray& ja) : _source(fromJson(ja)) {}
RequestData::~RequestData() = default;
diff --git a/lib/jobs/requestdata.h b/lib/jobs/requestdata.h
index 974a9ddf..55987a3b 100644
--- a/lib/jobs/requestdata.h
+++ b/lib/jobs/requestdata.h
@@ -26,23 +26,20 @@ class QJsonArray;
class QJsonDocument;
class QIODevice;
-namespace QMatrixClient
-{
+namespace QMatrixClient {
/**
* A simple wrapper that represents the request body.
* Provides a unified interface to dump an unstructured byte stream
* as well as JSON (and possibly other structures in the future) to
* a QByteArray consumed by QNetworkAccessManager request methods.
*/
-class RequestData
-{
+class RequestData {
public:
RequestData() = default;
RequestData(const QByteArray& a);
RequestData(const QJsonObject& jo);
RequestData(const QJsonArray& ja);
- RequestData(QIODevice* source)
- : _source(std::unique_ptr<QIODevice>(source))
+ RequestData(QIODevice* source) : _source(std::unique_ptr<QIODevice>(source))
{}
RequestData(const RequestData&) = delete;
RequestData& operator=(const RequestData&) = delete;
diff --git a/lib/jobs/syncjob.h b/lib/jobs/syncjob.h
index e2cec8f7..8f925414 100644
--- a/lib/jobs/syncjob.h
+++ b/lib/jobs/syncjob.h
@@ -22,10 +22,8 @@
#include "../syncdata.h"
#include "basejob.h"
-namespace QMatrixClient
-{
-class SyncJob : public BaseJob
-{
+namespace QMatrixClient {
+class SyncJob : public BaseJob {
public:
explicit SyncJob(const QString& since = {}, const QString& filter = {},
int timeout = -1, const QString& presence = {});