diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 09:40:22 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 09:40:22 -0400 |
commit | c443acfd0b25b3e4f3446f795777b8dd18b00e2b (patch) | |
tree | 86340c00f1723310cbab02f0ebc496b25a780278 /src/godot_variant.h | |
parent | 378766bcee3cad04256ada937f96b232aba85cf3 (diff) | |
parent | ab5206255603f6401d9c216ffce26607da16ad33 (diff) | |
download | lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.tar.gz lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.tar.bz2 lingo-ap-tracker-c443acfd0b25b3e4f3446f795777b8dd18b00e2b.zip |
Merge branch 'main' into panels
Diffstat (limited to 'src/godot_variant.h')
-rw-r--r-- | src/godot_variant.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/godot_variant.h b/src/godot_variant.h new file mode 100644 index 0000000..620e569 --- /dev/null +++ b/src/godot_variant.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef GODOT_VARIANT_H_ED7F2EB6 | ||
2 | #define GODOT_VARIANT_H_ED7F2EB6 | ||
3 | |||
4 | #include <string> | ||
5 | #include <variant> | ||
6 | #include <vector> | ||
7 | |||
8 | struct GodotVariant { | ||
9 | using value_type = std::variant<std::monostate, bool, std::vector<std::string>, std::vector<GodotVariant>>; | ||
10 | |||
11 | value_type value; | ||
12 | |||
13 | GodotVariant(value_type v) : value(v) {} | ||
14 | |||
15 | bool AsBool() const { return std::get<bool>(value); } | ||
16 | |||
17 | const std::vector<std::string>& AsNodePath() const { | ||
18 | return std::get<std::vector<std::string>>(value); | ||
19 | } | ||
20 | |||
21 | const std::vector<GodotVariant>& AsArray() const { | ||
22 | return std::get<std::vector<GodotVariant>>(value); | ||
23 | } | ||
24 | }; | ||
25 | |||
26 | GodotVariant ParseGodotFile(std::string filename); | ||
27 | |||
28 | #endif /* end of include guard: GODOT_VARIANT_H_ED7F2EB6 */ | ||