diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrent b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrent new file mode 100644 index 0000000000000000000000000000000000000000..90b8b9ccc06c3c811dfa85fcbc8bc0d0b6a044e4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrent @@ -0,0 +1,20 @@ +#ifndef QT_QTCONCURRENT_MODULE_H +#define QT_QTCONCURRENT_MODULE_H +#include +#include "qtaskbuilder.h" +#include "qtconcurrentcompilertest.h" +#include "qtconcurrentfilter.h" +#include "qtconcurrentfilterkernel.h" +#include "qtconcurrentfunctionwrappers.h" +#include "qtconcurrentiteratekernel.h" +#include "qtconcurrentmap.h" +#include "qtconcurrentmapkernel.h" +#include "qtconcurrentmedian.h" +#include "qtconcurrentreducekernel.h" +#include "qtconcurrentrun.h" +#include "qtconcurrentrunbase.h" +#include "qtconcurrentstoredfunctioncall.h" +#include "qtconcurrenttask.h" +#include "qtconcurrentthreadengine.h" +#include "qtconcurrentversion.h" +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentDepends b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentDepends new file mode 100644 index 0000000000000000000000000000000000000000..dbbbe0429cb24481c6b508e6ab64e50e7b517c9c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentDepends @@ -0,0 +1,4 @@ +/* This file was generated by cmake with the info from Concurrent target. */ +#ifdef __cplusplus /* create empty PCH in C mode */ +# include +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentFilter b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentFilter new file mode 100644 index 0000000000000000000000000000000000000000..04ea92cb735928a51b930c8e437591f4274a4d50 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentFilter @@ -0,0 +1 @@ +#include "qtconcurrentfilter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentMap b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentMap new file mode 100644 index 0000000000000000000000000000000000000000..cdcc4dcf4dee22f3680a47ba91320630470bff7e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentMap @@ -0,0 +1 @@ +#include "qtconcurrentmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentRun b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentRun new file mode 100644 index 0000000000000000000000000000000000000000..0201ca6682fc4dbc1b7418f91e247702fa291055 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentRun @@ -0,0 +1 @@ +#include "qtconcurrentrun.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentVersion b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentVersion new file mode 100644 index 0000000000000000000000000000000000000000..00991ea0ea67f7dbc0d031c938b4da1dfed3ea13 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/QtConcurrentVersion @@ -0,0 +1 @@ +#include "qtconcurrentversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtaskbuilder.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtaskbuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..b69a9afd90f855e478cfee57a3b579f19de1f5c7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtaskbuilder.h @@ -0,0 +1,135 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTBASE_QTTASKBUILDER_H +#define QTBASE_QTTASKBUILDER_H + +#if !defined(QT_NO_CONCURRENT) || defined(Q_QDOC) + +#include + +QT_BEGIN_NAMESPACE + +#ifdef Q_QDOC + +namespace QtConcurrent { + +enum class FutureResult { Ignore }; + +using InvokeResultType = int; + +template +class QTaskBuilder +{ +public: + [[nodiscard]] + QFuture spawn(); + + void spawn(FutureResult); + + template + [[nodiscard]] + QTaskBuilder withArguments(ExtraArgs &&...args); + + [[nodiscard]] + QTaskBuilder &onThreadPool(QThreadPool &newThreadPool); + + [[nodiscard]] + QTaskBuilder &withPriority(int newPriority); +}; + +} // namespace QtConcurrent + +#else + +namespace QtConcurrent { + +enum class FutureResult { Ignore }; + +template +class QTaskBuilder +{ +public: + [[nodiscard]] + auto spawn() + { + return TaskResolver, std::decay_t...>::run( + std::move(taskWithArgs), startParameters); + } + + // We don't want to run with promise when we don't return a QFuture + void spawn(FutureResult) + { + (new StoredFunctionCall(std::move(taskWithArgs))) + ->start(startParameters); + } + + template + [[nodiscard]] + constexpr auto withArguments(ExtraArgs &&...args) + { + static_assert(std::tuple_size_v == 1, + "This function cannot be invoked if " + "arguments have already been passed."); + + static_assert(sizeof...(ExtraArgs) >= 1, + "One or more arguments must be passed."); + + // We have to re-create a builder, because the type has changed + return QTaskBuilder( + startParameters, + std::get<0>(std::move(taskWithArgs)), + std::forward(args)... + ); + } + + [[nodiscard]] + constexpr auto &onThreadPool(QThreadPool &newThreadPool) + { + startParameters.threadPool = &newThreadPool; + return *this; + } + + [[nodiscard]] + constexpr auto &withPriority(int newPriority) + { + startParameters.priority = newPriority; + return *this; + } + +protected: // Methods + constexpr explicit QTaskBuilder(Task &&task, Args &&...arguments) + : taskWithArgs{std::forward(task), std::forward(arguments)...} + {} + + constexpr QTaskBuilder( + const TaskStartParameters ¶meters, Task &&task, Args &&...arguments) + : taskWithArgs{std::forward(task), std::forward(arguments)...} + , startParameters{parameters} + {} + +private: // Methods + // Required for creating a builder from "task" function + template + friend constexpr auto task(T &&t); + + // Required for creating a new builder from "withArguments" function + template + friend class QTaskBuilder; + +private: // Data + using TaskWithArgs = DecayedTuple; + + TaskWithArgs taskWithArgs; + TaskStartParameters startParameters; +}; + +} // namespace QtConcurrent + +#endif // Q_QDOC + +QT_END_NAMESPACE + +#endif // !defined(QT_NO_CONCURRENT) + +#endif //QTBASE_QTTASKBUILDER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrent_global.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrent_global.h new file mode 100644 index 0000000000000000000000000000000000000000..c5c2385b25945b055100b23e8af98b2b223d5686 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrent_global.h @@ -0,0 +1,10 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENT_GLOBAL_H +#define QTCONCURRENT_GLOBAL_H + +#include +#include + +#endif // include guard diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentcompilertest.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentcompilertest.h new file mode 100644 index 0000000000000000000000000000000000000000..a99e29dfcad88c8a7cf1c638386ccddab979e85c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentcompilertest.h @@ -0,0 +1,41 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENT_COMPILERTEST_H +#define QTCONCURRENT_COMPILERTEST_H + +#include + +#ifndef QT_NO_CONCURRENT + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + + template + struct IsIterable : std::false_type {}; + template + struct IsIterable().begin()), + decltype(std::declval().end())>> + : std::true_type + { }; + + template + inline constexpr bool IsIterableValue = IsIterable::value; + + template + struct IsDereferenceable : std::false_type {}; + template + struct IsDereferenceable())>> + : std::true_type + { }; + + template + inline constexpr bool IsDereferenceableValue = IsDereferenceable::value; +} + +QT_END_NAMESPACE + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentexports.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentexports.h new file mode 100644 index 0000000000000000000000000000000000000000..6c554775bf23ecd186ef5fb5b301b124df0e8a85 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentexports.h @@ -0,0 +1,50 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENTEXPORTS_H +#define QTCONCURRENTEXPORTS_H + +#include +#include // Q_CONCURRENT_EXPORT +#include // QT_IF_DEPRECATED_SINCE + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# if defined(QT_BUILD_CONCURRENT_LIB) +# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT +# else +# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_CONCURRENT_EXPORT +#endif + +#if !defined(QT_BUILD_CONCURRENT_LIB) && !defined(QT_STATIC) +/* outside library -> inline decl + defi */ +/* static builds treat everything as part of the library, so they never inline */ +# define QT_CONCURRENT_INLINE_SINCE(major, minor) inline +# define QT_CONCURRENT_INLINE_IMPL_SINCE(major, minor) 1 +#elif defined(QT_CONCURRENT_BUILD_REMOVED_API) +/* inside library, inside removed_api.cpp: + * keep deprecated API -> non-inline decl; + * remove deprecated API -> inline decl; + * definition is always available */ +# define QT_CONCURRENT_INLINE_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */) +# define QT_CONCURRENT_INLINE_IMPL_SINCE(major, minor) 1 +#else +/* inside library, outside removed_api.cpp: + * keep deprecated API -> non-inline decl, no defi; + * remove deprecated API -> inline decl, defi */ +# define QT_CONCURRENT_INLINE_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */) +# define QT_CONCURRENT_INLINE_IMPL_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, 1, 0) +#endif + +#ifdef QT_CONCURRENT_BUILD_REMOVED_API +# define QT_CONCURRENT_REMOVED_SINCE(major, minor) QT_DEPRECATED_SINCE(major, minor) +#else +# define QT_CONCURRENT_REMOVED_SINCE(major, minor) 0 +#endif + +#endif // QTCONCURRENTEXPORTS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilter.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..554ed238c27a9db2dd03cb2f996ac8ead0505ca9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilter.h @@ -0,0 +1,719 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENT_FILTER_H +#define QTCONCURRENT_FILTER_H + +#if 0 +#pragma qt_class(QtConcurrentFilter) +#endif + +#include + +#if !defined(QT_NO_CONCURRENT) || defined(Q_QDOC) + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtConcurrent { + +//! [QtConcurrent-1] +template +ThreadEngineStarter filterInternal(QThreadPool *pool, Sequence &sequence, + KeepFunctor &&keep, ReduceFunctor &&reduce) +{ + typedef FilterKernel, std::decay_t> + KernelType; + return startThreadEngine(new KernelType(pool, sequence, std::forward(keep), + std::forward(reduce))); +} + +// filter() on sequences +template +QFuture filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&keep) +{ + return filterInternal(pool, sequence, std::forward(keep), + QtPrivate::PushBackWrapper()); +} + +template +QFuture filter(Sequence &sequence, KeepFunctor &&keep) +{ + return filterInternal(QThreadPool::globalInstance(), + sequence, std::forward(keep), QtPrivate::PushBackWrapper()); +} + +// filteredReduced() on sequences +template +QFuture filteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(pool, std::forward(sequence), + std::forward(keep), + std::forward(reduce), options); +} + +template +QFuture filteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep), std::forward(reduce), options); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +QFuture filteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +QFuture filteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +#ifndef Q_QDOC +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type> +QFuture filteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(pool, std::forward(sequence), + std::forward(keep), + std::forward(reduce), options); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type> +QFuture filteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep), std::forward(reduce), options); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + std::enable_if_t, + int> = 0> +QFuture filteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + std::enable_if_t, + int> = 0> +QFuture filteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} +#endif + +// filteredReduced() on iterators +template +QFuture filteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(pool, begin, end, std::forward(keep), + std::forward(reduce), options); +} + +template +QFuture filteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(QThreadPool::globalInstance(), begin, end, + std::forward(keep), + std::forward(reduce), options); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +QFuture filteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + pool, begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +QFuture filteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), begin, end, std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +#ifndef Q_QDOC +template ::type> +QFuture filteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(pool, begin, end, std::forward(keep), + std::forward(reduce), options); +} + +template ::type> +QFuture filteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced(QThreadPool::globalInstance(), begin, end, + std::forward(keep), + std::forward(reduce), options); +} + +template ::type, + typename InitialValueType, + std::enable_if_t, + int> = 0> +QFuture filteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + pool, begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} + +template , int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + typename InitialValueType, + std::enable_if_t, + int> = 0> +QFuture filteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + return startFilteredReduced( + QThreadPool::globalInstance(), begin, end, std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); +} +#endif + +// filtered() on sequences +template +QFuture::value_type> filtered(QThreadPool *pool,Sequence &&sequence, + KeepFunctor &&keep) +{ + return startFiltered(pool, std::forward(sequence), std::forward(keep)); +} + +template +QFuture::value_type> filtered(Sequence &&sequence, + KeepFunctor &&keep) +{ + return startFiltered(QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep)); +} + +// filtered() on iterators +template +QFuture::value_type> filtered(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep) +{ + return startFiltered(pool, begin, end, std::forward(keep)); +} + +template +QFuture::value_type> filtered(Iterator begin, + Iterator end, + KeepFunctor &&keep) +{ + return startFiltered(QThreadPool::globalInstance(), begin, end, + std::forward(keep)); +} + +// blocking filter() on sequences +template +void blockingFilter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&keep) +{ + QFuture future = filter(pool, sequence, std::forward(keep)); + future.waitForFinished(); +} + +template +void blockingFilter(Sequence &sequence, KeepFunctor &&keep) +{ + QFuture future = filter(sequence, std::forward(keep)); + future.waitForFinished(); +} + +// blocking filteredReduced() on sequences +template +ResultType blockingFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template +ResultType blockingFilteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + std::forward(sequence), std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +ResultType blockingFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +ResultType blockingFilteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +#ifndef Q_QDOC +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type> +ResultType blockingFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type> +ResultType blockingFilteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + std::forward(sequence), std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + std::enable_if_t, + int> = 0> +ResultType blockingFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +template ::value, int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + std::enable_if_t, + int> = 0> +ResultType blockingFilteredReduced(Sequence &&sequence, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + std::forward(sequence), std::forward(keep), + std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} +#endif + +// blocking filteredReduced() on iterators +template +ResultType blockingFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = + filteredReduced(pool, begin, end, std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = + filteredReduced(begin, end, std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +ResultType blockingFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +#ifdef Q_QDOC +template +#else +template , + int> = 0> +#endif +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +#ifndef Q_QDOC +template ::type> +ResultType blockingFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = + filteredReduced(pool, begin, end, std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template ::type> +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = + filteredReduced(begin, end, std::forward(keep), + std::forward(reduce), options); + return future.takeResult(); +} + +template ::type, + typename InitialValueType, + std::enable_if_t, + int> = 0> +ResultType blockingFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + pool, begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} + +template , int> = 0, + typename ResultType = typename QtPrivate::ReduceResultTypeHelper::type, + typename InitialValueType, + std::enable_if_t, + int> = 0> +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor &&keep, + ReduceFunctor &&reduce, + InitialValueType &&initialValue, + ReduceOptions options = ReduceOptions(UnorderedReduce + | SequentialReduce)) +{ + QFuture future = filteredReduced( + begin, end, std::forward(keep), std::forward(reduce), + ResultType(std::forward(initialValue)), options); + return future.takeResult(); +} +#endif + +// blocking filtered() on sequences +template +std::decay_t blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&keep) +{ + return blockingFilteredReduced>( + pool, std::forward(sequence), std::forward(keep), + QtPrivate::PushBackWrapper(), OrderedReduce); +} + +template +std::decay_t blockingFiltered(Sequence &&sequence, KeepFunctor &&keep) +{ + return blockingFilteredReduced>( + QThreadPool::globalInstance(), std::forward(sequence), + std::forward(keep), QtPrivate::PushBackWrapper(), OrderedReduce); +} + +// blocking filtered() on iterators +template +OutputSequence blockingFiltered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&keep) +{ + return blockingFilteredReduced(pool, begin, end, + std::forward(keep), + QtPrivate::PushBackWrapper(), OrderedReduce); +} + +template +OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor &&keep) +{ + return blockingFilteredReduced(QThreadPool::globalInstance(), begin, end, + std::forward(keep), + QtPrivate::PushBackWrapper(), OrderedReduce); +} + +} // namespace QtConcurrent + +QT_END_NAMESPACE + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilterkernel.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilterkernel.h new file mode 100644 index 0000000000000000000000000000000000000000..cba37a0718b9f234ff1741f44d2db009cad1fc3f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfilterkernel.h @@ -0,0 +1,386 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENT_FILTERKERNEL_H +#define QTCONCURRENT_FILTERKERNEL_H + +#include + +#if !defined(QT_NO_CONCURRENT) || defined (Q_QDOC) + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + + +namespace QtConcurrent { + +template +struct qValueType +{ + typedef typename T::value_type value_type; +}; + +template +struct qValueType +{ + typedef T value_type; +}; + +template +struct qValueType +{ + typedef T value_type; +}; + +// Implementation of filter +template +class FilterKernel : public IterateKernel +{ + typedef ReduceKernel Reducer; + typedef IterateKernel IterateKernelType; + typedef void T; + + Sequence reducedResult; + Sequence &sequence; + KeepFunctor keep; + ReduceFunctor reduce; + Reducer reducer; + +public: + template + FilterKernel(QThreadPool *pool, Sequence &_sequence, Keep &&_keep, Reduce &&_reduce) + : IterateKernelType(pool, const_cast(_sequence).begin(), + const_cast(_sequence).end()), reducedResult(), + sequence(_sequence), + keep(std::forward(_keep)), + reduce(std::forward(_reduce)), + reducer(pool, OrderedReduce) + { } + + bool runIteration(typename Sequence::const_iterator it, int index, T *) override + { + IntermediateResults results; + results.begin = index; + results.end = index + 1; + + if (std::invoke(keep, *it)) + results.vector.append(*it); + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *) override + { + IntermediateResults results; + results.begin = begin; + results.end = end; + results.vector.reserve(end - begin); + + + typename Sequence::const_iterator it = sequenceBeginIterator; + std::advance(it, begin); + for (int i = begin; i < end; ++i) { + if (std::invoke(keep, *it)) + results.vector.append(*it); + std::advance(it, 1); + } + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + void finish() override + { + reducer.finish(reduce, reducedResult); + sequence = std::move(reducedResult); + } + + inline bool shouldThrottleThread() override + { + return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); + } + + inline bool shouldStartThread() override + { + return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); + } + + typedef void ReturnType; + typedef void ResultType; +}; + +// Implementation of filter-reduce +template ::value_type> > +class FilteredReducedKernel : public IterateKernel +{ + ReducedResultType &reducedResult; + KeepFunctor keep; + ReduceFunctor reduce; + Reducer reducer; + typedef IterateKernel IterateKernelType; + +public: + template + FilteredReducedKernel(QThreadPool *pool, Iterator begin, Iterator end, Keep &&_keep, + Reduce &&_reduce, ReduceOptions reduceOption) + : IterateKernelType(pool, begin, end), + reducedResult(this->defaultValue.value), + keep(std::forward(_keep)), + reduce(std::forward(_reduce)), + reducer(pool, reduceOption) + { } + + template + FilteredReducedKernel(QThreadPool *pool, Iterator begin, Iterator end, Keep &&_keep, + Reduce &&_reduce, ReducedResultType &&initialValue, + ReduceOptions reduceOption) + : IterateKernelType(pool, begin, end, std::forward(initialValue)), + reducedResult(this->defaultValue.value), + keep(std::forward(_keep)), + reduce(std::forward(_reduce)), + reducer(pool, reduceOption) + { + } + + bool runIteration(Iterator it, int index, ReducedResultType *) override + { + IntermediateResults::value_type> results; + results.begin = index; + results.end = index + 1; + + if (std::invoke(keep, *it)) + results.vector.append(*it); + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) override + { + IntermediateResults::value_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(end - begin); + + Iterator it = sequenceBeginIterator; + std::advance(it, begin); + for (int i = begin; i < end; ++i) { + if (std::invoke(keep, *it)) + results.vector.append(*it); + std::advance(it, 1); + } + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + void finish() override + { + reducer.finish(reduce, reducedResult); + } + + inline bool shouldThrottleThread() override + { + return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); + } + + inline bool shouldStartThread() override + { + return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); + } + + typedef ReducedResultType ReturnType; + typedef ReducedResultType ResultType; + ReducedResultType *result() override + { + return &reducedResult; + } +}; + +// Implementation of filter that reports individual results via QFutureInterface +template +class FilteredEachKernel : public IterateKernel::value_type> +{ + typedef typename qValueType::value_type T; + typedef IterateKernel IterateKernelType; + + KeepFunctor keep; + +public: + typedef T ReturnType; + typedef T ResultType; + + template + FilteredEachKernel(QThreadPool *pool, Iterator begin, Iterator end, Keep &&_keep) + : IterateKernelType(pool, begin, end), keep(std::forward(_keep)) + { } + + void start() override + { + if (this->futureInterface) + this->futureInterface->setFilterMode(true); + IterateKernelType::start(); + } + + bool runIteration(Iterator it, int index, T *) override + { + if (std::invoke(keep, *it)) + this->reportResult(&(*it), index); + else + this->reportResult(nullptr, index); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *) override + { + const int count = end - begin; + IntermediateResults::value_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(count); + + Iterator it = sequenceBeginIterator; + std::advance(it, begin); + for (int i = begin; i < end; ++i) { + if (std::invoke(keep, *it)) + results.vector.append(*it); + std::advance(it, 1); + } + + this->reportResults(results.vector, begin, count); + return false; + } +}; + +//! [QtConcurrent-2] +template +inline +ThreadEngineStarter::value_type> +startFiltered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&functor) +{ + return startThreadEngine(new FilteredEachKernel> + (pool, begin, end, std::forward(functor))); +} + +//! [QtConcurrent-3] +template +inline decltype(auto) startFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&functor) +{ + using DecayedSequence = std::decay_t; + using DecayedFunctor = std::decay_t; + using SequenceHolderType = SequenceHolder1, + DecayedFunctor>; + return startThreadEngine(new SequenceHolderType(pool, std::forward(sequence), + std::forward(functor))); +} + +//! [QtConcurrent-4] +template +inline ThreadEngineStarter startFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + MapFunctor &&mapFunctor, + ReduceFunctor &&reduceFunctor, + ReduceOptions options) +{ + using DecayedSequence = std::decay_t; + using DecayedMapFunctor = std::decay_t; + using DecayedReduceFunctor = std::decay_t; + using Iterator = typename DecayedSequence::const_iterator; + using Reducer = ReduceKernel::value_type>; + using FilteredReduceType = FilteredReducedKernel; + using SequenceHolderType = SequenceHolder2; + return startThreadEngine(new SequenceHolderType(pool, std::forward(sequence), + std::forward(mapFunctor), + std::forward(reduceFunctor), + options)); +} + + +//! [QtConcurrent-5] +template +inline ThreadEngineStarter startFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + MapFunctor &&mapFunctor, + ReduceFunctor &&reduceFunctor, + ReduceOptions options) +{ + using Reducer = ReduceKernel, ResultType, + typename qValueType::value_type>; + using FilteredReduceType = FilteredReducedKernel, + std::decay_t, Reducer>; + return startThreadEngine( + new FilteredReduceType(pool, begin, end, std::forward(mapFunctor), + std::forward(reduceFunctor), options)); +} + +// Repeat the two functions above, but now with an initial value! +//! [QtConcurrent-6] +template +inline ThreadEngineStarter startFilteredReduced(QThreadPool *pool, + Sequence &&sequence, + MapFunctor &&mapFunctor, + ReduceFunctor &&reduceFunctor, + ResultType &&initialValue, + ReduceOptions options) +{ + using DecayedSequence = std::decay_t; + using DecayedMapFunctor = std::decay_t; + using DecayedReduceFunctor = std::decay_t; + using Iterator = typename DecayedSequence::const_iterator; + using Reducer = ReduceKernel::value_type>; + using FilteredReduceType = FilteredReducedKernel; + using SequenceHolderType = SequenceHolder2; + return startThreadEngine(new SequenceHolderType( + pool, std::forward(sequence), std::forward(mapFunctor), + std::forward(reduceFunctor), std::forward(initialValue), + options)); +} + +//! [QtConcurrent-7] +template +inline ThreadEngineStarter startFilteredReduced(QThreadPool *pool, + Iterator begin, + Iterator end, + MapFunctor &&mapFunctor, + ReduceFunctor &&reduceFunctor, + ResultType &&initialValue, + ReduceOptions options) +{ + using Reducer = ReduceKernel, ResultType, + typename qValueType::value_type>; + using FilteredReduceType = FilteredReducedKernel, + std::decay_t, Reducer>; + return startThreadEngine( + new FilteredReduceType(pool, begin, end, std::forward(mapFunctor), + std::forward(reduceFunctor), + std::forward(initialValue), options)); +} + + +} // namespace QtConcurrent + + +QT_END_NAMESPACE + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfunctionwrappers.h b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfunctionwrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..f9ed9e41b97ebb585c0ab5827f3a90acdb5a07c5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtConcurrent/qtconcurrentfunctionwrappers.h @@ -0,0 +1,179 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONCURRENT_FUNCTIONWRAPPERS_H +#define QTCONCURRENT_FUNCTIONWRAPPERS_H + +#include +#include +#include + +#include + +#if !defined(QT_NO_CONCURRENT) || defined(Q_QDOC) + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +struct PushBackWrapper +{ + template + inline void operator()(C &c, const U &u) const + { + return c.push_back(u); + } + + template + inline void operator()(C &c, U &&u) const + { + return c.push_back(u); + } +}; + +// -- MapResultType + +template +struct Argument +{ + using Type = void; +}; + +template +struct Argument>::type> +{ + using Type = std::decay_t().begin())>; +}; + +template +struct Argument>::type> +{ + using Type = std::decay_t())>; +}; + +template +using ArgumentType = typename Argument::Type; + +template +struct MapResult +{ + static_assert(std::is_invocable_v, ArgumentType>, + "It's not possible to invoke the function with passed argument."); + using Type = std::invoke_result_t, ArgumentType>; +}; + +template +using MapResultType = typename MapResult::Type; + +// -- ReduceResultType + +template +struct ReduceResultType; + +template +struct ReduceResultType +{ + using ResultType = U; +}; + +template +struct ReduceResultType +{ + using ResultType = C; +}; + +template +struct ReduceResultType> +{ + using ResultType = U; +}; + +template +struct ReduceResultType +{ + using ResultType = typename std::tuple_element<0, std::tuple>::type; +}; + +template +struct ReduceResultType +{ + using ResultType = U; +}; + +template +struct ReduceResultType +{ + using ResultType = C; +}; + +template +inline constexpr bool hasCallOperator_v = false; + +template +inline constexpr bool hasCallOperator_v> = true; + +template +inline constexpr bool isIterator_v = false; + +template +inline constexpr bool isIterator_v::value_type>> = + true; + +template +using isInvocable = std::is_invocable::value_type>; + +template +inline constexpr bool isInitialValueCompatible_v = std::conjunction_v< + std::is_convertible, + std::negation, QtConcurrent::ReduceOption>>>; + +template +struct ReduceResultTypeHelper +{ +}; + +template +struct ReduceResultTypeHelper>> + || std::is_member_function_pointer_v>>> +{ + using type = typename QtPrivate::ReduceResultType>::ResultType; +}; + +template +struct ReduceResultTypeHelper>> + && hasCallOperator_v>>> +{ + using type = std::decay_t::First>; +}; + +// -- MapSequenceResultType + +template +struct MapSequenceResultType +{ + static_assert(std::is_same_v>, + "Couldn't deduce the output sequence type, you must specify it explicitly."); + typedef InputSequence ResultType; +}; + +#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS + +template