[ox/mc] Add def writer
This commit is contained in:
8
deps/ox/src/ox/mc/write.cpp
vendored
8
deps/ox/src/ox/mc/write.cpp
vendored
@@ -6,8 +6,10 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/std/assert.hpp>
|
||||
#include <ox/std/byteswap.hpp>
|
||||
#include <ox/std/memops.hpp>
|
||||
|
||||
#include "write.hpp"
|
||||
|
||||
namespace ox {
|
||||
@@ -17,6 +19,10 @@ MetalClawWriter::MetalClawWriter(uint8_t *buff, std::size_t buffLen): m_fieldPre
|
||||
m_buffLen = buffLen;
|
||||
}
|
||||
|
||||
MetalClawWriter::~MetalClawWriter() noexcept {
|
||||
oxAssert(m_field == m_fields, "MetalClawWriter: incorrect fields number given");
|
||||
}
|
||||
|
||||
int MetalClawWriter::op(const char*, int8_t *val) {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
@@ -54,7 +60,7 @@ int MetalClawWriter::op(const char*, bool *val) {
|
||||
return m_fieldPresence.set(m_field++, *val);
|
||||
}
|
||||
|
||||
void MetalClawWriter::setFields(int fields) {
|
||||
void MetalClawWriter::setTypeInfo(const char*, int fields) {
|
||||
m_fields = fields;
|
||||
m_buffIt = (fields / 8 + 1) - (fields % 8 == 0);
|
||||
m_fieldPresence.setMaxLen(m_buffIt);
|
||||
|
||||
Reference in New Issue
Block a user