Compare commits

...

2 Commits

Author SHA1 Message Date
BodgeMaster 664632d111 NBT: add stub write helper functions 2022-07-02 02:08:32 +02:00
BodgeMaster f18874019b fix copyright notice 2022-07-02 01:04:32 +02:00
4 changed files with 63 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Copyright <year>, FOSS-VG Developers and Contributers
// Copyright 2022, FOSS-VG Developers and Contributers
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Affero General Public License as published

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright <year>, FOSS-VG Developers and Contributers
# Copyright 2022, FOSS-VG Developers and Contributers
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published

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);