summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2021-05-21 18:34:20 -0700
committerrtk0c <[email protected]>2021-05-21 18:34:20 -0700
commitbb2ab4bc5b2c9cc25ef1858ac538f2dc48af2d2c (patch)
tree5ca29166332b3d043c6db773452d3bd168e31088 /core/src
parentdc13110c14bf49e495d4b4243fd4758232f8716f (diff)
Fix type and field the same name
Diffstat (limited to 'core/src')
-rw-r--r--core/src/Model/Workflow/Nodes/TextNodes.cpp12
-rw-r--r--core/src/Model/Workflow/Nodes/TextNodes.hpp4
-rw-r--r--core/src/Model/Workflow/Values/BasicValues.cpp1
-rw-r--r--core/src/UI/UI_Workflows.cpp40
4 files changed, 29 insertions, 28 deletions
diff --git a/core/src/Model/Workflow/Nodes/TextNodes.cpp b/core/src/Model/Workflow/Nodes/TextNodes.cpp
index 6c71309..e67b033 100644
--- a/core/src/Model/Workflow/Nodes/TextNodes.cpp
+++ b/core/src/Model/Workflow/Nodes/TextNodes.cpp
@@ -92,7 +92,7 @@ void TextFormatterNode::SetElement(int idx, ArgumentType argument)
mMinOutputChars -= original.size();
mElements[idx] = Argument{
- .ArgumentType = argument,
+ .Type = argument,
.PinIdx = Impl::FindPinForElement(mElements, idx),
};
/* `original` is invalid from this point */
@@ -106,7 +106,7 @@ void TextFormatterNode::SetElement(int idx, ArgumentType argument)
// Create element
mElements[idx] = Argument{
- .ArgumentType = argument,
+ .Type = argument,
.PinIdx = pinIdx,
};
/* `original` is invalid from this point */
@@ -139,7 +139,7 @@ void TextFormatterNode::InsertElement(int idx, ArgumentType argument)
mElements.insert(
mElements.begin() + idx,
Argument{
- .ArgumentType = argument,
+ .Type = argument,
.PinIdx = pinIdx,
});
}
@@ -158,7 +158,7 @@ void TextFormatterNode::AppendElement(ArgumentType argument)
mInputs.back().MatchingType = ArgumentTypeToValueKind(argument);
// Creat eelement
mElements.push_back(Argument{
- .ArgumentType = argument,
+ .Type = argument,
.PinIdx = pinIdx,
});
}
@@ -183,7 +183,7 @@ void TextFormatterNode::Evaluate(WorkflowEvaluationContext& ctx)
result += str;
};
auto HandleArgument = [&](const Argument& arg) {
- switch (arg.ArgumentType) {
+ switch (arg.Type) {
case NumericArgument: {
if (auto val = dyn_cast<NumericValue>(ctx.GetConnectionValue(mInputs[arg.PinIdx]))) {
result += val->GetString();
@@ -228,4 +228,4 @@ void TextFormatterNode::PreRemoveElement(int idx)
arg.PinIdx--;
});
}
-} \ No newline at end of file
+}
diff --git a/core/src/Model/Workflow/Nodes/TextNodes.hpp b/core/src/Model/Workflow/Nodes/TextNodes.hpp
index 1beb145..c33854c 100644
--- a/core/src/Model/Workflow/Nodes/TextNodes.hpp
+++ b/core/src/Model/Workflow/Nodes/TextNodes.hpp
@@ -22,7 +22,7 @@ private:
struct Argument
{
- ArgumentType ArgumentType;
+ ArgumentType Type;
int PinIdx;
};
using Element = std::variant<std::string, Argument>;
@@ -50,4 +50,4 @@ public:
private:
void PreRemoveElement(int idx);
-}; \ No newline at end of file
+};
diff --git a/core/src/Model/Workflow/Values/BasicValues.cpp b/core/src/Model/Workflow/Values/BasicValues.cpp
index 3f58de8..93ee366 100644
--- a/core/src/Model/Workflow/Values/BasicValues.cpp
+++ b/core/src/Model/Workflow/Values/BasicValues.cpp
@@ -1,6 +1,7 @@
#include "BasicValues.hpp"
#include <charconv>
+#include <cmath>
#include <limits>
bool NumericValue::IsInstance(const BaseValue* value)
diff --git a/core/src/UI/UI_Workflows.cpp b/core/src/UI/UI_Workflows.cpp
index 1a4294f..a375ec0 100644
--- a/core/src/UI/UI_Workflows.cpp
+++ b/core/src/UI/UI_Workflows.cpp
@@ -17,26 +17,26 @@
namespace ImNodes = ax::NodeEditor;
namespace {
+enum class WorkflowCategory
+{
+ NumericCategory,
+ TextCategory,
+ DocumentsCategory,
+ UserInputCategory,
+ SystemInputCategory,
+ OutputCategory,
+};
+
class WorkflowDatabase
{
public:
using WorkflowNodeConstructor = std::unique_ptr<WorkflowNode> (*)();
- enum Category
- {
- NumericCategory,
- TextCategory,
- DocumentsCategory,
- UserInputCategory,
- SystemInputCategory,
- OutputCategory,
- };
-
struct Candidate
{
WorkflowNodeConstructor Constructor;
std::string Name;
- Category Category;
+ WorkflowCategory Category;
};
private:
@@ -71,41 +71,41 @@ public:
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericOperationNode>(NumericOperationNode::Addition); },
.Name = "Add",
- .Category = NumericCategory,
+ .Category = WorkflowCategory::NumericCategory,
});
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericOperationNode>(NumericOperationNode::Subtraction); },
.Name = "Subtract",
- .Category = NumericCategory,
+ .Category = WorkflowCategory::NumericCategory,
});
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericOperationNode>(NumericOperationNode::Multiplication); },
.Name = "Multiply",
- .Category = NumericCategory,
+ .Category = WorkflowCategory::NumericCategory,
});
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericOperationNode>(NumericOperationNode::Division); },
.Name = "Divide",
- .Category = NumericCategory,
+ .Category = WorkflowCategory::NumericCategory,
});
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericExpressionNode>(); },
.Name = "Evaluate expression",
- .Category = NumericCategory,
+ .Category = WorkflowCategory::NumericCategory,
});
mTextOffset = mCandidates.size();
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<TextFormatterNode>(); },
.Name = "Fill template text",
- .Category = TextCategory,
+ .Category = WorkflowCategory::TextCategory,
});
mDocumentOffset = mCandidates.size();
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<DocumentTemplateExpansionNode>(); },
.Name = "Document template",
- .Category = Category::DocumentsCategory,
+ .Category = WorkflowCategory::DocumentsCategory,
});
/* Inputs */
@@ -114,13 +114,13 @@ public:
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<FormInputNode>(); },
.Name = "Input: form",
- .Category = Category::UserInputCategory,
+ .Category = WorkflowCategory::UserInputCategory,
});
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<DatabaseRowsInputNode>(); },
.Name = "Input: database rows",
- .Category = Category::UserInputCategory,
+ .Category = WorkflowCategory::UserInputCategory,
});
mSystemInputNodes = mCandidates.size();