20using json = nlohmann::json;
56bool Get(
const json& j,
const std::string& name,
T& t)
58 auto iter = j.find(name);
70 catch (nlohmann::detail::exception& e)
73 log_err(
"json取值失败({}): {}", name, e.what());
88 catch (nlohmann::detail::exception& e)
91 log_err(
"json取值失败: {}", e.what());
118 template<
typename T,
size_t N>
121 for (
size_t i = 0; i <
N; ++i)
123 arr[i] = j.
at(i).get<
T>();
127 template<
typename T,
size_t N>
131 for (
size_t i = 0; i <
N; ++i)
constexpr T & at(size_t i)
类似std::array,增加xyzw、wh等成员访问
void SetLog(bool open)
设置是否提示输出日志(请直接使用DisableLog来关闭后,自动恢复)
json Parse(std::string_view path_name)
从 文件 构建json对象
bool Get(const json &j, const std::string &name, T &t)
从json返回值,不存在则返回false,打印日志
std::string Dump(json &j)
dump
std::span< std::byte > BufferView
void from_json(const json &j, Array< T, N > &arr)
void to_json(json &j, const Array< T, N > &arr)