[ox/model] Replace BString<100> with String as ModelString

This commit is contained in:
Gary Talent 2021-05-11 22:10:05 -05:00
parent 7302284095
commit 98cb3e1670
2 changed files with 7 additions and 8 deletions

View File

@ -11,16 +11,15 @@
#include <ox/std/bit.hpp>
#include <ox/std/error.hpp>
#include <ox/std/hashmap.hpp>
#include <ox/std/bstring.hpp>
#include <ox/std/string.hpp>
#include <ox/std/vector.hpp>
#include "types.hpp"
namespace ox {
using ModelString = BString<100>;
using FieldName = ModelString;
using TypeName = ModelString;
using FieldName = String;
using TypeName = String;
enum class PrimitiveType: uint8_t {
UnsignedInteger = 0,
@ -144,7 +143,7 @@ Error modelWrite(T *io, DescriptorField *field) {
oxReturnError(io->field("typeName", SerStr(&empty)));
oxReturnError(io->field("type", field->type));
} 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("fieldName", &field->fieldName));
@ -179,6 +178,6 @@ Error modelRead(T *io, DescriptorField *field) {
return err;
}
using TypeStore = HashMap<ModelString, DescriptorType*>;
using TypeStore = HashMap<String, DescriptorType*>;
}

View File

@ -94,10 +94,10 @@ static Error parseField(const DescriptorField &field, Reader *rdr, DataWalker<Re
child.setTypeInfo(field.fieldName.c_str(), arrayLen);
DescriptorField f(field); // create mutable copy
--f.subscriptLevels;
BString<100> subscript;
String subscript;
for (std::size_t i = 0; i < arrayLen; i++) {
subscript = "[";
subscript += i;
subscript += static_cast<uint64_t>(i);
subscript += "]";
walker->pushNamePath(subscript);
oxReturnError(parseField(f, &child, walker));