aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/Model/Workflow/Evaluation.cpp18
-rw-r--r--core/src/Model/Workflow/Value_RTTI.cpp11
-rw-r--r--core/src/Model/Workflow/Values/Basic.cpp6
-rw-r--r--core/src/Model/Workflow/Workflow_Main.cpp2
-rw-r--r--core/src/UI/UI_Items.cpp4
-rw-r--r--core/src/UI/UI_Templates.cpp13
-rw-r--r--core/src/Utils/Time.cpp2
7 files changed, 24 insertions, 32 deletions
diff --git a/core/src/Model/Workflow/Evaluation.cpp b/core/src/Model/Workflow/Evaluation.cpp
index f6472dd..7035bf9 100644
--- a/core/src/Model/Workflow/Evaluation.cpp
+++ b/core/src/Model/Workflow/Evaluation.cpp
@@ -39,18 +39,16 @@ std::string WorkflowEvaluationError::Format() const
return result;
}
-namespace {
-enum class EvaluationStatus
-{
- Unevaluated,
- Success,
- Failed,
-};
-} // namespace
-
struct WorkflowEvaluationContext::RuntimeNode
{
- EvaluationStatus Status = EvaluationStatus::Unevaluated;
+ enum EvaluationStatus
+ {
+ ST_Unevaluated,
+ ST_Success,
+ ST_Failed,
+ };
+
+ EvaluationStatus Status = ST_Unevaluated;
};
struct WorkflowEvaluationContext::RuntimeConnection
diff --git a/core/src/Model/Workflow/Value_RTTI.cpp b/core/src/Model/Workflow/Value_RTTI.cpp
index 121fa14..0561239 100644
--- a/core/src/Model/Workflow/Value_RTTI.cpp
+++ b/core/src/Model/Workflow/Value_RTTI.cpp
@@ -7,6 +7,11 @@
#include "UI/UI.hpp"
#include "Utils/I18n.hpp"
+constexpr BaseValue::KindInfo kEmptyInfo{
+ .PinIcon = ImGui::IconType::Circle,
+ .PinColor = RgbaColor(),
+};
+
constexpr BaseValue::KindInfo kNumericInfo{
.PinIcon = ImGui::IconType::Circle,
.PinColor = RgbaColor(147, 226, 74),
@@ -42,7 +47,7 @@ constexpr BaseValue::KindInfo kDatabaseRowInfo{
.PinColor = RgbaColor(15, 124, 196),
};
-constexpr BaseValue::KindInfo kObjectinfo{
+constexpr BaseValue::KindInfo kObjectInfo{
.PinIcon = ImGui::IconType::Square,
.PinColor = RgbaColor(161, 161, 161),
};
@@ -57,14 +62,14 @@ const BaseValue::KindInfo& BaseValue::QueryInfo(BaseValue::Kind kind)
case KD_List: return kListInfo;
case KD_Dictionary: return kDictionaryInfo;
- case KD_BaseObject: return kObjectinfo;
+ case KD_BaseObject: return kObjectInfo;
case KD_SaleDatabaseRow:
case KD_PurchaseDatabaseRow:
return kDatabaseRowInfo;
case InvalidKind: break;
}
- // TODO provide info here
+ return kEmptyInfo;
}
const char* BaseValue::Format(Kind kind)
diff --git a/core/src/Model/Workflow/Values/Basic.cpp b/core/src/Model/Workflow/Values/Basic.cpp
index d6a2395..198387c 100644
--- a/core/src/Model/Workflow/Values/Basic.cpp
+++ b/core/src/Model/Workflow/Values/Basic.cpp
@@ -18,18 +18,12 @@ template <class T, int kMaxSize>
static std::string NumberToString(T value)
{
char buf[kMaxSize];
-
-#if PLATFORM_WIN32
auto res = std::to_chars(buf, buf + kMaxSize, value);
if (res.ec == std::errc()) {
return std::string(buf, res.ptr);
} else {
return "<err>";
}
-#else
- // TODO libstdc++ doesn't have floating point charconv yet
- return std::to_string(value);
-#endif
}
std::string NumericValue::GetTruncatedString() const
diff --git a/core/src/Model/Workflow/Workflow_Main.cpp b/core/src/Model/Workflow/Workflow_Main.cpp
index af5103d..2dbed58 100644
--- a/core/src/Model/Workflow/Workflow_Main.cpp
+++ b/core/src/Model/Workflow/Workflow_Main.cpp
@@ -25,8 +25,8 @@ namespace ImNodes = ax::NodeEditor;
WorkflowConnection::WorkflowConnection()
: Id{ 0 }
, SourceNode{ WorkflowNode::kInvalidId }
- , DestinationNode{ WorkflowNode::kInvalidId }
, SourcePin{ WorkflowNode::kInvalidPinId }
+ , DestinationNode{ WorkflowNode::kInvalidId }
, DestinationPin{ WorkflowNode::kInvalidPinId }
{
}
diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp
index 2685c82..5b84cb8 100644
--- a/core/src/UI/UI_Items.cpp
+++ b/core/src/UI/UI_Items.cpp
@@ -32,8 +32,6 @@ ActionResult ItemEditor(ItemList<T>& list, T* item)
t.GetEmail();
};
- auto& gs = GlobalStates::GetInstance();
-
static bool duplicateName = false;
static std::string name;
@@ -116,8 +114,6 @@ void ItemListEntries(ItemList<T>& list, int& selectedIdx)
};
constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice;
- auto& gs = GlobalStates::GetInstance();
-
if (ImGui::BeginTable("", kColumns, ImGuiTableFlags_Borders)) {
ImGui::TableSetupColumn(I18N_TEXT("Name", L10N_ITEM_COLUMN_NAME));
diff --git a/core/src/UI/UI_Templates.cpp b/core/src/UI/UI_Templates.cpp
index b4e3aa5..0320ea0 100644
--- a/core/src/UI/UI_Templates.cpp
+++ b/core/src/UI/UI_Templates.cpp
@@ -194,7 +194,6 @@ private:
if (!IsSelected()) {
ImGui::Text(I18N_TEXT("Select a cell to edit", L10N_TABLE_CELL_SELECT_MSG));
} else if (mSelectionTL == mSelectionBR) {
- auto& selectCell = mTable->GetCell(mSelectionTL);
DisplayCellProperties(mSelectionTL);
} else {
DisplayRangeProperties(mSelectionTL, mSelectionBR);
@@ -260,9 +259,9 @@ private:
int dividend = column;
int modulo;
- char* lastChar = bufferEnd - 1;
- *lastChar = '\0';
- char* writeHead = lastChar - 1;
+ char* writeHead = bufferEnd - 1;
+ *writeHead = '\0';
+ --writeHead;
while (dividend > 0) {
if (writeHead < bufferBegin) {
@@ -730,17 +729,19 @@ std::unique_ptr<TemplateUI> TemplateUI::CreateByKind(Template::Kind kind, std::u
#define UNIQUE_CAST(TargetType, input) std::unique_ptr<TargetType>(static_cast<TargetType*>(input.release()))
switch (kind) {
case Template::KD_Table: return std::make_unique<TableTemplateUI>(UNIQUE_CAST(TableTemplate, tmpl));
- case Template::InvalidKind: return nullptr;
+ case Template::InvalidKind: break;
}
#pragma pop_macro("UNIQUE_CAST")
+ return nullptr;
}
std::unique_ptr<TemplateUI> TemplateUI::CreateByKind(Template::Kind kind)
{
switch (kind) {
case Template::KD_Table: return std::make_unique<TableTemplateUI>(std::make_unique<TableTemplate>());
- case Template::InvalidKind: return nullptr;
+ case Template::InvalidKind: break;
}
+ return nullptr;
}
} // namespace
diff --git a/core/src/Utils/Time.cpp b/core/src/Utils/Time.cpp
index 9086e31..4e79ffa 100644
--- a/core/src/Utils/Time.cpp
+++ b/core/src/Utils/Time.cpp
@@ -22,8 +22,6 @@ std::string TimeUtils::StringifyTimeStamp(int64_t timeStamp)
}
namespace chrono = std::chrono;
- using Clock = chrono::system_clock;
-
chrono::milliseconds d{ timeStamp };
chrono::time_point<chrono::system_clock> tp{ d };