Sun
cloud cloud cloud cloud cloudcloud cloud cloud cloud cloudcloud cloud cloud cloud cloudcloud cloud cloud cloud cloud

Zandgall.com

NBT!

The underutilized format, brought to C++

What is NBT?

NBT is an efficient file type used to store ambiguous data

What is the Library?

This library is a header-only C++ file that allows you to read, write, and interact with NBT data structures.

How do I implement it?

Go to https://github.com/zandgall/NBT and download "nbt.hpp"

When you include it in your project, first #define NBT_INCLUDE to allow access to all the features

How do I use it?

Everything in this library is under a namespace called "nbt". Each tag is defined as a class, nbt::tag (ambiguous), nbt::compound, nbt::bytetag, etc.

Each tag has a load, write, value_bytes(), and discard function. Load will take in a pointer to memory and an offset, and read it's data from it. If the class of the tag and the id given in the data don't match, throwr an "invalid_tag_id_exception". Write takes either a vector of bytes, or a pointer to memory with an offset. Value Bytes will return the payload of the tag, and discard will free any memroy held by the tag.

Each class will publically store their value. For example, nbt::bytetag has a public attribute int8_t "data". There are two general tags, Primitive tag, and Primitive Array tag. Byte, Short, Int, Long, Float, and Double tags are derived from primitive tag. Whereas Byte, Int, and Long array tags are derived from primitive arrays. You can create your own primitive and primitive array tags, however at this point in time, you cannot read custom tags from NBT file data.

Once you read your NBT file data, you can pass it into the load function of a compound tag, this will read all the data of the file into a coumpound tag.

Example code to show the basic usage of NBT c++ and GZNBT.

NBT Example Code

WIP MORE INFORMATION COMING SOON