dl
dl::Json 命名空间参考

json格式 更多...

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

函数

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

变量

bool g_bJsonLog
 

详细描述

json格式

函数说明

◆ Cast()

template<typename T>
bool dl::Json::Cast ( const json & j,
T & t )

从json返回值,不存在则返回false,打印日志

在文件 dl_json.h93 行定义.

◆ Dump() [1/2]

std::string dl::Json::Dump ( BufferView buf)
inline

dump

在文件 dl_json.h120 行定义.

◆ Dump() [2/2]

std::string dl::Json::Dump ( json & j)
inline

dump

在文件 dl_json.h111 行定义.

◆ Get()

template<typename T>
bool dl::Json::Get ( const json & j,
const std::string & name,
T & t )

从json返回子元素值,不存在则返回false,打印日志

在文件 dl_json.h68 行定义.

◆ Parse()

json dl::Json::Parse ( BufferView buf,
bool binary = false )

从 内存 构建json对象

参数
[in]buf数据
[in]binary是否二进制json
注解
失败返回null,并输出日志

◆ ParseFile()

json dl::Json::ParseFile ( std::string_view path_name,
bool binary = false )

从 文件 构建json对象

参数
[in]buf数据
[in]binary是否二进制json文件
注解
失败返回null,并输出日志

◆ ParseString()

json dl::Json::ParseString ( std::string_view str)

从 字符串 构建json对象

参数
[in]str文本json
注解
失败返回null,并输出日志

◆ SaveFile()

bool dl::Json::SaveFile ( const json & j,
std::string_view path_name,
bool binary = false )

保存到文件

注解
binary保存的文件,加载时也需要传入true

◆ SetLog()

void dl::Json::SetLog ( bool open)

设置是否提示输出日志(请直接使用DisableLog来关闭后,自动恢复)

变量说明

◆ g_bJsonLog

bool dl::Json::g_bJsonLog
extern