summary refs log tree commit diff stats
path: root/generator/godot_variant.h
blob: 6f2651a7953de5e18b060c4b50de4edf5c7ffd99 (plain) (blame)
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
#ifndef GODOT_VARIANT_H_84682779
#define GODOT_VARIANT_H_84682779

#include <cctype>
#include <map>
#include <ostream>
#include <string>
#include <variant>
#include <vector>

struct GodotVariant {
  using variant_type = std::variant<std::monostate, int32_t, std::string,
                                    std::map<GodotVariant, GodotVariant>,
                                    std::vector<GodotVariant> >;

  variant_type value;

  GodotVariant(int32_t v) : value(v) {}
  GodotVariant(std::string v) : value(std::move(v)) {}
  GodotVariant(std::map<GodotVariant, GodotVariant> v) : value(std::move(v)) {}
  GodotVariant(std::vector<GodotVariant> v) : value(std::move(v)) {}

  bool operator<(const GodotVariant& rhs) const;

  void Serialize(std::basic_ostream<char>& output) const;
};

#endif /* end of include guard: GODOT_VARIANT_H_84682779 */