diff options
author | rtk0c <[email protected]> | 2021-04-26 14:07:28 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-04-26 14:07:28 -0700 |
commit | b7d5b514e7bffd3149a99bc7f1424f8251876d85 (patch) | |
tree | 42f2867875c0b367fab2a6db7be395f8c777eb41 /core/src/Model/Workflow/Evaluation.cpp | |
parent | e7afe82857ac3ccc3e10b40cee60ea94cc59232b (diff) |
Serialization for workflow stuff
Diffstat (limited to 'core/src/Model/Workflow/Evaluation.cpp')
-rw-r--r-- | core/src/Model/Workflow/Evaluation.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/src/Model/Workflow/Evaluation.cpp b/core/src/Model/Workflow/Evaluation.cpp index db09973..ff3edf4 100644 --- a/core/src/Model/Workflow/Evaluation.cpp +++ b/core/src/Model/Workflow/Evaluation.cpp @@ -2,6 +2,40 @@ #include <queue> +const char* WorkflowEvaluationError::FormatMessageType(enum MessageType messageType) { + switch (messageType) { + case Error: return "Error"; + case Warning: return "Warning"; + } +} + +const char* WorkflowEvaluationError::FormatPinType(enum PinType pinType) { + switch (pinType) { + case NoPin: return nullptr; + case InputPin: return "Input pin"; + case OutputPin: return "Output pin"; + } +} + +std::string WorkflowEvaluationError::Format() const { + // TODO convert to std::format + + std::string result; + result += FormatMessageType(this->Type); + result += " at "; + result += NodeId; + if (auto pinText = FormatPinType(this->PinType)) { + result += "/"; + result += pinText; + result += " "; + result += PinId; + } + result += ": "; + result += this->Message; + + return result; +} + namespace { enum class EvaluationStatus { Unevaluated, |