GraceFt v2.3
开源图形引擎 EGE(Easy Graphics Engine) 的高层封装库
 
载入中...
搜索中...
未找到
GFt::json::Format结构体 参考

格式化选项 更多...

#include <json.hpp>

Public 类型

using jFormat = std::ios_base& (*)(std::ios_base&)
 

Public 成员函数

 Format (int tabsize=-1)
 设置格式化选项
 
 operator jFormat ()
 

静态 Public 成员函数

static bool isFormat ()
 
static int tabSize ()
 

友元

template<typename CharT >
class Value
 

详细描述

格式化选项

这个结构用于控制 JSON 序列化的格式 在 JSON 序列化时,可以通过设置这个结构的成员变量来控制格式化选项 默认情况下,会输出没有格式化的 JSON 字符串(不包含冗余空白符)

示例:
// 以 4 个空格为一个缩进单位,输出格式化后的 JSON 字符串
std::cout << json::Format(4) << /* json value */ << std::endl;
// 以压缩后格式输出 JSON 字符串
std::cout << json::Format() << /* json value */ << std::endl;
格式化选项
定义 json.hpp:55

成员类型定义说明

◆ jFormat

using GFt::json::Format::jFormat = std::ios_base& (*)(std::ios_base&)

构造及析构函数说明

◆ Format()

GFt::json::Format::Format ( int tabsize = -1)
inline

设置格式化选项

参数
tabsize一个整数,表示一个缩进单位的空格数,默认为 -1 表示不格式化

成员函数说明

◆ isFormat()

static bool GFt::json::Format::isFormat ( )
inlinestatic

◆ operator jFormat()

GFt::json::Format::operator jFormat ( )
inline

◆ tabSize()

static int GFt::json::Format::tabSize ( )
inlinestatic

友元及相关符号说明

◆ Value

template<typename CharT >
friend class Value
friend