aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/Workflow/Values/Basic.hpp
blob: 38e0531af3b8db7be100fd7f064825b6d61118ff (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once

#include "Model/Workflow/Value.hpp"

#include <chrono>
#include <cstdint>
#include <string>

class NumericValue : public BaseValue
{
private:
	double mValue;

public:
	static bool IsInstance(const BaseValue* value);
	NumericValue();

	NumericValue(const NumericValue&) = delete;
	NumericValue& operator=(const NumericValue&) = delete;
	NumericValue(NumericValue&&) = default;
	NumericValue& operator=(NumericValue&&) = default;

	std::string GetTruncatedString() const;
	std::string GetRoundedString() const;
	std::string GetString() const;

	int64_t GetInt() const;
	double GetValue() const;
	void SetValue(double value);
};

class TextValue : public BaseValue
{
private:
	std::string mValue;

public:
	static bool IsInstance(const BaseValue* value);
	TextValue();

	TextValue(const TextValue&) = delete;
	TextValue& operator=(const TextValue&) = delete;
	TextValue(TextValue&&) = default;
	TextValue& operator=(TextValue&&) = default;

	const std::string& GetValue() const;
	void SetValue(const std::string& value);
};

class DateTimeValue : public BaseValue
{
private:
	std::chrono::time_point<std::chrono::system_clock> mValue;

public:
	static bool IsInstance(const BaseValue* value);
	DateTimeValue();

	DateTimeValue(const DateTimeValue&) = delete;
	DateTimeValue& operator=(const DateTimeValue&) = delete;
	DateTimeValue(DateTimeValue&&) = default;
	DateTimeValue& operator=(DateTimeValue&&) = default;

	std::string GetString() const;
	const std::chrono::time_point<std::chrono::system_clock>& GetValue() const;
	void SetValue(const std::chrono::time_point<std::chrono::system_clock>& value);
};