[ox] Cleanup
This commit is contained in:
parent
a7cf267385
commit
6ad79b305c
4
deps/ox/src/ox/mc/test/tests.cpp
vendored
4
deps/ox/src/ox/mc/test/tests.cpp
vendored
@ -316,7 +316,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
testIn.Union.Int = 93;
|
||||
oxAssert(ox::writeMC(dataBuff.data(), dataBuff.size(), testIn), "Data generation failed");
|
||||
ox::TypeStore typeStore;
|
||||
const auto [type, typeErr] = ox::buildTypeDef(&typeStore, &testIn);
|
||||
const auto [type, typeErr] = ox::buildTypeDef(typeStore, testIn);
|
||||
oxAssert(typeErr, "Descriptor write failed");
|
||||
ox::ModelObject testOut;
|
||||
oxReturnError(testOut.setType(type));
|
||||
@ -368,7 +368,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
testIn.Struct.IString = "Test String 2";
|
||||
oxAssert(ox::writeMC(dataBuff, dataBuffLen, testIn), "Data generation failed");
|
||||
ox::TypeStore typeStore;
|
||||
const auto [type, typeErr] = ox::buildTypeDef(&typeStore, &testIn);
|
||||
const auto [type, typeErr] = ox::buildTypeDef(typeStore, testIn);
|
||||
oxAssert(typeErr, "Descriptor write failed");
|
||||
ox::BufferReader br({dataBuff, dataBuffLen});
|
||||
oxReturnError(ox::walkModel<ox::MetalClawReader>(type, br,
|
||||
|
10
deps/ox/src/ox/model/descwrite.hpp
vendored
10
deps/ox/src/ox/model/descwrite.hpp
vendored
@ -357,8 +357,8 @@ constexpr const DescriptorType *TypeDescWriter::getType(StringViewCR tn, int typ
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr Result<DescriptorType*> buildTypeDef(TypeStore *typeStore) noexcept {
|
||||
TypeDescWriter writer(typeStore);
|
||||
constexpr Result<DescriptorType*> buildTypeDef(TypeStore &typeStore) noexcept {
|
||||
TypeDescWriter writer(&typeStore);
|
||||
ModelHandlerInterface<TypeDescWriter, ox::OpType::Reflect> handler(&writer);
|
||||
if (std::is_constant_evaluated()) {
|
||||
std::allocator<T> a;
|
||||
@ -373,10 +373,10 @@ constexpr Result<DescriptorType*> buildTypeDef(TypeStore *typeStore) noexcept {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr Result<DescriptorType*> buildTypeDef(TypeStore *typeStore, T *val) noexcept {
|
||||
TypeDescWriter writer(typeStore);
|
||||
constexpr Result<DescriptorType*> buildTypeDef(TypeStore &typeStore, T &val) noexcept {
|
||||
TypeDescWriter writer(&typeStore);
|
||||
ModelHandlerInterface<TypeDescWriter, ox::OpType::Reflect> handler(&writer);
|
||||
oxReturnError(model(&handler, val));
|
||||
oxReturnError(model(&handler, &val));
|
||||
return writer.definition();
|
||||
}
|
||||
|
||||
|
4
deps/ox/src/ox/oc/test/tests.cpp
vendored
4
deps/ox/src/ox/oc/test/tests.cpp
vendored
@ -207,7 +207,7 @@ const std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
testIn.Union.Int = 93;
|
||||
oxAssert(ox::writeOC(testIn).moveTo(dataBuff), "Data generation failed");
|
||||
ox::TypeStore typeStore;
|
||||
auto type = ox::buildTypeDef(&typeStore, &testIn);
|
||||
auto type = ox::buildTypeDef(typeStore, testIn);
|
||||
oxAssert(type.error, "Descriptor write failed");
|
||||
ox::ModelObject testOut;
|
||||
oxReturnError(testOut.setType(type.value));
|
||||
@ -257,7 +257,7 @@ const std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
auto [oc, ocErr] = ox::writeOC(testIn);
|
||||
oxAssert(ocErr, "Data generation failed");
|
||||
ox::TypeStore typeStore;
|
||||
auto type = ox::buildTypeDef(&typeStore, &testIn);
|
||||
auto type = ox::buildTypeDef(typeStore, testIn);
|
||||
oxAssert(type.error, "Descriptor write failed");
|
||||
oxReturnError(ox::walkModel<ox::OrganicClawReader>(type.value, oc.data(), oc.size(),
|
||||
[](const ox::Vector<ox::FieldName>&, const ox::Vector<ox::String>&, const ox::DescriptorField &f,
|
||||
|
Loading…
x
Reference in New Issue
Block a user