[ox] Add StringView, Writer system, Preloader system

This commit is contained in:
2022-11-30 01:45:11 -06:00
parent 98f35140fe
commit cbb496c59f
64 changed files with 2343 additions and 417 deletions

View File

@@ -15,10 +15,11 @@ namespace ox {
Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcept {
const auto s1End = ox_strchr(buff, ';', buffLen);
if (!s1End) {
oxAssert(false, "fail");
return OxError(1, "Could not read Claw header");
}
const auto s1Size = s1End - buff;
String fmt(buff, s1Size);
const String fmt(buff, s1Size);
buff += s1Size + 1;
buffLen -= s1Size + 1;
@@ -27,7 +28,7 @@ Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcep
return OxError(2, "Could not read Claw header");
}
const auto s2Size = s2End - buff;
String typeName(buff, s2Size);
const String typeName(buff, s2Size);
buff += s2Size + 1;
buffLen -= s2Size + 1;
@@ -36,7 +37,7 @@ Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcep
return OxError(3, "Could not read Claw header");
}
const auto s3Size = s3End - buff;
String versionStr(buff, s3Size);
const String versionStr(buff, s3Size);
buff += s3Size + 1;
buffLen -= s3Size + 1;
@@ -74,7 +75,7 @@ Result<Buffer> stripClawHeader(const ox::Buffer &buff) noexcept {
Result<ModelObject> readClaw(TypeStore *ts, const Buffer &buff) noexcept {
oxRequire(header, readClawHeader(buff));
oxRequire(t, ts->template getLoad(header.typeName, header.typeVersion));
oxRequire(t, ts->template getLoad(header.typeName, header.typeVersion, header.typeParams));
ModelObject obj;
oxReturnError(obj.setType(t));
switch (header.fmt) {