expose helpers in the header, rename NBT::helpers to NBT::helper

BodgeMaster-unfinished
BodgeMaster 2022-06-28 15:19:47 +02:00
parent ab920a114b
commit 081035db32
2 changed files with 27 additions and 1 deletions

View File

@ -42,7 +42,7 @@ int endianness_example() {
}
namespace NBT {
namespace helpers {
namespace helper {
ErrorOr<int8_t> readInt8(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition) {
//TODO: implement
return ErrorOr<int8_t>(0);

View File

@ -40,5 +40,31 @@
#include "error.h++"
namespace NBT {
namespace helper {
ErrorOr<int8_t> readInt8(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<int16_t> readInt16(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<int32_t> readInt32(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<int64_t> readInt64(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
//FIXME: we just assume that float is a single-precision IEEE754
// floating point number
ErrorOr<float> readFloat32(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
//FIXME: we just assume that double is a double-precision IEEE754
// floating point number
ErrorOr<double> readFloat64(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<std::vector<int8_t>> readInt8Array(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
//ErrorOr<> readString(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<std::vector<int32_t>> readInt32Array(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
ErrorOr<std::vector<int64_t>> readInt64Array(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition);
}
bool validateRawNBTData(uint8_t* data[], int length);
}