← API Reference Struct

template<typename T> asge::game::scene::Serializer

Customization point mapping a component type T to/from TOML.

#include <Serialize.hpp>

Specialize this per component (see Transform/Velocity/Sprite in Game/Components/) to give it ToToml/FromToml; the primary template's static_assert fires if some other component is used here before it has one. A specialization is also expected to declare static constexpr std::string_view kTableName naming the subtable ToToml/FromToml agree on — that's what lets a generic per-entity walker (see Components.hpp's SerializableComponents) ask "does this entity have a T?" via TOMLTableView::HasTable without hardcoding the name a second time.

Static Public Member Functions

#static void ToToml(T inValue, asge::config::toml::TOMLTableView inTview, SaveContext const &inCtx) noexcept

Writes inValue's fields into inTview.

Shape is up to each specialization.

#static T FromToml(asge::config::toml::TOMLTableView inTview, LoadContext const &inCtx) noexcept

Reads a T back out of inTview, as previously written by ToToml.