[ox] Add Reader_c and make MetalClawReader use it
This commit is contained in:
12
deps/ox/src/ox/claw/CMakeLists.txt
vendored
12
deps/ox/src/ox/claw/CMakeLists.txt
vendored
@@ -5,7 +5,6 @@ add_library(
|
||||
write.cpp
|
||||
)
|
||||
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(OxClaw PRIVATE -Wsign-conversion)
|
||||
target_compile_options(OxClaw PRIVATE -Wconversion)
|
||||
@@ -17,6 +16,17 @@ target_link_libraries(
|
||||
$<$<BOOL:${OX_USE_STDLIB}>:OxOrganicClaw>
|
||||
)
|
||||
|
||||
if(OX_USE_STDLIB)
|
||||
add_executable(
|
||||
readclaw
|
||||
readclaw.cpp
|
||||
)
|
||||
target_link_libraries(
|
||||
readclaw PUBLIC
|
||||
OxClaw
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS OxClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
|
3
deps/ox/src/ox/claw/read.cpp
vendored
3
deps/ox/src/ox/claw/read.cpp
vendored
@@ -80,7 +80,8 @@ Result<ModelObject> readClaw(TypeStore *ts, const char *buff, std::size_t buffSz
|
||||
switch (header.fmt) {
|
||||
case ClawFormat::Metal:
|
||||
{
|
||||
MetalClawReader reader(reinterpret_cast<const uint8_t*>(header.data), header.dataSize);
|
||||
ox::BufferReader br(header.data, header.dataSize);
|
||||
MetalClawReader reader(br);
|
||||
ModelHandlerInterface handler(&reader);
|
||||
oxReturnError(model(&handler, &obj));
|
||||
return obj;
|
||||
|
3
deps/ox/src/ox/claw/read.hpp
vendored
3
deps/ox/src/ox/claw/read.hpp
vendored
@@ -51,7 +51,8 @@ Error readClaw(const char *buff, std::size_t buffLen, T *val) {
|
||||
switch (header.fmt) {
|
||||
case ClawFormat::Metal:
|
||||
{
|
||||
MetalClawReader reader(reinterpret_cast<const uint8_t*>(header.data), header.dataSize);
|
||||
ox::BufferReader br(header.data, header.dataSize);
|
||||
MetalClawReader reader(br);
|
||||
ModelHandlerInterface handler(&reader);
|
||||
return model(&handler, val);
|
||||
}
|
||||
|
Reference in New Issue
Block a user