3 #include <score/serialization/JSONVisitor.hpp>
4 #include <score/tools/std/String.hpp>
6 #include <ossia/detail/any_map.hpp>
22 using any_map = ossia::any_map;
32 void cast_error(
const char*);
40 if(
const T* ptr = std::any_cast<T>(&val))
55 if(
const T* ptr = std::any_cast<T>(&val))
69 using any_serializer_map = score::hash_map<std::string, std::unique_ptr<any_serializer>>;
75 void apply(
DataStreamReader& s,
const std::string& key,
const ossia::any& v);
81 void apply(
JSONReader& s,
const std::string& key,
const ossia::any& v);
84 void apply(
JSONWriter& s,
const std::string& key, ossia::any& v);
91 auto& st = s.stream();
93 st << (int32_t)obj.size();
94 for(
const auto& e : obj)
97 apply(s, e.first, e.second);
103 auto& st = s.stream();
106 for(
int i = 0; i < n; i++)
111 apply(s, key, value);
112 obj.emplace(std::move(key), std::move(value));
122 s.stream.StartObject();
123 for(
const auto& e : obj)
125 apply(s, e.first, e.second);
127 s.stream.EndObject();
132 for(
const auto& m : s.base.GetObject())
134 const std::string str(m.name.GetString(), m.name.GetStringLength());
135 apply(s, str, obj[str]);
141 struct is_template<
score::any_map> : std::true_type
Definition: VisitorInterface.hpp:53
Definition: DataStreamVisitor.hpp:27
Definition: DataStreamVisitor.hpp:202
Definition: VisitorInterface.hpp:61
Definition: JSONVisitor.hpp:52
Definition: JSONVisitor.hpp:423
Base toolkit upon which the software is built.
Definition: Application.cpp:90
score::hash_map< std::string, std::unique_ptr< any_serializer > > & anySerializers()
The serializers for types that go in ossia::any should fit in here.
Definition: AnySerialization.cpp:7
Definition: VisitorInterface.hpp:13
Definition: AnySerialization.hpp:37
Definition: AnySerialization.hpp:25