iw4x-client/src/Utils/Json.hpp

26 lines
507 B
C++
Raw Normal View History

2022-06-12 17:07:53 -04:00
#pragma once
#include <json.hpp>
2022-06-12 17:07:53 -04:00
namespace Utils::Json
{
std::string TypeToString(nlohmann::json::value_t type);
2022-12-14 03:40:15 -05:00
unsigned long ReadFlags(const std::string binaryFlags, size_t size);
Game::Bounds ReadBounds(const nlohmann::json& value);
template <typename T> void CopyArray(T* destination, const nlohmann::json& json_member, size_t count = 0)
{
if (count == 0)
{
count = json_member.size();
}
for (size_t i = 0; i < count; i++)
{
destination[i] = json_member[i].get<T>();
}
}
2022-06-12 17:07:53 -04:00
}