diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-11-11 10:37:02 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-11-17 15:07:59 +0000 |
commit | 7ab95906b96e37eee6bc60ad8ee9094f7eedaab4 (patch) | |
tree | ee0bdc545a8c95bd499e7b072bc7bec7d2b37225 /src/libs/utils/tasktree.h | |
parent | a4b7e10861f0f76f51379fc20e79f76e7c44bc05 (diff) |
TaskItem: Move enums outside of TaskItem
Change-Id: If8a2b285bf9d9bd5a5b7222c13772c1a873daf23
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/libs/utils/tasktree.h')
-rw-r--r-- | src/libs/utils/tasktree.h | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/src/libs/utils/tasktree.h b/src/libs/utils/tasktree.h index f313d53d4de..19bbad4043a 100644 --- a/src/libs/utils/tasktree.h +++ b/src/libs/utils/tasktree.h @@ -23,6 +23,27 @@ signals: void done(bool success); }; +enum class ExecuteMode { + Sequential, // default + Parallel +}; + +// 4 policies: +// 1. When all children finished with done -> report done, otherwise: +// a) Report error on first error and stop executing other children (including their subtree) +// b) On first error - wait for all children to be finished and report error afterwards +// 2. When all children finished with error -> report error, otherwise: +// a) Report done on first done and stop executing other children (including their subtree) +// b) On first done - wait for all children to be finished and report done afterwards + +enum class WorkflowPolicy { + StopOnError, // 1a - Will report error on any child error, otherwise done (if all children were done) + ContinueOnError, // 1b - the same. When no children it reports done. + StopOnDone, // 2a - Will report done on any child done, otherwise error (if all children were error) + ContinueOnDone, // 2b - the same. When no children it reports done. (?) + Optional // Returns always done after all children finished +}; + enum class GroupAction { ContinueAll, @@ -68,27 +89,6 @@ public: GroupSetupHandler m_dynamicSetupHandler = {}; }; - enum class ExecuteMode { - Parallel, // default - Sequential - }; - - // 4 policies: - // 1. When all children finished with done -> report done, otherwise: - // a) Report error on first error and stop executing other children (including their subtree) - // b) On first error - wait for all children to be finished and report error afterwards - // 2. When all children finished with error -> report error, otherwise: - // a) Report done on first done and stop executing other children (including their subtree) - // b) On first done - wait for all children to be finished and report done afterwards - - enum class WorkflowPolicy { - StopOnError, // 1a - Will report error on any child error, otherwise done (if all children were done) - ContinueOnError, // 1b - the same. When no children it reports done. - StopOnDone, // 2a - Will report done on any child done, otherwise error (if all children were error) - ContinueOnDone, // 2b - the same. When no children it reports done. (?) - Optional // Returns always done after all children finished - }; - ExecuteMode executeMode() const { return m_executeMode; } WorkflowPolicy workflowPolicy() const { return m_workflowPolicy; } TaskHandler taskHandler() const { return m_taskHandler; } @@ -136,22 +136,16 @@ public: Group(std::initializer_list<TaskItem> children) { addChildren(children); } }; -class QTCREATOR_UTILS_EXPORT ExecuteInSequence : public TaskItem -{ -public: - ExecuteInSequence() : TaskItem(ExecuteMode::Sequential) {} -}; - -class QTCREATOR_UTILS_EXPORT ExecuteInParallel : public TaskItem +class QTCREATOR_UTILS_EXPORT Execute : public TaskItem { public: - ExecuteInParallel() : TaskItem(ExecuteMode::Parallel) {} + Execute(ExecuteMode mode) : TaskItem(mode) {} }; -class QTCREATOR_UTILS_EXPORT WorkflowPolicy : public TaskItem +class QTCREATOR_UTILS_EXPORT Workflow : public TaskItem { public: - WorkflowPolicy(TaskItem::WorkflowPolicy policy) : TaskItem(policy) {} + Workflow(WorkflowPolicy policy) : TaskItem(policy) {} }; class QTCREATOR_UTILS_EXPORT OnGroupSetup : public TaskItem @@ -178,14 +172,13 @@ public: DynamicSetup(const GroupSetupHandler &handler) : TaskItem({{}, {}, {}, handler}) {} }; - -QTCREATOR_UTILS_EXPORT extern ExecuteInSequence sequential; -QTCREATOR_UTILS_EXPORT extern ExecuteInParallel parallel; -QTCREATOR_UTILS_EXPORT extern WorkflowPolicy stopOnError; -QTCREATOR_UTILS_EXPORT extern WorkflowPolicy continueOnError; -QTCREATOR_UTILS_EXPORT extern WorkflowPolicy stopOnDone; -QTCREATOR_UTILS_EXPORT extern WorkflowPolicy continueOnDone; -QTCREATOR_UTILS_EXPORT extern WorkflowPolicy optional; +QTCREATOR_UTILS_EXPORT extern Execute sequential; +QTCREATOR_UTILS_EXPORT extern Execute parallel; +QTCREATOR_UTILS_EXPORT extern Workflow stopOnError; +QTCREATOR_UTILS_EXPORT extern Workflow continueOnError; +QTCREATOR_UTILS_EXPORT extern Workflow stopOnDone; +QTCREATOR_UTILS_EXPORT extern Workflow continueOnDone; +QTCREATOR_UTILS_EXPORT extern Workflow optional; template <typename Task> class TaskAdapter : public TaskInterface |