Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.
/ libnbtpp Public archive

A C++17 NBT Library with Compression Support - MIRROR

License

Notifications You must be signed in to change notification settings

rutgerbrf/libnbtpp

Repository files navigation

libnbtpp

A C++17 NBT Library with compression support

NOTE: The 'real' repository can be found at GitLab. Please report issues and merge requests there.

Requirements

  • Boost.Iostreams (required for compression support, there is no option to disable this feature)
  • zlib (also required for compression support)
  • CMake
  • A compiler with C++17 support (this library has only been tested on Clang and GCC on Arch Linux)

Building

Compilation

mkdir build
cd build
cmake ..
make

Installation

Note: you might need superuser privileges to use this command

make install

You might want to specify the destination directory. On Arch systems, it is recommended to install to /usr instead of /usr/local as that will cause in runtime errors for linked binaries.

Testing

To build the testing executable pass the flag -DLIBNBTPP_BUILD_TESTS=ON to the cmake command in the build process. To run the tests, execute ./nbtpptest in the build directory

Example

#include <nbtpp/nbtfile.hpp>

int main(int argc, char * argv[]) {
    NBT::File file("bigtest.nbt");
    auto eggCompound = file.getRoot().at("nested compound test").tagCompound()
                                     .at("egg").tagCompound();
    
    std::cout << eggCompound.at("name").tagString()
              << ": "
              << eggCompound.at("value").tagFloat()
              << std::endl;
              
    return EXIT_SUCCESS;
}

About

A C++17 NBT Library with Compression Support - MIRROR

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published