#pragma once #include #include #include namespace pajlada { template struct Serialize, RJValue> { static RJValue get(const std::unordered_map &value, typename RJValue::AllocatorType &a) { RJValue ret(rapidjson::kObjectType); for (auto it = value.begin(); it != value.end(); ++it) { detail::AddMember(ret, it->first.toUtf8(), it->second, a); } return ret; } }; template struct Deserialize, RJValue> { static std::unordered_map get(const RJValue &value, bool *error = nullptr) { std::unordered_map ret; if (!value.IsObject()) { PAJLADA_REPORT_ERROR(error) return ret; } for (typename RJValue::ConstMemberIterator it = value.MemberBegin(); it != value.MemberEnd(); ++it) { ret.emplace(it->name.GetString(), Deserialize::get(it->value, error)); } return ret; } }; } // namespace pajlada