aboutsummaryrefslogtreecommitdiff
path: root/app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp
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/TextNodes.cpp
parentb01ed99a1cd0c863c8709930658513c04dd70f61 (diff)
Update brace style to match rest of my projectscplt-imgui
Diffstat (limited to 'app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp')
-rw-r--r--app/source/Cplt/Model/Workflow/Nodes/TextNodes.cpp51
1 files changed, 17 insertions, 34 deletions
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);