aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/WorkflowNodes.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2021-04-16 16:49:28 -0700
committerrtk0c <[email protected]>2021-04-16 16:49:28 -0700
commit4e5730e1fcef150ce2f13f52a278890589ca96ad (patch)
tree0fe4002349047c7c770754e273d6a1d1ed666cbb /core/src/Model/WorkflowNodes.hpp
parent80d8ae5a6fef6c9a34e81e240539cb655dd99851 (diff)
More work on workflows
- WorkflowStep -> WorkflowNode - Added initial kinds of WorkflowNode's
Diffstat (limited to 'core/src/Model/WorkflowNodes.hpp')
-rw-r--r--core/src/Model/WorkflowNodes.hpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/core/src/Model/WorkflowNodes.hpp b/core/src/Model/WorkflowNodes.hpp
new file mode 100644
index 0000000..e7d4bfc
--- /dev/null
+++ b/core/src/Model/WorkflowNodes.hpp
@@ -0,0 +1,101 @@
+#pragma once
+
+#include "Model/Workflow.hpp"
+
+#include <cstddef>
+#include <memory>
+#include <variant>
+#include <vector>
+
+class NumericOperationNode : public WorkflowNode {
+public:
+ enum OperationType {
+ Addition,
+ Subtraction,
+ Multiplication,
+ Division,
+
+ InvalidType,
+ TypeCount = InvalidType,
+ };
+
+private:
+ OperationType mType;
+
+public:
+ static Kind OperationTypeToNodeKind(OperationType type);
+ static OperationType NodeKindToOperationType(Kind kind);
+ static bool IsInstance(const WorkflowNode* node);
+ NumericOperationNode(OperationType type);
+
+ virtual void Evaluate(WorkflowEvaluationContext& ctx) override;
+};
+
+class NumericExpressionNode : public WorkflowNode {
+public:
+ static bool IsInstance(const WorkflowNode* node);
+ NumericExpressionNode();
+
+ // TODO
+};
+
+class FormatTextNode : public WorkflowNode {
+public:
+ enum ArgumentType {
+ NumericArgument,
+ TextArgument,
+ DateTimeArgument,
+ };
+
+private:
+ struct Argument;
+ using Element = std::variant<std::string, Argument>;
+
+ std::vector<Element> mElements;
+ int mMinOutputChars;
+
+public:
+ static BaseValue::Kind ArgumentTypeToValueKind(ArgumentType arg);
+ static bool IsInstance(const WorkflowNode* node);
+ FormatTextNode();
+
+ int GetElementCount() const;
+ const Element& GetElement(int idx) const;
+
+ void SetElement(int idx, std::string text);
+ void SetElement(int idx, ArgumentType argument);
+ void InsertElement(int idx, std::string text);
+ void InsertElement(int idx, ArgumentType argument);
+ void AppendElement(std::string text);
+ void AppendElement(ArgumentType argument);
+ void RemoveElement(int idx);
+
+ virtual void Evaluate(WorkflowEvaluationContext& ctx) override;
+
+private:
+ void PreRemoveElement(int idx);
+};
+
+class DocumentTemplateExpansionNode : public WorkflowNode {
+public:
+ static bool IsInstance(const WorkflowNode* node);
+ DocumentTemplateExpansionNode();
+
+ // TODO
+};
+
+class FormInputNode : public WorkflowNode {
+public:
+ static bool IsInstance(const WorkflowNode* node);
+ FormInputNode();
+
+ // TODO
+};
+
+class DatabaseRowsInputNode : public WorkflowNode {
+public:
+ static bool IsInstance(const WorkflowNode* node);
+ DatabaseRowsInputNode();
+
+ // TODO
+};