Namespace endstone::nbt¶
Namespace List > endstone > nbt
Namespaces¶
| Type | Name |
|---|---|
| namespace | detail |
Classes¶
| Type | Name |
|---|---|
| class | ArrayTag <typename T> An NBT tag holding a contiguous array of fixed-width values (e.g. |
| class | Tag A single NBT tag that may hold any of the supported payload types. |
| struct | TagBase Common base for all NBT tag types. |
| class | ValueTag <typename T> An NBT tag wrapping a single scalar payload of type T (e.g. |
Public Types¶
| Type | Name |
|---|---|
| enum std::uint8_t | Type Identifies the kind of payload an NBT tag holds. |
Public Functions¶
| Type | Name |
|---|---|
| std::string | dump (const Tag & tag, std::endian byte_order=std::endian::little, bool network=false) Serialize an NBT tag to binary format with an empty name. |
| std::string | dump (const Tag & tag, const std::string & name, std::endian byte_order=std::endian::little, bool network=false) Serialize an NBT tag to binary format with a name. |
| Tag | load (std::string_view data, std::string & name, std::endian byte_order=std::endian::little, bool network=false) Deserialize binary NBT data into a Tag , populating the root tag name. |
| Tag | load (std::string_view data, std::endian byte_order=std::endian::little, bool network=false) Deserialize binary NBT data into a Tag , discarding the root tag name. |
Public Types Documentation¶
enum Type¶
Identifies the kind of payload an NBT tag holds.
enum endstone::nbt::Type {
End = 0,
Byte = 1,
Short = 2,
Int = 3,
Long = 4,
Float = 5,
Double = 6,
ByteArray = 7,
String = 8,
List = 9,
Compound = 10,
IntArray = 11
};
The numeric values match the tag ids used in the binary NBT format.
Public Functions Documentation¶
function dump¶
Serialize an NBT tag to binary format with an empty name.
inline std::string endstone::nbt::dump (
const Tag & tag,
std::endian byte_order=std::endian::little,
bool network=false
)
Parameters:
tagThe tag to serialize.byte_orderByte order: std::endian::little (Bedrock) or std::endian::big (Java).networkIftrue, use Bedrock network varint encoding for lengths and Int/Long values.
Returns:
Binary NBT data as [type:1][name:""][payload].
function dump¶
Serialize an NBT tag to binary format with a name.
inline std::string endstone::nbt::dump (
const Tag & tag,
const std::string & name,
std::endian byte_order=std::endian::little,
bool network=false
)
Parameters:
tagThe tag to serialize.nameThe root tag name (e.g. "" for Bedrocklevel.dat, or a descriptive name).byte_orderByte order: std::endian::little (Bedrock) or std::endian::big (Java).networkIftrue, use Bedrock network varint encoding for lengths and Int/Long values.
Returns:
Binary NBT data as [type:1][name:string][payload].
function load¶
Deserialize binary NBT data into a Tag , populating the root tag name.
inline Tag endstone::nbt::load (
std::string_view data,
std::string & name,
std::endian byte_order=std::endian::little,
bool network=false
)
Parameters:
dataBinary NBT data. Consumed from front via string_view.nameThe deserialized root tag name.byte_orderByte order used in the binary data.networkIftrue, expect Bedrock network varint encoding.
Returns:
The deserialized tag.
Exception:
std::runtime_errorIf the data is truncated or malformed.
function load¶
Deserialize binary NBT data into a Tag , discarding the root tag name.
inline Tag endstone::nbt::load (
std::string_view data,
std::endian byte_order=std::endian::little,
bool network=false
)
Parameters:
dataBinary NBT data.byte_orderByte order used in the binary data.networkIftrue, expect Bedrock network varint encoding.
Returns:
The deserialized tag.
Exception:
std::runtime_errorIf the data is truncated or malformed.
The documentation for this class was generated from the following file include/endstone/nbt/array.h