cubos::core::data::JSONSerializer class

Implementation of the abstract Serializer class for serializing to JSON.

Base classes

class Serializer
Base class for serializers, which defines the interface for serializing arbitrary data using its reflection metadata.

Constructors, destructors, conversion operators

JSONSerializer()
Constructs.

Public functions

auto output() -> nlohmann::json
Outputs the serialized JSON. write must be called before this.

Protected functions

auto decompose(const reflection::Type& type, const void* value) -> bool override
Called for each type with no hook defined.

Function documentation

nlohmann::json cubos::core::data::JSONSerializer::output()

Outputs the serialized JSON. write must be called before this.

Returns JSON.

bool cubos::core::data::JSONSerializer::decompose(const reflection::Type& type, const void* value) override protected

Called for each type with no hook defined.

Parameters
type Type.
value Value.
Returns Whether the value was successfully serialized.

Should recurse by calling write() again as appropriate.