summary refs log tree commit diff stats
path: root/generator/godot_variant.h
diff options
context:
space:
mode:
Diffstat (limited to 'generator/godot_variant.h')
-rw-r--r--generator/godot_variant.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/generator/godot_variant.h b/generator/godot_variant.h new file mode 100644 index 0000000..6f2651a --- /dev/null +++ b/generator/godot_variant.h
@@ -0,0 +1,28 @@
1#ifndef GODOT_VARIANT_H_84682779
2#define GODOT_VARIANT_H_84682779
3
4#include <cctype>
5#include <map>
6#include <ostream>
7#include <string>
8#include <variant>
9#include <vector>
10
11struct GodotVariant {
12 using variant_type = std::variant<std::monostate, int32_t, std::string,
13 std::map<GodotVariant, GodotVariant>,
14 std::vector<GodotVariant> >;
15
16 variant_type value;
17
18 GodotVariant(int32_t v) : value(v) {}
19 GodotVariant(std::string v) : value(std::move(v)) {}
20 GodotVariant(std::map<GodotVariant, GodotVariant> v) : value(std::move(v)) {}
21 GodotVariant(std::vector<GodotVariant> v) : value(std::move(v)) {}
22
23 bool operator<(const GodotVariant& rhs) const;
24
25 void Serialize(std::basic_ostream<char>& output) const;
26};
27
28#endif /* end of include guard: GODOT_VARIANT_H_84682779 */