diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-20 18:16:19 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-22 14:03:40 +0200 |
commit | 610631675826bb572bff97ce7d16d07097f14e3f (patch) | |
tree | 03bcd2b0e02773af0281cc3727c976bd7cc523d0 /lib/jobs | |
parent | 04db5b6d853f3084660612c1d2db91d54ec63691 (diff) | |
download | libquotient-610631675826bb572bff97ce7d16d07097f14e3f.tar.gz libquotient-610631675826bb572bff97ce7d16d07097f14e3f.zip |
Clean up RequestData from Sonar warnings
Also: make ImplPtr more flexible.
Diffstat (limited to 'lib/jobs')
-rw-r--r-- | lib/jobs/requestdata.cpp | 6 | ||||
-rw-r--r-- | lib/jobs/requestdata.h | 22 |
2 files changed, 11 insertions, 17 deletions
diff --git a/lib/jobs/requestdata.cpp b/lib/jobs/requestdata.cpp index 2c001ccc..ab249f6d 100644 --- a/lib/jobs/requestdata.cpp +++ b/lib/jobs/requestdata.cpp @@ -14,7 +14,7 @@ using namespace Quotient; auto fromData(const QByteArray& data) { - auto source = std::make_unique<QBuffer>(); + auto source = makeImpl<QBuffer, QIODevice>(); source->setData(data); source->open(QIODevice::ReadOnly); return source; @@ -33,7 +33,5 @@ RequestData::RequestData(const QJsonObject& jo) : _source(fromJson(jo)) {} RequestData::RequestData(const QJsonArray& ja) : _source(fromJson(ja)) {} RequestData::RequestData(QIODevice* source) - : _source(std::unique_ptr<QIODevice>(source)) + : _source(acquireImpl(source)) {} - -RequestData::~RequestData() = default; diff --git a/lib/jobs/requestdata.h b/lib/jobs/requestdata.h index 41ad833a..accc8f71 100644 --- a/lib/jobs/requestdata.h +++ b/lib/jobs/requestdata.h @@ -3,11 +3,7 @@ #pragma once -#include "quotient_export.h" - -#include <QtCore/QByteArray> - -#include <memory> +#include "util.h" class QJsonObject; class QJsonArray; @@ -23,17 +19,17 @@ namespace Quotient { */ class QUOTIENT_API RequestData { public: - RequestData(const QByteArray& a = {}); - RequestData(const QJsonObject& jo); - RequestData(const QJsonArray& ja); - RequestData(QIODevice* source); - RequestData(RequestData&&) = default; - RequestData& operator=(RequestData&&) = default; - ~RequestData(); + // NOLINTBEGIN(google-explicit-constructor): that check should learn about + // explicit(false) + QUO_IMPLICIT RequestData(const QByteArray& a = {}); + QUO_IMPLICIT RequestData(const QJsonObject& jo); + QUO_IMPLICIT RequestData(const QJsonArray& ja); + QUO_IMPLICIT RequestData(QIODevice* source); + // NOLINTEND(google-explicit-constructor) QIODevice* source() const { return _source.get(); } private: - std::unique_ptr<QIODevice> _source; + ImplPtr<QIODevice> _source; }; } // namespace Quotient |