aboutsummaryrefslogtreecommitdiff
path: root/app/source/Cplt/Model/Workflow/Nodes
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-11-27 12:04:31 -0800
committerrtk0c <[email protected]>2022-11-27 12:04:31 -0800
commit182c8f8357739f905bbd721006480502435b6b43 (patch)
tree082613a474d863182e2ad8f2167f1643f26e67a3 /app/source/Cplt/Model/Workflow/Nodes
parentb01ed99a1cd0c863c8709930658513c04dd70f61 (diff)
Update brace style to match rest of my projectscplt-imgui
Diffstat (limited to 'app/source/Cplt/Model/Workflow/Nodes')
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.cpp9
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.hpp3
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/NumericNodes.cpp24
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/NumericNodes.hpp9
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp51
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/TextNodes.hpp9
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.cpp18
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.hpp6
8 files changed, 43 insertions, 86 deletions
diff --git a/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.cpp b/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.cpp
index df4a8bb..202f8cf 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.cpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.cpp
@@ -3,16 +3,13 @@
#include <Cplt/Model/Workflow/Evaluation.hpp>
#include <Cplt/Model/Workflow/Values/Basic.hpp>
-bool DocumentTemplateExpansionNode::IsInstance(const WorkflowNode* node)
-{
+bool DocumentTemplateExpansionNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() == KD_DocumentTemplateExpansion;
}
DocumentTemplateExpansionNode::DocumentTemplateExpansionNode()
- : WorkflowNode(KD_DocumentTemplateExpansion, false)
-{
+ : WorkflowNode(KD_DocumentTemplateExpansion, false) {
}
-void DocumentTemplateExpansionNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void DocumentTemplateExpansionNode::Evaluate(WorkflowEvaluationContext& ctx) {
}
diff --git a/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.hpp b/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.hpp
index a266b2c..2a49a91 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.hpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/DocumentNodes.hpp
@@ -2,8 +2,7 @@
#include <Cplt/Model/Workflow/Workflow.hpp>
-class DocumentTemplateExpansionNode : public WorkflowNode
-{
+class DocumentTemplateExpansionNode : public WorkflowNode {
public:
static bool IsInstance(const WorkflowNode* node);
DocumentTemplateExpansionNode();
diff --git a/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.cpp b/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.cpp
index f8b29bb..8a47423 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.cpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.cpp
@@ -9,8 +9,7 @@
#include <cassert>
#include <utility>
-WorkflowNode::Kind NumericOperationNode::OperationTypeToNodeKind(OperationType type)
-{
+WorkflowNode::Kind NumericOperationNode::OperationTypeToNodeKind(OperationType type) {
switch (type) {
case Addition: return KD_NumericAddition;
case Subtraction: return KD_NumericSubtraction;
@@ -20,8 +19,7 @@ WorkflowNode::Kind NumericOperationNode::OperationTypeToNodeKind(OperationType t
}
}
-NumericOperationNode::OperationType NumericOperationNode::NodeKindToOperationType(Kind kind)
-{
+NumericOperationNode::OperationType NumericOperationNode::NodeKindToOperationType(Kind kind) {
switch (kind) {
case KD_NumericAddition: return Addition;
case KD_NumericSubtraction: return Subtraction;
@@ -31,15 +29,13 @@ NumericOperationNode::OperationType NumericOperationNode::NodeKindToOperationTyp
}
}
-bool NumericOperationNode::IsInstance(const WorkflowNode* node)
-{
+bool NumericOperationNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() >= KD_NumericAddition && node->GetKind() <= KD_NumericDivision;
}
NumericOperationNode::NumericOperationNode(OperationType type)
: WorkflowNode(OperationTypeToNodeKind(type), false)
- , mType{ type }
-{
+ , mType{ type } {
mInputs.resize(2);
mInputs[0].MatchingType = BaseValue::KD_Numeric;
mInputs[1].MatchingType = BaseValue::KD_Numeric;
@@ -48,8 +44,7 @@ NumericOperationNode::NumericOperationNode(OperationType type)
mOutputs[0].MatchingType = BaseValue::KD_Numeric;
}
-void NumericOperationNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void NumericOperationNode::Evaluate(WorkflowEvaluationContext& ctx) {
auto lhsVal = dyn_cast<NumericValue>(ctx.GetConnectionValue(mInputs[0]));
if (!lhsVal) return;
double lhs = lhsVal->GetValue();
@@ -79,16 +74,13 @@ void NumericOperationNode::Evaluate(WorkflowEvaluationContext& ctx)
ctx.SetConnectionValue(mOutputs[0], std::move(value));
}
-bool NumericExpressionNode::IsInstance(const WorkflowNode* node)
-{
+bool NumericExpressionNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() == KD_NumericExpression;
}
NumericExpressionNode::NumericExpressionNode()
- : WorkflowNode(KD_NumericExpression, false)
-{
+ : WorkflowNode(KD_NumericExpression, false) {
}
-void NumericExpressionNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void NumericExpressionNode::Evaluate(WorkflowEvaluationContext& ctx) {
}
diff --git a/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.hpp b/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.hpp
index 3c89708..0d3120b 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.hpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/NumericNodes.hpp
@@ -7,11 +7,9 @@
#include <variant>
#include <vector>
-class NumericOperationNode : public WorkflowNode
-{
+class NumericOperationNode : public WorkflowNode {
public:
- enum OperationType
- {
+ enum OperationType {
Addition,
Subtraction,
Multiplication,
@@ -33,8 +31,7 @@ public:
virtual void Evaluate(WorkflowEvaluationContext& ctx) override;
};
-class NumericExpressionNode : public WorkflowNode
-{
+class NumericExpressionNode : public WorkflowNode {
public:
static bool IsInstance(const WorkflowNode* node);
NumericExpressionNode();
diff --git a/app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp b/app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp
index 9b31f7a..4bca0c8 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp
@@ -11,12 +11,10 @@
#include <variant>
#include <vector>
-class TextFormatterNode::Impl
-{
+class TextFormatterNode::Impl {
public:
template <class TFunction>
- static void ForArguments(std::vector<Element>::iterator begin, std::vector<Element>::iterator end, const TFunction& func)
- {
+ static void ForArguments(std::vector<Element>::iterator begin, std::vector<Element>::iterator end, const TFunction& func) {
for (auto it = begin; it != end; ++it) {
auto& elm = *it;
if (auto arg = std::get_if<Argument>(&elm)) {
@@ -26,8 +24,7 @@ public:
}
/// Find the pin index that the \c elmIdx -th element should have, based on the elements coming before it.
- static int FindPinForElement(const std::vector<Element>& vec, int elmIdx)
- {
+ static int FindPinForElement(const std::vector<Element>& vec, int elmIdx) {
for (int i = elmIdx; i >= 0; --i) {
auto& elm = vec[i];
if (auto arg = std::get_if<Argument>(&elm)) {
@@ -38,8 +35,7 @@ public:
}
};
-BaseValue::Kind TextFormatterNode::ArgumentTypeToValueKind(TextFormatterNode::ArgumentType arg)
-{
+BaseValue::Kind TextFormatterNode::ArgumentTypeToValueKind(TextFormatterNode::ArgumentType arg) {
switch (arg) {
case NumericArgument: return BaseValue::KD_Numeric;
case TextArgument: return BaseValue::KD_Text;
@@ -47,28 +43,23 @@ BaseValue::Kind TextFormatterNode::ArgumentTypeToValueKind(TextFormatterNode::Ar
}
}
-bool TextFormatterNode::IsInstance(const WorkflowNode* node)
-{
+bool TextFormatterNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() == KD_TextFormatting;
}
TextFormatterNode::TextFormatterNode()
- : WorkflowNode(KD_TextFormatting, false)
-{
+ : WorkflowNode(KD_TextFormatting, false) {
}
-int TextFormatterNode::GetElementCount() const
-{
+int TextFormatterNode::GetElementCount() const {
return mElements.size();
}
-const TextFormatterNode::Element& TextFormatterNode::GetElement(int idx) const
-{
+const TextFormatterNode::Element& TextFormatterNode::GetElement(int idx) const {
return mElements[idx];
}
-void TextFormatterNode::SetElement(int idx, std::string text)
-{
+void TextFormatterNode::SetElement(int idx, std::string text) {
assert(idx >= 0 && idx < mElements.size());
std::visit(
@@ -82,8 +73,7 @@ void TextFormatterNode::SetElement(int idx, std::string text)
mElements[idx] = std::move(text);
}
-void TextFormatterNode::SetElement(int idx, ArgumentType argument)
-{
+void TextFormatterNode::SetElement(int idx, ArgumentType argument) {
assert(idx >= 0 && idx < mElements.size());
std::visit(
@@ -115,8 +105,7 @@ void TextFormatterNode::SetElement(int idx, ArgumentType argument)
mElements[idx]);
}
-void TextFormatterNode::InsertElement(int idx, std::string text)
-{
+void TextFormatterNode::InsertElement(int idx, std::string text) {
assert(idx >= 0);
if (idx >= mElements.size()) AppendElement(std::move(text));
@@ -124,8 +113,7 @@ void TextFormatterNode::InsertElement(int idx, std::string text)
mElements.insert(mElements.begin() + idx, std::move(text));
}
-void TextFormatterNode::InsertElement(int idx, ArgumentType argument)
-{
+void TextFormatterNode::InsertElement(int idx, ArgumentType argument) {
assert(idx >= 0);
if (idx >= mElements.size()) AppendElement(argument);
@@ -144,14 +132,12 @@ void TextFormatterNode::InsertElement(int idx, ArgumentType argument)
});
}
-void TextFormatterNode::AppendElement(std::string text)
-{
+void TextFormatterNode::AppendElement(std::string text) {
mMinOutputChars += text.size();
mElements.push_back(std::move(text));
}
-void TextFormatterNode::AppendElement(ArgumentType argument)
-{
+void TextFormatterNode::AppendElement(ArgumentType argument) {
int pinIdx = mInputs.size();
// Create pin
mInputs.push_back(InputPin{});
@@ -163,8 +149,7 @@ void TextFormatterNode::AppendElement(ArgumentType argument)
});
}
-void TextFormatterNode::RemoveElement(int idx)
-{
+void TextFormatterNode::RemoveElement(int idx) {
assert(idx >= 0 && idx < mElements.size());
PreRemoveElement(idx);
@@ -174,8 +159,7 @@ void TextFormatterNode::RemoveElement(int idx)
mElements.erase(mElements.begin() + idx);
}
-void TextFormatterNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void TextFormatterNode::Evaluate(WorkflowEvaluationContext& ctx) {
std::string result;
result.reserve((size_t)(mMinOutputChars * 1.5f));
@@ -216,8 +200,7 @@ void TextFormatterNode::Evaluate(WorkflowEvaluationContext& ctx)
}
}
-void TextFormatterNode::PreRemoveElement(int idx)
-{
+void TextFormatterNode::PreRemoveElement(int idx) {
auto& elm = mElements[idx];
if (auto arg = std::get_if<Argument>(&elm)) {
RemoveInputPin(arg->PinIdx);
diff --git a/app/source/Cplt/Model/Workflow/Nodes/TextNodes.hpp b/app/source/Cplt/Model/Workflow/Nodes/TextNodes.hpp
index 4689931..56eb19b 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/TextNodes.hpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/TextNodes.hpp
@@ -7,11 +7,9 @@
#include <variant>
#include <vector>
-class TextFormatterNode : public WorkflowNode
-{
+class TextFormatterNode : public WorkflowNode {
public:
- enum ArgumentType
- {
+ enum ArgumentType {
NumericArgument,
TextArgument,
DateTimeArgument,
@@ -20,8 +18,7 @@ public:
private:
class Impl;
- struct Argument
- {
+ struct Argument {
ArgumentType Type;
int PinIdx;
};
diff --git a/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.cpp b/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.cpp
index 93d458c..4b56052 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.cpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.cpp
@@ -3,30 +3,24 @@
#include <Cplt/Model/Workflow/Evaluation.hpp>
#include <Cplt/Model/Workflow/Values/Basic.hpp>
-bool FormInputNode::IsInstance(const WorkflowNode* node)
-{
+bool FormInputNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() == KD_FormInput;
}
FormInputNode::FormInputNode()
- : WorkflowNode(KD_FormInput, false)
-{
+ : WorkflowNode(KD_FormInput, false) {
}
-void FormInputNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void FormInputNode::Evaluate(WorkflowEvaluationContext& ctx) {
}
-bool DatabaseRowsInputNode::IsInstance(const WorkflowNode* node)
-{
+bool DatabaseRowsInputNode::IsInstance(const WorkflowNode* node) {
return node->GetKind() == KD_DatabaseRowsInput;
}
DatabaseRowsInputNode::DatabaseRowsInputNode()
- : WorkflowNode(KD_DatabaseRowsInput, false)
-{
+ : WorkflowNode(KD_DatabaseRowsInput, false) {
}
-void DatabaseRowsInputNode::Evaluate(WorkflowEvaluationContext& ctx)
-{
+void DatabaseRowsInputNode::Evaluate(WorkflowEvaluationContext& ctx) {
}
diff --git a/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.hpp b/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.hpp
index f0b923c..4ad4b02 100644
--- a/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.hpp
+++ b/app/source/Cplt/Model/Workflow/Nodes/UserInputNodes.hpp
@@ -2,8 +2,7 @@
#include <Cplt/Model/Workflow/Workflow.hpp>
-class FormInputNode : public WorkflowNode
-{
+class FormInputNode : public WorkflowNode {
public:
static bool IsInstance(const WorkflowNode* node);
FormInputNode();
@@ -12,8 +11,7 @@ public:
virtual void Evaluate(WorkflowEvaluationContext& ctx) override;
};
-class DatabaseRowsInputNode : public WorkflowNode
-{
+class DatabaseRowsInputNode : public WorkflowNode {
public:
static bool IsInstance(const WorkflowNode* node);
DatabaseRowsInputNode();