[ox/mc] Add Vector handler to Reader and Writer
This commit is contained in:
parent
5c51e17156
commit
c8f39af001
9
deps/ox/src/ox/mc/read.hpp
vendored
9
deps/ox/src/ox/mc/read.hpp
vendored
@ -10,6 +10,7 @@
|
||||
|
||||
#include <ox/std/byteswap.hpp>
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/std/vector.hpp>
|
||||
#include "err.hpp"
|
||||
#include "optype.hpp"
|
||||
#include "presencemask.hpp"
|
||||
@ -49,6 +50,9 @@ class MetalClawReader {
|
||||
template<typename T>
|
||||
int op(const char*, T *val, std::size_t len);
|
||||
|
||||
template<typename T>
|
||||
int op(const char*, ox::Vector<T> *val);
|
||||
|
||||
template<typename T>
|
||||
int op(const char*, T *val);
|
||||
|
||||
@ -160,6 +164,11 @@ int MetalClawReader::op(const char*, T *val, std::size_t valLen) {
|
||||
return err;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
int MetalClawReader::op(const char*, ox::Vector<T> *val) {
|
||||
return op(nullptr, val->data(), val->size());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int readMC(uint8_t *buff, std::size_t buffLen, T *val) {
|
||||
MetalClawReader reader(buff, buffLen);
|
||||
|
9
deps/ox/src/ox/mc/write.hpp
vendored
9
deps/ox/src/ox/mc/write.hpp
vendored
@ -10,6 +10,7 @@
|
||||
|
||||
#include <ox/std/byteswap.hpp>
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/std/vector.hpp>
|
||||
#include <ox/std/types.hpp>
|
||||
#include "err.hpp"
|
||||
#include "optype.hpp"
|
||||
@ -48,6 +49,9 @@ class MetalClawWriter {
|
||||
template<typename T>
|
||||
int op(const char*, T *val, std::size_t len);
|
||||
|
||||
template<typename T>
|
||||
int op(const char*, ox::Vector<T> *val);
|
||||
|
||||
template<std::size_t L>
|
||||
int op(const char*, const char *val);
|
||||
|
||||
@ -111,6 +115,11 @@ int MetalClawWriter::op(const char*, T *val) {
|
||||
return err;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int MetalClawWriter::op(const char*, ox::Vector<T> *val) {
|
||||
return op(nullptr, val->data(), val->size());
|
||||
}
|
||||
|
||||
template<typename I>
|
||||
int MetalClawWriter::appendInteger(I val) {
|
||||
int err = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user