File indexing completed on 2024-05-19 05:37:25
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 // 0008 // W A R N I N G 0009 // ------------- 0010 // 0011 // This file is not part of the AsynQt API. It exists purely as an 0012 // implementation detail. This header file may change from version to 0013 // version without notice, or even be removed. 0014 // 0015 // We mean it. 0016 // 0017 0018 namespace AsynQt 0019 { 0020 namespace detail 0021 { 0022 template<typename _Result> 0023 QFuture<typename std::decay<_Result>::type> makeReadyFuture(_Result &&value) 0024 { 0025 QFutureInterface<_Result> interface; 0026 auto future = interface.future(); 0027 0028 interface.reportStarted(); 0029 interface.reportResult(std::forward<_Result>(value)); 0030 interface.reportFinished(); 0031 0032 return future; 0033 } 0034 0035 inline QFuture<void> makeReadyFuture() 0036 { 0037 QFutureInterface<void> interface; 0038 auto future = interface.future(); 0039 0040 interface.reportStarted(); 0041 interface.reportFinished(); 0042 0043 return future; 0044 } 0045 0046 } // namespace detail 0047 } // namespace AsynQt