aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/Workflow/Value.hpp
blob: 2748e1604013a1f118ee975f9747128707f9d38f (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
#pragma once

#include <iosfwd>
#include <memory>

class BaseValue {
public:
	enum Kind {
		KD_Numeric,
		KD_Text,
		KD_DateTime,

		/// An unspecified type, otherwise known as "any" in some contexts.
		InvalidKind,
		KindCount = InvalidKind,
	};

private:
	Kind mKind;

public:
	static const char* FormatKind(Kind kind);
	static std::unique_ptr<BaseValue> CreateByKind(Kind kind);

	BaseValue(Kind kind);
	virtual ~BaseValue() = default;

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

	Kind GetKind() const;

	// TODO get constant editor

	/// The functions \c ReadFrom, \c WriteTo will only be valid to call if this function returns true.
	virtual bool SupportsConstant() const;
	virtual void ReadFrom(std::istream& stream);
	virtual void WriteTo(std::ostream& stream);
};