diff --git a/deps/oxlib/src/claw/include/ox/claw/write.hpp b/deps/oxlib/src/claw/include/ox/claw/write.hpp index 8a62a1d0..3d7e6bba 100644 --- a/deps/oxlib/src/claw/include/ox/claw/write.hpp +++ b/deps/oxlib/src/claw/include/ox/claw/write.hpp @@ -120,4 +120,25 @@ Result writeClaw( return out; } +Error writeClaw( + auto const &obj, + Writer_c auto &writer, + ClawFormat const fmt = ClawFormat::Metal) noexcept { + OX_RETURN_ERROR(detail::writeClawHeader(writer, &obj, fmt)); +#ifdef OX_USE_STDLIB + if (fmt == ClawFormat::Metal) { + OX_RETURN_ERROR(writeMC(writer, obj)); + } else if (fmt == ClawFormat::Organic) { + OX_REQUIRE(data, writeOC(obj)); + OX_RETURN_ERROR(writer.write(data.data(), data.size())); + } +#else + if (fmt != ClawFormat::Metal) { + return ox::Error(1, "OC is not supported in this build"); + } + OX_RETURN_ERROR(writeMC(writer, obj)); +#endif + return {}; +} + }