NBT: add stub write helper functions

BodgeMaster-unfinished
BodgeMaster 2022-07-02 02:08:32 +02:00
parent f18874019b
commit 664632d111
2 changed files with 61 additions and 0 deletions

View File

@ -180,6 +180,49 @@ namespace NBT {
}
return ErrorOr<std::vector<int64_t>>(result);
}
void writeInt8(std::vector<uint8_t>* destination, int8_t data) {
}
void writeInt16(std::vector<uint8_t>* destination, int16_t data) {
}
void writeInt32(std::vector<uint8_t>* destination, int32_t data) {
}
void writeInt64(std::vector<uint8_t>* destination, int64_t data) {
}
//FIXME: we just assume that float is a single-precision IEEE754
// floating point number
void writeFloat32(std::vector<uint8_t>* destination, float data) {
}
//FIXME: we just assume that double is a single-precision IEEE754
// floating point number
void writeFloat64(std::vector<uint8_t>* destination, double data) {
}
void writeInt8Array(std::vector<uint8_t>* destination, std::vector<int8_t> data) {
}
void writeInt8Array(std::vector<uint8_t>* destination, int8_t data[], uint64_t dataSize) {
}
//void writeString(std::vector<uint8_t>* destination, <string type> data) {
//}
void writeInt32Array(std::vector<uint8_t>* destination, std::vector<int32_t> data) {
}
void writeInt32Array(std::vector<uint8_t>* destination, int32_t data[], uint64_t dataSize) {
}
void writeInt64Array(std::vector<uint8_t>* destination, std::vector<int64_t> data) {
}
void writeInt64Array(std::vector<uint8_t>* destination, int64_t data[], uint64_t dataSize) {
}
}
bool validateRawNBTData(uint8_t data[], uint64_t dataSize){

View File

@ -55,6 +55,24 @@ namespace NBT {
//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);
void writeInt8(std::vector<uint8_t>* destination, int8_t data);
void writeInt16(std::vector<uint8_t>* destination, int16_t data);
void writeInt32(std::vector<uint8_t>* destination, int32_t data);
void writeInt64(std::vector<uint8_t>* destination, int64_t data);
//FIXME: we just assume that float is a single-precision IEEE754
// floating point number
void writeFloat32(std::vector<uint8_t>* destination, float data);
//FIXME: we just assume that double is a single-precision IEEE754
// floating point number
void writeFloat64(std::vector<uint8_t>* destination, double data);
void writeInt8Array(std::vector<uint8_t>* destination, std::vector<int8_t> data);
void writeInt8Array(std::vector<uint8_t>* destination, int8_t data[], uint64_t dataSize);
//void writeString(std::vector<uint8_t>* destination, <string type> data);
void writeInt32Array(std::vector<uint8_t>* destination, std::vector<int32_t> data);
void writeInt32Array(std::vector<uint8_t>* destination, int32_t data[], uint64_t dataSize);
void writeInt64Array(std::vector<uint8_t>* destination, std::vector<int64_t> data);
void writeInt64Array(std::vector<uint8_t>* destination, int64_t data[], uint64_t dataSize);
}
bool validateRawNBTData(uint8_t data[], int length);