TaskTree: Fix internal naming

Make it more consistent.

Change-Id: I00ced6c742be9e884b328f51e75db552f8c22115
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-31 07:56:31 +01:00
parent f3b7d17aa3
commit 096a5aca0d

View File

@@ -314,14 +314,14 @@ private:
template <typename Handler> template <typename Handler>
static GroupSetupHandler wrapGroupSetup(Handler &&handler) static GroupSetupHandler wrapGroupSetup(Handler &&handler)
{ {
// S, V stands for: [S]etupResult, [V]oid // R, V stands for: Setup[R]esult, [V]oid
static constexpr bool isS = isInvocable<SetupResult, Handler>(); static constexpr bool isR = isInvocable<SetupResult, Handler>();
static constexpr bool isV = isInvocable<void, Handler>(); static constexpr bool isV = isInvocable<void, Handler>();
static_assert(isS || isV, static_assert(isR || isV,
"Group setup handler needs to take no arguments and has to return void or SetupResult. " "Group setup handler needs to take no arguments and has to return void or SetupResult. "
"The passed handler doesn't fulfill these requirements."); "The passed handler doesn't fulfill these requirements.");
return [handler] { return [handler] {
if constexpr (isS) if constexpr (isR)
return std::invoke(handler); return std::invoke(handler);
std::invoke(handler); std::invoke(handler);
return SetupResult::Continue; return SetupResult::Continue;
@@ -330,20 +330,20 @@ private:
template <typename Handler> template <typename Handler>
static GroupDoneHandler wrapGroupDone(Handler &&handler) static GroupDoneHandler wrapGroupDone(Handler &&handler)
{ {
// D, V, W stands for: [D]oneResult, [V]oid, Done[W]ith // R, V, D stands for: Done[R]esult, [V]oid, [D]oneWith
static constexpr bool isDW = isInvocable<DoneResult, Handler, DoneWith>(); static constexpr bool isRD = isInvocable<DoneResult, Handler, DoneWith>();
static constexpr bool isD = isInvocable<DoneResult, Handler>(); static constexpr bool isR = isInvocable<DoneResult, Handler>();
static constexpr bool isVW = isInvocable<void, Handler, DoneWith>(); static constexpr bool isVD = isInvocable<void, Handler, DoneWith>();
static constexpr bool isV = isInvocable<void, Handler>(); static constexpr bool isV = isInvocable<void, Handler>();
static_assert(isDW || isD || isVW || isV, static_assert(isRD || isR || isVD || isV,
"Group done handler needs to take (DoneWith) or (void) as an argument and has to " "Group done handler needs to take (DoneWith) or (void) as an argument and has to "
"return void or DoneResult. The passed handler doesn't fulfill these requirements."); "return void or DoneResult. The passed handler doesn't fulfill these requirements.");
return [handler](DoneWith result) { return [handler](DoneWith result) {
if constexpr (isDW) if constexpr (isRD)
return std::invoke(handler, result); return std::invoke(handler, result);
if constexpr (isD) if constexpr (isR)
return std::invoke(handler); return std::invoke(handler);
if constexpr (isVW) if constexpr (isVD)
std::invoke(handler, result); std::invoke(handler, result);
else if constexpr (isV) else if constexpr (isV)
std::invoke(handler); std::invoke(handler);
@@ -397,14 +397,14 @@ public:
private: private:
template <typename Handler> template <typename Handler>
static GroupSetupHandler wrapHandler(Handler &&handler) { static GroupSetupHandler wrapHandler(Handler &&handler) {
// D, V stands for: [D]oneResult, [V]oid // R, V stands for: Done[R]esult, [V]oid
static constexpr bool isB = isInvocable<DoneResult, Handler>(); static constexpr bool isR = isInvocable<DoneResult, Handler>();
static constexpr bool isV = isInvocable<void, Handler>(); static constexpr bool isV = isInvocable<void, Handler>();
static_assert(isB || isV, static_assert(isR || isV,
"Sync handler needs to take no arguments and has to return void or DoneResult. " "Sync handler needs to take no arguments and has to return void or DoneResult. "
"The passed handler doesn't fulfill these requirements."); "The passed handler doesn't fulfill these requirements.");
return [handler] { return [handler] {
if constexpr (isB) { if constexpr (isR) {
return std::invoke(handler) == DoneResult::Success ? SetupResult::StopWithSuccess return std::invoke(handler) == DoneResult::Success ? SetupResult::StopWithSuccess
: SetupResult::StopWithError; : SetupResult::StopWithError;
} }
@@ -461,15 +461,15 @@ private:
static InterfaceSetupHandler wrapSetup(Handler &&handler) { static InterfaceSetupHandler wrapSetup(Handler &&handler) {
if constexpr (std::is_same_v<Handler, TaskSetupHandler>) if constexpr (std::is_same_v<Handler, TaskSetupHandler>)
return {}; // When user passed {} for the setup handler. return {}; // When user passed {} for the setup handler.
// S, V stands for: [S]etupResult, [V]oid // R, V stands for: Setup[R]esult, [V]oid
static constexpr bool isS = isInvocable<SetupResult, Handler, Task &>(); static constexpr bool isR = isInvocable<SetupResult, Handler, Task &>();
static constexpr bool isV = isInvocable<void, Handler, Task &>(); static constexpr bool isV = isInvocable<void, Handler, Task &>();
static_assert(isS || isV, static_assert(isR || isV,
"Task setup handler needs to take (Task &) as an argument and has to return void or " "Task setup handler needs to take (Task &) as an argument and has to return void or "
"SetupResult. The passed handler doesn't fulfill these requirements."); "SetupResult. The passed handler doesn't fulfill these requirements.");
return [handler](TaskInterface &taskInterface) { return [handler](TaskInterface &taskInterface) {
Adapter &adapter = static_cast<Adapter &>(taskInterface); Adapter &adapter = static_cast<Adapter &>(taskInterface);
if constexpr (isS) if constexpr (isR)
return std::invoke(handler, *adapter.task()); return std::invoke(handler, *adapter.task());
std::invoke(handler, *adapter.task()); std::invoke(handler, *adapter.task());
return SetupResult::Continue; return SetupResult::Continue;
@@ -480,34 +480,34 @@ private:
static InterfaceDoneHandler wrapDone(Handler &&handler) { static InterfaceDoneHandler wrapDone(Handler &&handler) {
if constexpr (std::is_same_v<Handler, TaskDoneHandler>) if constexpr (std::is_same_v<Handler, TaskDoneHandler>)
return {}; // When user passed {} for the done handler. return {}; // When user passed {} for the done handler.
// D, V, T, W stands for: [D]oneResult, [V]oid, [T]ask, done[W]ith // R, V, T, D stands for: Done[R]esult, [V]oid, [T]ask, [D]oneWith
static constexpr bool isDTW = isInvocable<DoneResult, Handler, const Task &, DoneWith>(); static constexpr bool isRTD = isInvocable<DoneResult, Handler, const Task &, DoneWith>();
static constexpr bool isDT = isInvocable<DoneResult, Handler, const Task &>(); static constexpr bool isRT = isInvocable<DoneResult, Handler, const Task &>();
static constexpr bool isDW = isInvocable<DoneResult, Handler, DoneWith>(); static constexpr bool isRD = isInvocable<DoneResult, Handler, DoneWith>();
static constexpr bool isD = isInvocable<DoneResult, Handler>(); static constexpr bool isR = isInvocable<DoneResult, Handler>();
static constexpr bool isVTW = isInvocable<void, Handler, const Task &, DoneWith>(); static constexpr bool isVTD = isInvocable<void, Handler, const Task &, DoneWith>();
static constexpr bool isVT = isInvocable<void, Handler, const Task &>(); static constexpr bool isVT = isInvocable<void, Handler, const Task &>();
static constexpr bool isVW = isInvocable<void, Handler, DoneWith>(); static constexpr bool isVD = isInvocable<void, Handler, DoneWith>();
static constexpr bool isV = isInvocable<void, Handler>(); static constexpr bool isV = isInvocable<void, Handler>();
static_assert(isDTW || isDT || isDW || isD || isVTW || isVT || isVW || isV, static_assert(isRTD || isRT || isRD || isR || isVTD || isVT || isVD || isV,
"Task done handler needs to take (const Task &, DoneWith), (const Task &), " "Task done handler needs to take (const Task &, DoneWith), (const Task &), "
"(DoneWith) or (void) as arguments and has to return void or DoneResult. " "(DoneWith) or (void) as arguments and has to return void or DoneResult. "
"The passed handler doesn't fulfill these requirements."); "The passed handler doesn't fulfill these requirements.");
return [handler](const TaskInterface &taskInterface, DoneWith result) { return [handler](const TaskInterface &taskInterface, DoneWith result) {
const Adapter &adapter = static_cast<const Adapter &>(taskInterface); const Adapter &adapter = static_cast<const Adapter &>(taskInterface);
if constexpr (isDTW) if constexpr (isRTD)
return std::invoke(handler, *adapter.task(), result); return std::invoke(handler, *adapter.task(), result);
if constexpr (isDT) if constexpr (isRT)
return std::invoke(handler, *adapter.task()); return std::invoke(handler, *adapter.task());
if constexpr (isDW) if constexpr (isRD)
return std::invoke(handler, result); return std::invoke(handler, result);
if constexpr (isD) if constexpr (isR)
return std::invoke(handler); return std::invoke(handler);
if constexpr (isVTW) if constexpr (isVTD)
std::invoke(handler, *adapter.task(), result); std::invoke(handler, *adapter.task(), result);
else if constexpr (isVT) else if constexpr (isVT)
std::invoke(handler, *adapter.task()); std::invoke(handler, *adapter.task());
else if constexpr (isVW) else if constexpr (isVD)
std::invoke(handler, result); std::invoke(handler, result);
else if constexpr (isV) else if constexpr (isV)
std::invoke(handler); std::invoke(handler);