summary refs log tree commit diff stats
path: root/generator/godot_variant.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-12-06 17:33:40 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-12-06 17:35:35 -0500
commitd1024b559c44a143eca214fb8732001080e8b037 (patch)
tree1c6ad799195b9f917047aa11b72e1f7dc0ecb013 /generator/godot_variant.h
parentad8243c74c1d718b94a2a4bf4f0fa56d4c9dbb45 (diff)
downloadlingo-randomizer-d1024b559c44a143eca214fb8732001080e8b037.tar.gz
lingo-randomizer-d1024b559c44a143eca214fb8732001080e8b037.tar.bz2
lingo-randomizer-d1024b559c44a143eca214fb8732001080e8b037.zip
Change output format to zstd compressed Godot serialized variant
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 */