dl
dl_json.h
浏览该文件的文档.
1
12#pragma once
13
14#include <json.hpp>
15
16using json = nlohmann::json;
17
18namespace dl::Json
19{
20
25json Parse(std::string_view path_name);
26
27
31template<typename T>
32bool Get(const json& j, const std::string& name, T& t)
33{
34 auto iter = j.find(name);
35 if (iter == j.end())
36 return false;
37 t = *iter;
38 return true;
39}
40
41
42}
43
nlohmann::json json
Definition: dl_json.h:16
json Parse(std::string_view path_name)
从 文件 构建json对象
bool Get(const json &j, const std::string &name, T &t)
从json返回值,不存在则返回false,并且不进行任何操作
Definition: dl_json.h:32