From 5ea07c5d47fbb2246afe4fdf1a9df195aa72cbec Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 17 Sep 2022 00:06:39 +0200 Subject: [PATCH] const ref for everyone --- src/common/APIRequest.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/common/APIRequest.hpp b/src/common/APIRequest.hpp index ebabaf8c7..1739f83cc 100644 --- a/src/common/APIRequest.hpp +++ b/src/common/APIRequest.hpp @@ -55,9 +55,10 @@ public: */ explicit APIRequest( QUrl url, NetworkRequestType requestType, - std::function successTransformer, - std::function errorTransformer = nullptr, - std::function onFinally = nullptr) + const std::function &successTransformer, + const std::function &errorTransformer = + nullptr, + const std::function &onFinally = nullptr) : underlying_(std::move(url), requestType) , data_(std::make_shared>()) { @@ -97,19 +98,19 @@ public: return std::move(*this); } - APIRequest onError(APIErrorCallback cb) && + APIRequest onError(const APIErrorCallback &cb) && { this->data_->onError = cb; return std::move(*this); }; - APIRequest onSuccess(APISuceessCallback cb) && + APIRequest onSuccess(const APISuceessCallback &cb) && { this->data_->onSuccess = cb; return std::move(*this); }; - APIRequest finally(APIFinallyCallback cb) && + APIRequest finally(const APIFinallyCallback &cb) && { this->data_->finally = cb; return std::move(*this);