mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
const ref for everyone
This commit is contained in:
parent
10f771c634
commit
5ea07c5d47
1 changed files with 7 additions and 6 deletions
|
@ -55,9 +55,10 @@ public:
|
||||||
*/
|
*/
|
||||||
explicit APIRequest(
|
explicit APIRequest(
|
||||||
QUrl url, NetworkRequestType requestType,
|
QUrl url, NetworkRequestType requestType,
|
||||||
std::function<OkType(NetworkResult)> successTransformer,
|
const std::function<OkType(NetworkResult)> &successTransformer,
|
||||||
std::function<ErrorType(NetworkResult)> errorTransformer = nullptr,
|
const std::function<ErrorType(NetworkResult)> &errorTransformer =
|
||||||
std::function<void()> onFinally = nullptr)
|
nullptr,
|
||||||
|
const std::function<void()> &onFinally = nullptr)
|
||||||
: underlying_(std::move(url), requestType)
|
: underlying_(std::move(url), requestType)
|
||||||
, data_(std::make_shared<APIRequestData<OkType, ErrorType>>())
|
, data_(std::make_shared<APIRequestData<OkType, ErrorType>>())
|
||||||
{
|
{
|
||||||
|
@ -97,19 +98,19 @@ public:
|
||||||
return std::move(*this);
|
return std::move(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
APIRequest<OkType, ErrorType> onError(APIErrorCallback cb) &&
|
APIRequest<OkType, ErrorType> onError(const APIErrorCallback &cb) &&
|
||||||
{
|
{
|
||||||
this->data_->onError = cb;
|
this->data_->onError = cb;
|
||||||
return std::move(*this);
|
return std::move(*this);
|
||||||
};
|
};
|
||||||
|
|
||||||
APIRequest<OkType, ErrorType> onSuccess(APISuceessCallback cb) &&
|
APIRequest<OkType, ErrorType> onSuccess(const APISuceessCallback &cb) &&
|
||||||
{
|
{
|
||||||
this->data_->onSuccess = cb;
|
this->data_->onSuccess = cb;
|
||||||
return std::move(*this);
|
return std::move(*this);
|
||||||
};
|
};
|
||||||
|
|
||||||
APIRequest<OkType, ErrorType> finally(APIFinallyCallback cb) &&
|
APIRequest<OkType, ErrorType> finally(const APIFinallyCallback &cb) &&
|
||||||
{
|
{
|
||||||
this->data_->finally = cb;
|
this->data_->finally = cb;
|
||||||
return std::move(*this);
|
return std::move(*this);
|
||||||
|
|
Loading…
Reference in a new issue