|
chenjunfu2-nbt-cpp v2.1.0
一个基于CPP20的NBT(Named Binary Tag)库
|
提供NBT类型定义,包括NBT格式中的所有数据类型,以及部分辅助功能,比如静态类型与Tag映射,类型存在查询,类型列表大小,类型最大小值等 更多...
#include <NBT_Type.hpp>
类 | |
| struct | _TypeList |
| 类型列表模板 更多... | |
Public 类型 | |
| using | TypeList |
| 完整的NBT类型列表定义 | |
| template<NBT_TAG Tag> | |
| using | TagToType_T = typename TagToType<Tag>::type |
| 从NBT_TAG获取对应的类型:编译期从NBT_TAG的enum值获取类型 | |
| template<typename T> | |
| using | BuiltinRawType_T = typename BuiltinRawType<T>::Type |
| 映射内建类型到方便读写的raw类型:编译期获得内建类型到可以进行二进制读写的原始类型 | |
原始数据类型定义 | |
| using | Float_Raw = uint32_t |
| Float 类型的原始表示,用于在平台不支持或需要二进制读写时使用 | |
| using | Double_Raw = uint64_t |
| Double 类型的原始表示,用于在平台不支持或需要二进制读写时使用 | |
NBT数据类型定义 | |
| using | End = std::monostate |
| 结束标记类型,无数据 | |
| using | Byte = int8_t |
| 8位有符号整数 | |
| using | Short = int16_t |
| 16位有符号整数 | |
| using | Int = int32_t |
| 32位有符号整数 | |
| using | Long = int64_t |
| 64位有符号整数 | |
| using | Float = std::conditional_t<(sizeof(float) == sizeof(Float_Raw)), float, Float_Raw> |
| 单精度浮点类型 | |
| using | Double = std::conditional_t<(sizeof(double) == sizeof(Double_Raw)), double, Double_Raw> |
| 双精度浮点类型 | |
| using | ByteArray = NBT_Array<std::vector<Byte>> |
| 存储 8位有符号整数的数组类型 | |
| using | IntArray = NBT_Array<std::vector<Int>> |
| 存储32位有符号整数的数组类型 | |
| using | LongArray = NBT_Array<std::vector<Long>> |
| 存储64位有符号整数的数组类型 | |
| using | String = NBT_String<std::basic_string<uint8_t>, std::basic_string_view<uint8_t>> |
| 字符串类型,存储Java M-UTF-8字符串 | |
| using | List = NBT_List<std::vector<NBT_Node>> |
| 列表类型,可顺序存储任意相同的NBT类型 | |
| using | Compound = NBT_Compound<std::unordered_map<String, NBT_Node>> |
| 集合类型,可存储任意不同的NBT类型,通过名称映射值 | |
部分结构的长度类型 | |
| using | ArrayLength = int32_t |
| 数组长度类型 | |
| using | StringLength = uint16_t |
| 字符串长度类型 | |
| using | ListLength = int32_t |
| 列表长度类型 | |
静态 Public 成员函数 | |
| static constexpr const char * | GetTypeName (NBT_TAG tag) noexcept |
| 通过类型标签获取类型名称 | |
类型判断函数(可动态) | |
| static constexpr bool | IsNumericTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应数值类型(包含所有整数和浮点数类型) | |
| static constexpr bool | IsIntegerTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应整数类型(包含所有整数类型) | |
| static constexpr bool | IsFloatingTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应浮点数类型(包含所有浮点数类型) | |
| static constexpr bool | IsArrayTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应数组类型(包含所有数组类型) | |
| static constexpr bool | IsContainerTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应容器类型(包含List、Compound和所有数组类型) | |
| static constexpr bool | IsStringTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应String类型 | |
| static constexpr bool | IsListTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应List类型 | |
| static constexpr bool | IsCompoundTag (NBT_TAG tag) noexcept |
| 判断给定的NBT_TAG是否对应Compound类型 | |
静态 Public 属性 | |
| template<typename T> | |
| static constexpr bool | IsValidType_V = IsValidType<T, TypeList>::value |
| 类型存在检查:用于编译期检查一个给定类型是否为NBT中的类型 | |
| template<typename T> | |
| static constexpr NBT_TAG | TypeTag_V = (NBT_TAG)TypeTagImpl<T, TypeList>::value |
| 类型枚举值查询:用于在编译期,通过类型查询它在NBT_TAG中对应的enum值 | |
| static constexpr size_t | TypeListSize_V = TypeListSize<TypeList>::value |
| 类型列表大小:获取NBT类型的个数 | |
部分结构的长度类型的极值定义 | |
| static constexpr ArrayLength | ArrayLength_Max = INT32_MAX |
| 数组长度类型最大值 | |
| static constexpr ArrayLength | ArrayLength_Min = INT32_MIN |
| 数组长度类型最小值 | |
| static constexpr StringLength | StringLength_Max = UINT16_MAX |
| 字符串长度类型最大值 | |
| static constexpr StringLength | StringLength_Min = 0 |
| 字符串长度类型最小值 | |
| static constexpr ListLength | ListLength_Max = INT32_MAX |
| 列表长度类型最大值 | |
| static constexpr ListLength | ListLength_Min = INT32_MIN |
| 列表长度类型最小值 | |
内置类型的极值定义 | |
| static constexpr Byte | Byte_Max = INT8_MAX |
| 字节类型最大值 | |
| static constexpr Byte | Byte_Min = INT8_MIN |
| 字节类型最小值 | |
| static constexpr Short | Short_Max = INT16_MAX |
| 短整数类型形最大值 | |
| static constexpr Short | Short_Min = INT16_MIN |
| 短整数类型形最小值 | |
| static constexpr Int | Int_Max = INT32_MAX |
| 整数类型最大值 | |
| static constexpr Int | Int_Min = INT32_MIN |
| 整数类型最小值 | |
| static constexpr Long | Long_Max = INT64_MAX |
| 长整数类型最大值 | |
| static constexpr Long | Long_Min = INT64_MIN |
| 长整数类型最小值 | |
类型判断模板 | |
| template<typename T> | |
| static constexpr bool | IsNumericType_V |
| 判断类型是否为NBT数值类型(包含所有整数和浮点数类型) | |
| template<typename T> | |
| static constexpr bool | IsIntegerType_V |
| 判断类型是否为NBT整数类型(包含所有整数类型) | |
| template<typename T> | |
| static constexpr bool | IsFloatingType_V |
| 判断类型是否为NBT浮点数类型(包含所有浮点数类型) | |
| template<typename T> | |
| static constexpr bool | IsArrayType_V |
| 判断类型是否为NBT数组类型(包含所有数组类型) | |
| template<typename T> | |
| static constexpr bool | IsContainerType_V |
| 判断类型是否为NBT容器类型(包含List、Compound和所有数组类型) | |
| template<typename T> | |
| static constexpr bool | IsStringType_V = std::is_same_v<T, String> |
| 判断类型是否为NBT String类型 | |
| template<typename T> | |
| static constexpr bool | IsListType_V = std::is_same_v<T, List> |
| 判断类型是否为NBT List类型 | |
| template<typename T> | |
| static constexpr bool | IsCompoundType_V = std::is_same_v<T, Compound> |
| 判断类型是否为NBT Compound类型 | |
提供NBT类型定义,包括NBT格式中的所有数据类型,以及部分辅助功能,比如静态类型与Tag映射,类型存在查询,类型列表大小,类型最大小值等
| using NBT_Type::BuiltinRawType_T = typename BuiltinRawType<T>::Type |
映射内建类型到方便读写的raw类型:编译期获得内建类型到可以进行二进制读写的原始类型
| T | 需要映射的类型 |
| using NBT_Type::Double = std::conditional_t<(sizeof(double) == sizeof(Double_Raw)), double, Double_Raw> |
双精度浮点类型
| using NBT_Type::Float = std::conditional_t<(sizeof(float) == sizeof(Float_Raw)), float, Float_Raw> |
单精度浮点类型
| using NBT_Type::TagToType_T = typename TagToType<Tag>::type |
从NBT_TAG获取对应的类型:编译期从NBT_TAG的enum值获取类型
| Tag | 用于查询类型的NBT_TAG中的enum值 |
| using NBT_Type::TypeList |
完整的NBT类型列表定义
|
inlinestaticconstexprnoexcept |
通过类型标签获取类型名称
| tag | NBT_TAG枚举的类型标签 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应数组类型(包含所有数组类型)
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应Compound类型
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应容器类型(包含List、Compound和所有数组类型)
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应浮点数类型(包含所有浮点数类型)
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应整数类型(包含所有整数类型)
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应List类型
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应数值类型(包含所有整数和浮点数类型)
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexprnoexcept |
判断给定的NBT_TAG是否对应String类型
| tag | 需要判断的NBT_TAG枚举值 |
|
inlinestaticconstexpr |
数组长度类型最小值
|
staticconstexpr |
判断类型是否为NBT数组类型(包含所有数组类型)
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT Compound类型
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT容器类型(包含List、Compound和所有数组类型)
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT浮点数类型(包含所有浮点数类型)
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT整数类型(包含所有整数类型)
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT List类型
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT数值类型(包含所有整数和浮点数类型)
| T | 需要检查的类型 |
|
staticconstexpr |
判断类型是否为NBT String类型
| T | 需要检查的类型 |
|
staticconstexpr |
类型存在检查:用于编译期检查一个给定类型是否为NBT中的类型
| T | 需要检查的类型 |
|
inlinestaticconstexpr |
列表长度类型最小值
|
inlinestaticconstexpr |
字符串长度类型最小值
|
staticconstexpr |
类型列表大小:获取NBT类型的个数
|
staticconstexpr |
类型枚举值查询:用于在编译期,通过类型查询它在NBT_TAG中对应的enum值
| T | 需要检查的类型 |