Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
serializer.h
1#pragma once
2
3#include <rttr/type.h>
4
5#include "yaml-cpp/yaml.h"
6
7namespace sbk::core
8{
9 class object;
10}
11
12namespace sbk::engine
13{
14 class soundbank;
15 class system;
16} // namespace sbk::engine
17
18namespace sbk::core::serialization
19{
20 struct SB_CLASS SaveData
21 {
22 rttr::string_view saveName;
23 rttr::variant saveData;
24 };
25
26 class SB_CLASS Serializer final
27 {
28 public:
29 static void saveObject(sbk::core::object* object, YAML::Emitter& emitter);
30 static void saveSystem(sbk::engine::system* system, YAML::Emitter& emitter);
31
32 static void packageSoundbank(sbk::engine::soundbank* soundbank, YAML::Emitter& emitter);
33 static rttr::instance unpackSoundbank(YAML::Node& node);
34
35 static void loadSystem(sbk::engine::system* system, YAML::Node& node);
36
37 static rttr::instance createAndLoadObject(
38 YAML::Node& node, std::optional<rttr::method> onLoadedMethod = std::optional<rttr::method>());
39
40 static bool loadProperties(YAML::Node& node,
41 rttr::instance instance,
42 std::optional<rttr::method> onLoadedMethod = std::optional<rttr::method>());
43
44 private:
45 static bool saveInstance(YAML::Emitter& emitter, rttr::instance instance);
46 static bool saveVariant(YAML::Emitter& emitter, rttr::string_view name, rttr::variant& variant);
47 static bool saveStringVariant(YAML::Emitter& emitter, rttr::string_view name, rttr::variant variant);
48 static bool saveEnumVariant(YAML::Emitter& emitter, rttr::string_view name, rttr::variant variant);
49 static bool saveAssociateContainerVariant(YAML::Emitter& emitter,
50 rttr::string_view name,
51 rttr::variant variant);
52 static bool saveSequentialContainerVariant(YAML::Emitter& emitter,
53 rttr::string_view name,
54 rttr::variant variant);
55 static bool saveClassVariant(YAML::Emitter& emitter, rttr::string_view name, rttr::variant variant);
56 };
57} // namespace sbk::core::serialization
Definition database_ptr.h:23
Base object that all sound Bakery objects should inherit from.
Definition object.h:21
Definition serializer.h:27
Packages events and dependent objects and sounds.
Definition soundbank.h:33
Manager of the whole sound Bakery.
Definition system.h:44
Definition serializer.h:21