ores.cpp.domain.json_io_impl
reflect-cpp JSON round-trip implementation. domain profile. Implements the `operator<<` overload using reflect-cpp: `rfl::json::write(v, s)` serialises the struct to JSON via compile-time reflection — no field enumeration required.
See the Template variable reference for the complete list of available variables and their semantics.
Template
The full template source. Edit here and re-tangle with
compass build --direct tangle_codegen_templates to regenerate
library/templates/cpp_domain_type_json_io.cpp.mustache.
{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_domain.org. Edit the org source. }}
{{{cpp_license}}}
{{#domain_entity}}
#include "ores.{{component_include}}/domain/{{entity_singular}}_json_io.hpp"
#include <ostream>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include "ores.utility/rfl/reflectors.hpp" // IWYU pragma: keep.
namespace ores::{{component}}::domain {
std::ostream& operator<<(std::ostream& s, const {{entity_singular}}& v) {
rfl::json::write(v, s);
return s;
}
}
{{/domain_entity}}
{{#junction}}
#include "ores.{{component_include}}/domain/{{name_singular}}_json_io.hpp"
#include <ostream>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include "ores.utility/rfl/reflectors.hpp" // IWYU pragma: keep.
namespace ores::{{component}}::domain {
std::ostream& operator<<(std::ostream& s, const {{name_singular}}& v) {
rfl::json::write(v, s);
return s;
}
}
{{/junction}}
See also
- Parent facet: ores.cpp.domain
- Template variable reference