diff options
author | rtk0c <[email protected]> | 2021-04-18 22:29:10 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-04-18 22:29:10 -0700 |
commit | b00b306de1140cb7b759ed0f639e8210fd7dffa6 (patch) | |
tree | 601a7d5d457cad99a565a55ff318f6af4be07bc5 /core/src/Model/WorkflowNodes.cpp | |
parent | b3dfa12eee1cbca6be7a155e9e506d5a080071e2 (diff) |
Initial work on evaluation
Diffstat (limited to 'core/src/Model/WorkflowNodes.cpp')
-rw-r--r-- | core/src/Model/WorkflowNodes.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/core/src/Model/WorkflowNodes.cpp b/core/src/Model/WorkflowNodes.cpp index 14f72cb..f58c8bb 100644 --- a/core/src/Model/WorkflowNodes.cpp +++ b/core/src/Model/WorkflowNodes.cpp @@ -82,7 +82,7 @@ NumericExpressionNode::NumericExpressionNode() : WorkflowNode(TransformType, KD_NumericExpression) { } -struct FormatTextNode::Argument { +struct TextFormatterNode::Argument { ArgumentType ArgumentType; int PinIdx; @@ -108,7 +108,7 @@ struct FormatTextNode::Argument { } }; -BaseValue::Kind FormatTextNode::ArgumentTypeToValueKind(FormatTextNode::ArgumentType arg) { +BaseValue::Kind TextFormatterNode::ArgumentTypeToValueKind(TextFormatterNode::ArgumentType arg) { switch (arg) { case NumericArgument: return BaseValue::KD_Numeric; case TextArgument: return BaseValue::KD_Text; @@ -117,23 +117,23 @@ BaseValue::Kind FormatTextNode::ArgumentTypeToValueKind(FormatTextNode::Argument } } -bool FormatTextNode::IsInstance(const WorkflowNode* node) { +bool TextFormatterNode::IsInstance(const WorkflowNode* node) { return node->GetKind() == KD_TextFormatting; } -FormatTextNode::FormatTextNode() +TextFormatterNode::TextFormatterNode() : WorkflowNode(TransformType, KD_TextFormatting) { } -int FormatTextNode::GetElementCount() const { +int TextFormatterNode::GetElementCount() const { return mElements.size(); } -const FormatTextNode::Element& FormatTextNode::GetElement(int idx) const { +const TextFormatterNode::Element& TextFormatterNode::GetElement(int idx) const { return mElements[idx]; } -void FormatTextNode::SetElement(int idx, std::string text) { +void TextFormatterNode::SetElement(int idx, std::string text) { assert(idx >= 0 && idx < mElements.size()); std::visit( @@ -147,7 +147,7 @@ void FormatTextNode::SetElement(int idx, std::string text) { mElements[idx] = std::move(text); } -void FormatTextNode::SetElement(int idx, ArgumentType argument) { +void TextFormatterNode::SetElement(int idx, ArgumentType argument) { assert(idx >= 0 && idx < mElements.size()); std::visit( @@ -179,7 +179,7 @@ void FormatTextNode::SetElement(int idx, ArgumentType argument) { mElements[idx]); } -void FormatTextNode::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)); @@ -187,7 +187,7 @@ void FormatTextNode::InsertElement(int idx, std::string text) { mElements.insert(mElements.begin() + idx, std::move(text)); } -void FormatTextNode::InsertElement(int idx, ArgumentType argument) { +void TextFormatterNode::InsertElement(int idx, ArgumentType argument) { assert(idx >= 0); if (idx >= mElements.size()) AppendElement(argument); @@ -206,12 +206,12 @@ void FormatTextNode::InsertElement(int idx, ArgumentType argument) { }); } -void FormatTextNode::AppendElement(std::string text) { +void TextFormatterNode::AppendElement(std::string text) { mMinOutputChars += text.size(); mElements.push_back(std::move(text)); } -void FormatTextNode::AppendElement(ArgumentType argument) { +void TextFormatterNode::AppendElement(ArgumentType argument) { int pinIdx = mInputs.size(); // Create pin mInputs.push_back(InputPin{}); @@ -223,7 +223,7 @@ void FormatTextNode::AppendElement(ArgumentType argument) { }); } -void FormatTextNode::RemoveElement(int idx) { +void TextFormatterNode::RemoveElement(int idx) { assert(idx >= 0 && idx < mElements.size()); PreRemoveElement(idx); @@ -233,7 +233,7 @@ void FormatTextNode::RemoveElement(int idx) { mElements.erase(mElements.begin() + idx); } -void FormatTextNode::Evaluate(WorkflowEvaluationContext& ctx) { +void TextFormatterNode::Evaluate(WorkflowEvaluationContext& ctx) { std::string result; result.reserve((size_t)(mMinOutputChars * 1.5f)); @@ -274,7 +274,7 @@ void FormatTextNode::Evaluate(WorkflowEvaluationContext& ctx) { } } -void FormatTextNode::PreRemoveElement(int idx) { +void TextFormatterNode::PreRemoveElement(int idx) { auto& elm = mElements[idx]; if (auto arg = std::get_if<Argument>(&elm)) { RemoveInputPin(arg->PinIdx); |