2023-01-27 10:45:18 -05:00
|
|
|
/*
|
|
|
|
* Created by Brett on 27/01/23.
|
|
|
|
* Licensed under GNU General Public License V3.0
|
|
|
|
* See LICENSE file for license detail
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BLT_TESTS_NBT_H
|
|
|
|
#define BLT_TESTS_NBT_H
|
|
|
|
|
2023-01-29 15:24:33 -05:00
|
|
|
#include "blt/std/format.h"
|
2023-01-29 22:27:48 -05:00
|
|
|
#include "blt/std/filesystem.h"
|
2023-01-29 15:24:33 -05:00
|
|
|
|
|
|
|
namespace blt::nbt {
|
|
|
|
void writeUTF8String(std::fstream& stream, const std::string& str);
|
|
|
|
|
|
|
|
std::string readUTF8String(std::fstream& stream);
|
|
|
|
|
|
|
|
class NBTDecoder {
|
|
|
|
private:
|
2023-01-29 22:27:48 -05:00
|
|
|
blt::fs::block_reader* m_reader;
|
2023-01-29 15:24:33 -05:00
|
|
|
public:
|
2023-01-29 22:27:48 -05:00
|
|
|
explicit NBTDecoder(blt::fs::block_reader* reader): m_reader(reader) {}
|
2023-01-29 15:24:33 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the entire NBT file when the read() function is called.
|
|
|
|
*/
|
|
|
|
class NBTReader {
|
|
|
|
private:
|
|
|
|
std::string m_file;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit NBTReader(std::string file): m_file(std::move(file)) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2023-01-27 10:45:18 -05:00
|
|
|
|
|
|
|
#endif //BLT_TESTS_NBT_H
|