tpJsonValue类
Utils
2025-07-05
介绍
JSON值类,表示JSON中的各种数据类型
基础信息
头文件: | include <tpJsonValue.h> |
---|---|
Cmake: | None |
发布版本: | V0.1.0 |
继承类: | |
派生类: |
Public 成员函数
tpJsonValue() | 默认构造函数,创建空值(Null) | |
---|---|---|
tpJsonValue(bool b) | 从布尔值构造JSON值 | |
tpJsonValue(uint32_t i) | 从无符号32位整数构造JSON值 | |
tpJsonValue(int32_t i) | 从有符号32位整数构造JSON值 | |
tpJsonValue(int64_t i) | 从有符号64位整数构造JSON值 | |
tpJsonValue(uint64_t i) | 从无符号64位整数构造JSON值 | |
tpJsonValue(double d) | 从双精度浮点数构造JSON值 | |
tpJsonValue(const char *str) | 从C字符串构造JSON值 | |
tpJsonValue(const tpString &str) | 从字符串对象构造JSON值 | |
tpJsonValue(const tpJsonValue &others) | 拷贝构造函数 | |
isNull() const | 检查是否为空值(Null) | |
isBool() const | 检查是否为布尔值 | |
isInt() const | 检查是否为32位有符号整数 | |
isUint() const | 检查是否为32位无符号整数 | |
isInt64() const | 检查是否为64位有符号整数 | |
isUint64() const | 检查是否为64位无符号整数 | |
isDouble() const | 检查是否为双精度浮点数 | |
isString() const | 检查是否为字符串 | |
isObject() const | 检查是否为对象 | |
isArray() const | 检查是否为数组 | |
toBool() const | 转换为布尔值 | |
toInt() const | 转换为32位有符号整数 | |
toUint() const | 转换为32位无符号整数 | |
toInt64() const | 转换为64位有符号整数 | |
toUint64() const | 转换为64位无符号整数 | |
toDouble() const | 转换为双精度浮点数 | |
tpString | toString() const | 转换为字符串对象 |
tpJsonObject | toObject() const | 转换为JSON对象 |
tpJsonArray | toArray() const | 转换为JSON数组 |
tpJsonValue & tpJsonValue::operator= | operator=(const tpJsonValue &others) | 赋值操作符 |
成员函数说明
tpJsonValue::tpJsonValue()
点击查看...
默认构造函数,创建空值(Null)
tpJsonValue::tpJsonValue(bool b)
点击查看...
从布尔值构造JSON值
tpJsonValue::tpJsonValue(uint32_t i)
点击查看...
从无符号32位整数构造JSON值
tpJsonValue::tpJsonValue(int32_t i)
点击查看...
从有符号32位整数构造JSON值
tpJsonValue::tpJsonValue(int64_t i)
点击查看...
从有符号64位整数构造JSON值
tpJsonValue::tpJsonValue(uint64_t i)
点击查看...
从无符号64位整数构造JSON值
tpJsonValue::tpJsonValue(double d)
点击查看...
从双精度浮点数构造JSON值
tpJsonValue::tpJsonValue(const char *str)
点击查看...
从C字符串构造JSON值
tpJsonValue::tpJsonValue(const tpString &str)
点击查看...
从字符串对象构造JSON值
tpJsonValue::tpJsonValue(const tpJsonValue &others)
点击查看...
拷贝构造函数
bool tpJsonValue::isNull() const
点击查看...
检查是否为空值(Null)
bool tpJsonValue::isBool() const
点击查看...
检查是否为布尔值
bool tpJsonValue::isInt() const
点击查看...
检查是否为32位有符号整数
bool tpJsonValue::isUint() const
点击查看...
检查是否为32位无符号整数
bool tpJsonValue::isInt64() const
点击查看...
检查是否为64位有符号整数
bool tpJsonValue::isUint64() const
点击查看...
检查是否为64位无符号整数
bool tpJsonValue::isDouble() const
点击查看...
检查是否为双精度浮点数
bool tpJsonValue::isString() const
点击查看...
检查是否为字符串
bool tpJsonValue::isObject() const
点击查看...
检查是否为对象
bool tpJsonValue::isArray() const
点击查看...
检查是否为数组
bool tpJsonValue::toBool() const
点击查看...
转换为布尔值
返回值:
转换后的布尔值
int32_t tpJsonValue::toInt() const
点击查看...
转换为32位有符号整数
返回值:
转换后的整数
uint32_t tpJsonValue::toUint() const
点击查看...
转换为32位无符号整数
返回值:
转换后的整数
int64_t tpJsonValue::toInt64() const
点击查看...
转换为64位有符号整数
返回值:
转换后的整数
uint64_t tpJsonValue::toUint64() const
点击查看...
转换为64位无符号整数
返回值:
转换后的整数
double tpJsonValue::toDouble() const
点击查看...
转换为双精度浮点数
返回值:
转换后的浮点数
tpString tpJsonValue::toString() const
点击查看...
转换为字符串对象
返回值:
转换后的字符串
tpJsonObject tpJsonValue::toObject() const
点击查看...
转换为JSON对象
返回值:
转换后的JSON对象
tpJsonArray tpJsonValue::toArray() const
点击查看...
转换为JSON数组
返回值:
转换后的JSON数组
tpJsonValue & tpJsonValue::operator=(const tpJsonValue &others)
点击查看...
赋值操作符
返回值:
当前JSON值的引用