2 #include <State/OSSIASerializationImpl.hpp>
4 #include <ossia/detail/size.hpp>
5 #include <ossia/detail/typelist.hpp>
10 using var_t = ossia::value_variant_type;
12 using value_type_list = ossia::tl<
13 float, int, ossia::vec2f, ossia::vec3f, ossia::vec4f, ossia::impulse, bool,
14 std::string, std::vector<ossia::value>, ossia::value_map_type>;
18 s.stream.StartObject();
19 if((quint64)var.which() != (quint64)var.npos)
28 if(!s.base.IsObject() || s.base.MemberCount() == 0)
35 template <
typename Functor>
37 Functor&& functor, ossia::value_variant_type::Type type,
38 ossia::value_variant_type& var)
40 using namespace ossia;
43 case value_variant_type::Type::Type0:
45 case value_variant_type::Type::Type1:
47 case value_variant_type::Type::Type2:
49 case value_variant_type::Type::Type3:
51 case value_variant_type::Type::Type4:
53 case value_variant_type::Type::Type5:
55 case value_variant_type::Type::Type6:
57 case value_variant_type::Type::Type7:
59 case value_variant_type::Type::Type8:
60 return functor(
typeholder<std::vector<ossia::value>>{}, var);
61 case value_variant_type::Type::Type9:
72 void operator()(
const T& value)
81 using var_t = ossia::value_variant_type;
84 s.stream() << (quint64)var.which();
99 if(which != (quint64)var.npos)
102 [&](
auto type, var_t& var) {
103 typename decltype(type)::type value;
105 var = std::move(value);
107 (var_t::Type)which, var);
126 void JSONReader::read(
const ossia::impulse& value)
132 void JSONWriter::write(ossia::impulse& value)
139 readFrom((
const ossia::value_variant_type&)n.v);
145 writeTo((ossia::value_variant_type&)n.v);
149 SCORE_LIB_STATE_EXPORT
void JSONReader::read(
const ossia::value& n)
155 SCORE_LIB_STATE_EXPORT
void JSONWriter::write(ossia::value& n)
Definition: VisitorInterface.hpp:53
Definition: DataStreamVisitor.hpp:27
void readFrom(const score::Entity< T > &obj)
Called by code that wants to serialize.
Definition: DataStreamVisitor.hpp:53
Definition: DataStreamVisitor.hpp:202
Definition: VisitorInterface.hpp:61
Definition: JSONVisitor.hpp:52
Definition: JSONVisitor.hpp:423
Definition: VisitorInterface.hpp:13
Definition: ValueSerializationImpl.hpp:69
Definition: VariantSerialization.hpp:183
Definition: VariantSerialization.hpp:152
Definition: OSSIASerializationImpl.hpp:81