about summary refs log tree commit diff stats
path: root/src/godot_variant.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-07-19 03:51:23 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-07-19 03:51:23 -0400
commit8c5b719469bc61e33a451d9b3aeb66c7b0a6d68e (patch)
tree1f452dc8a601630a1fd50f4ee3f8ea25aed7b315 /src/godot_variant.h
parentb80e1b888a7203312119e5bfad9e26c2c17d9b9f (diff)
downloadlingo-ap-tracker-8c5b719469bc61e33a451d9b3aeb66c7b0a6d68e.tar.gz
lingo-ap-tracker-8c5b719469bc61e33a451d9b3aeb66c7b0a6d68e.tar.bz2
lingo-ap-tracker-8c5b719469bc61e33a451d9b3aeb66c7b0a6d68e.zip
Added savedata analyzer
Diffstat (limited to 'src/godot_variant.h')
-rw-r--r--src/godot_variant.h28
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
8struct 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
26GodotVariant ParseGodotFile(std::string filename);
27
28#endif /* end of include guard: GODOT_VARIANT_H_ED7F2EB6 */