File indexing completed on 2024-05-05 05:37:15

0001 /*
0002  *   SPDX-FileCopyrightText: 2016 Ivan Cukic <ivan.cukic(at)kde.org>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef ASYNQT_CONS_READY_FUTURE_H
0008 #define ASYNQT_CONS_READY_FUTURE_H
0009 
0010 #include <QFuture>
0011 #include <QFutureInterface>
0012 #include <QObject>
0013 #include <QTimer>
0014 
0015 #include "../private/basic/readyfuture_p.h"
0016 
0017 namespace AsynQt
0018 {
0019 /**
0020  * Creates a future that has already been completed,
0021  * and that contains the specified value
0022  */
0023 template<typename _Result>
0024 QFuture<typename std::decay<_Result>::type> makeReadyFuture(_Result &&value)
0025 {
0026     return detail::makeReadyFuture(std::forward<_Result>(value));
0027 }
0028 
0029 /**
0030  * Creates a void future that has already been completed.
0031  */
0032 inline QFuture<void> makeReadyFuture()
0033 {
0034     return detail::makeReadyFuture();
0035 }
0036 
0037 } // namespace AsynQt
0038 
0039 #endif // ASYNQT_CONS_READY_FUTURE_H