diff options
| author | YongDo-Hyun <froster12@naver.com> | 2025-11-26 20:10:42 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-03-27 19:57:09 +0300 |
| commit | edbbe8dcfd30fcfe84f6b62240e22dbf9138677c (patch) | |
| tree | 8b9c8edb939d573d76d6390535d3eacf4342e9c4 /README.md | |
| parent | 687e43031df0dc641984b4256bcca50d5b3f7de3 (diff) | |
| download | Project-Tick-edbbe8dcfd30fcfe84f6b62240e22dbf9138677c.tar.gz Project-Tick-edbbe8dcfd30fcfe84f6b62240e22dbf9138677c.zip | |
feat: add local test executable and improve JSON string escaping - Added option to build a local test executable for value assignments. - Enhanced JSON string formatting by escaping special characters. - Updated README with build instructions and prerequisites. - Modified .gitignore to include .vscode directory. - Added file read/write tests in format_test.cpp. - Refactored value assignment logic to reduce code duplication.
Signed-off-by: YongDo-Hyun <froster12@naver.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 67 |
1 files changed, 67 insertions, 0 deletions
@@ -16,3 +16,70 @@ libnbt++2 is a remake of the old libnbt++ library with the goal of making it more easily usable and fixing some problems. The old libnbt++ especially suffered from a very convoluted syntax and boilerplate code needed to work with NBT data. + +## Building + +This project uses CMake for building. Ensure you have CMake installed. + +### Prerequisites +- C++11 compatible compiler +- CMake 3.15 or later +- ZLIB (optional, for compressed NBT support) + +### Build Steps +1. Clone the repository: + ``` + git clone https://github.com/PrismLauncher/libnbtplusplus.git + cd libnbtplusplus + ``` + +2. Create a build directory: + ``` + mkdir build + cd build + ``` + +3. Configure with CMake: + ``` + cmake .. + ``` + Options: + - `NBT_BUILD_SHARED=OFF` (default): Build static library + - `NBT_USE_ZLIB=ON` (default): Enable zlib support + - `NBT_BUILD_TESTS=ON` (default): Build tests + +4. Build: + ``` + cmake --build . + ``` + +5. Install (optional): + ``` + cmake --install . + ``` + +## Usage + +Include the headers and link against the library. + +### Example +```cpp +#include <nbt_tags.h> +#include <fstream> +#include <iostream> + +int main() { + // Read an NBT file + std::ifstream file("example.nbt", std::ios::binary); + nbt::tag_compound root = nbt::io::read_compound(file).first; + + // Access data + std::cout << root["some_key"].as<nbt::tag_string>() << std::endl; + + return 0; +} +``` + +## License + +This project is licensed under the GNU General Public License v3.0. See the [COPYING](COPYING) file for details. |
