4 #include <pajlada/serialize.hpp> 6 #include <unordered_map> 10 template <
typename ValueType,
typename RJValue>
11 struct Serialize<
std::unordered_map<QString, ValueType>, RJValue> {
12 static RJValue
get(
const std::unordered_map<QString, ValueType> &value,
13 typename RJValue::AllocatorType &a)
15 RJValue ret(rapidjson::kObjectType);
17 for (
auto it = value.begin(); it != value.end(); ++it)
19 detail::AddMember<ValueType, RJValue>(ret, it->first.toUtf8(),
27 template <
typename ValueType,
typename RJValue>
28 struct Deserialize<
std::unordered_map<QString, ValueType>, RJValue> {
29 static std::unordered_map<QString, ValueType>
get(
const RJValue &value,
30 bool *error =
nullptr)
32 std::unordered_map<QString, ValueType> ret;
34 if (!value.IsObject())
36 PAJLADA_REPORT_ERROR(error)
40 for (
typename RJValue::ConstMemberIterator it = value.MemberBegin();
41 it != value.MemberEnd(); ++it)
43 ret.emplace(it->name.GetString(),
44 Deserialize<ValueType, RJValue>::get(it->value, error));
Definition: SeventvEventAPISubscription.hpp:67
Definition: Command.hpp:25