blob: 838fc395749fe81893c07c5d3a54299fa1686f9f (
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
|
#pragma once
#include <chrono>
#include <cstdint>
#include <string>
class BaseValue {
public:
enum Type {
NumericType,
TextType,
DateTimeType,
/// An unspecified type, otherwise known as "any" in some contexts.
InvalidType,
TypeCount = InvalidType,
};
private:
Type mType;
public:
BaseValue(Type type);
virtual ~BaseValue() = default;
BaseValue(const BaseValue&) = delete;
BaseValue& operator=(const BaseValue&) = delete;
BaseValue(BaseValue&&) = default;
BaseValue& operator=(BaseValue&&) = default;
Type GetType() const;
};
class NumericValue : public BaseValue {
private:
double mValue;
public:
NumericValue();
int64_t GetInt() const;
double GetValue() const;
void SetValue(double value);
};
class TextValue : public BaseValue {
private:
std::string mValue;
public:
TextValue();
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:
DateTimeValue();
const std::chrono::time_point<std::chrono::system_clock>& GetValue() const;
void SetValue(const std::chrono::time_point<std::chrono::system_clock>& value);
};
|