MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ decode_property() [1/2]

template<typename Class , typename T >
static void MayaFlux::IO::JSONSerializer::decode_property ( const nlohmann::json &  j,
Class &  obj,
const Reflect::OptionalProperty< Class, T > &  prop 
)
inlinestaticprivate

Definition at line 286 of file JSONSerializer.hpp.

290 {
291 if (!j.contains(prop.key) || j.at(prop.key).is_null()) {
292 obj.*prop.member = std::nullopt;
293 } else {
294 T inner {};
295 from_json(j.at(prop.key), inner);
296 obj.*prop.member = std::move(inner);
297 }
298 }
static void from_json(const nlohmann::json &j, T &out)

References MayaFlux::Reflect::OptionalProperty< Class, T >::key, MayaFlux::Reflect::OptionalProperty< Class, T >::member, and MayaFlux::IO::T.