[ox/model] Replace BString<100> with String as ModelString
This commit is contained in:
parent
7302284095
commit
98cb3e1670
11
deps/ox/src/ox/model/desctypes.hpp
vendored
11
deps/ox/src/ox/model/desctypes.hpp
vendored
@ -11,16 +11,15 @@
|
|||||||
#include <ox/std/bit.hpp>
|
#include <ox/std/bit.hpp>
|
||||||
#include <ox/std/error.hpp>
|
#include <ox/std/error.hpp>
|
||||||
#include <ox/std/hashmap.hpp>
|
#include <ox/std/hashmap.hpp>
|
||||||
#include <ox/std/bstring.hpp>
|
#include <ox/std/string.hpp>
|
||||||
#include <ox/std/vector.hpp>
|
#include <ox/std/vector.hpp>
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
using ModelString = BString<100>;
|
using FieldName = String;
|
||||||
using FieldName = ModelString;
|
using TypeName = String;
|
||||||
using TypeName = ModelString;
|
|
||||||
|
|
||||||
enum class PrimitiveType: uint8_t {
|
enum class PrimitiveType: uint8_t {
|
||||||
UnsignedInteger = 0,
|
UnsignedInteger = 0,
|
||||||
@ -144,7 +143,7 @@ Error modelWrite(T *io, DescriptorField *field) {
|
|||||||
oxReturnError(io->field("typeName", SerStr(&empty)));
|
oxReturnError(io->field("typeName", SerStr(&empty)));
|
||||||
oxReturnError(io->field("type", field->type));
|
oxReturnError(io->field("type", field->type));
|
||||||
} else {
|
} else {
|
||||||
oxReturnError(io->field("typeName", SerStr(&field->type->typeName)));
|
oxReturnError(io->field("typeName", &field->type->typeName));
|
||||||
oxReturnError(io->field("type", static_cast<decltype(field->type)>(nullptr)));
|
oxReturnError(io->field("type", static_cast<decltype(field->type)>(nullptr)));
|
||||||
}
|
}
|
||||||
oxReturnError(io->field("fieldName", &field->fieldName));
|
oxReturnError(io->field("fieldName", &field->fieldName));
|
||||||
@ -179,6 +178,6 @@ Error modelRead(T *io, DescriptorField *field) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
using TypeStore = HashMap<ModelString, DescriptorType*>;
|
using TypeStore = HashMap<String, DescriptorType*>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
deps/ox/src/ox/model/walk.hpp
vendored
4
deps/ox/src/ox/model/walk.hpp
vendored
@ -94,10 +94,10 @@ static Error parseField(const DescriptorField &field, Reader *rdr, DataWalker<Re
|
|||||||
child.setTypeInfo(field.fieldName.c_str(), arrayLen);
|
child.setTypeInfo(field.fieldName.c_str(), arrayLen);
|
||||||
DescriptorField f(field); // create mutable copy
|
DescriptorField f(field); // create mutable copy
|
||||||
--f.subscriptLevels;
|
--f.subscriptLevels;
|
||||||
BString<100> subscript;
|
String subscript;
|
||||||
for (std::size_t i = 0; i < arrayLen; i++) {
|
for (std::size_t i = 0; i < arrayLen; i++) {
|
||||||
subscript = "[";
|
subscript = "[";
|
||||||
subscript += i;
|
subscript += static_cast<uint64_t>(i);
|
||||||
subscript += "]";
|
subscript += "]";
|
||||||
walker->pushNamePath(subscript);
|
walker->pushNamePath(subscript);
|
||||||
oxReturnError(parseField(f, &child, walker));
|
oxReturnError(parseField(f, &child, walker));
|
||||||
|
Loading…
Reference in New Issue
Block a user