[ox] Make OC and Claw writers take const values
This commit is contained in:
2
deps/ox/src/ox/claw/test/tests.cpp
vendored
2
deps/ox/src/ox/claw/test/tests.cpp
vendored
@@ -158,7 +158,7 @@ static std::map<std::string_view, ox::Error(*)()> tests = {
|
||||
testIn.Struct.Bool = false;
|
||||
testIn.Struct.Int = 300;
|
||||
testIn.Struct.String = "Test String 2";
|
||||
const auto [buff, err] = ox::writeMC(&testIn);
|
||||
const auto [buff, err] = ox::writeMC(testIn);
|
||||
oxAssert(err, "writeClaw failed");
|
||||
oxAssert(ox::readMC(buff.data(), buff.size(), &testOut), "readClaw failed");
|
||||
//std::cout << testIn.Union.Int << "|" << testOut.Union.Int << "|\n";
|
||||
|
4
deps/ox/src/ox/claw/write.hpp
vendored
4
deps/ox/src/ox/claw/write.hpp
vendored
@@ -72,7 +72,7 @@ constexpr int getTypeVersion(const T *t) noexcept {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Error writeClawHeader(Writer_c auto &writer, T *t, ClawFormat fmt) noexcept {
|
||||
ox::Error writeClawHeader(Writer_c auto &writer, const T *t, ClawFormat fmt) noexcept {
|
||||
switch (fmt) {
|
||||
case ClawFormat::Metal:
|
||||
oxReturnError(write(&writer, "M2;"));
|
||||
@@ -96,7 +96,7 @@ ox::Error writeClawHeader(Writer_c auto &writer, T *t, ClawFormat fmt) noexcept
|
||||
}
|
||||
|
||||
Result<Buffer> writeClaw(
|
||||
auto &t,
|
||||
const auto &t,
|
||||
ClawFormat fmt = ClawFormat::Metal,
|
||||
std::size_t buffReserveSz = 2 * units::KB) noexcept {
|
||||
Buffer out(buffReserveSz);
|
||||
|
Reference in New Issue
Block a user