dl
dl_json.h 文件参考

json格式相关 更多...

#include <json.hpp>
#include "io/dl_log.h"
#include "base/dl_array.h"
#include "memory/dl_buffer.h"

浏览该文件的源代码.

struct  dl::Json::DisableLog
 临时关闭json日志 更多...
 

命名空间

namespace  dl
 
namespace  dl::Json
 json格式
 

类型定义

using json = nlohmann::json
 

函数

void dl::Json::SetLog (bool open)
 设置是否提示输出日志(请直接使用DisableLog来关闭后,自动恢复)
 
json dl::Json::Parse (BufferView buf, bool binary=false)
 从 内存 构建json对象
 
json dl::Json::ParseFile (std::string_view path_name, bool binary=false)
 从 文件 构建json对象
 
json dl::Json::ParseString (std::string_view str)
 从 字符串 构建json对象
 
template<typename T>
bool dl::Json::Get (const json &j, const std::string &name, T &t)
 从json返回子元素值,不存在则返回false,打印日志
 
template<typename T>
bool dl::Json::Cast (const json &j, T &t)
 从json返回值,不存在则返回false,打印日志
 
std::string dl::Json::Dump (json &j)
 dump
 
std::string dl::Json::Dump (BufferView buf)
 dump
 
bool dl::Json::SaveFile (const json &j, std::string_view path_name, bool binary=false)
 保存到文件
 
template<typename T, size_t N>
void dl::from_json (const json &j, Array< T, N > &arr)
 
template<typename T, size_t N>
void dl::to_json (json &j, const Array< T, N > &arr)
 

变量

bool dl::Json::g_bJsonLog
 

详细描述

json格式相关

版本
1.0
作者
lveyou
日期
23-07-22
注解
基于 nlohmann::json

在文件 dl_json.h 中定义.

类型定义说明

◆ json

using json = nlohmann::json

在文件 dl_json.h20 行定义.