aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/Workflow/Value_RTTI.cpp
blob: 5e24ed7778fbc6d66d550949ec45f748efe7d7c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Value.hpp"

#include "Model/Workflow/Values/BasicValues.hpp"
#include "UI/UI.hpp"

constexpr BaseValue::KindInfo kNumericInfo{
	.PinIcon = ImGui::IconType::Circle,
	.PinColor = RgbaColor(147, 226, 74),
};

constexpr BaseValue::KindInfo kTextInfo{
	.PinIcon = ImGui::IconType::Circle,
	.PinColor = RgbaColor(124, 21, 153),
};

constexpr  BaseValue::KindInfo kDateTimeInfo{
	.PinIcon = ImGui::IconType::Diamond,
	.PinColor = RgbaColor(147, 226, 74),
};

const BaseValue::KindInfo& BaseValue::QueryInfo(BaseValue::Kind kind)
{
	switch (kind) {
		case KD_Numeric: return kNumericInfo;
		case KD_Text: break;
		case KD_DateTime: break;
		case InvalidKind: break;
	}
}

const char* BaseValue::Format(Kind kind)
{
	switch (kind) {
		case KD_Numeric: return "Numeric";
		case KD_Text: return "Text";
		case KD_DateTime: return "Date/time";
		case InvalidKind: return "<invalid kind>";
	}
}

std::unique_ptr<BaseValue> BaseValue::CreateByKind(BaseValue::Kind kind)
{
	switch (kind) {
		case KD_Numeric: return std::make_unique<NumericValue>();
		case KD_Text: return std::make_unique<TextValue>();
		case KD_DateTime: return std::make_unique<DateTimeValue>();
		case InvalidKind: return nullptr;
	}
}