[olympic,nostalgia] Rename CRStringView to StringViewCR
This commit is contained in:
@ -17,10 +17,10 @@ namespace keel {
|
||||
ox::Error init(
|
||||
keel::Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::CRStringView appName) noexcept;
|
||||
ox::StringViewCR appName) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::CRStringView appName) noexcept;
|
||||
ox::StringViewCR appName) noexcept;
|
||||
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ oxModelBegin(PreloadPtr)
|
||||
oxModelEnd()
|
||||
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::FileAddress const&file) noexcept;
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::CRStringView file) noexcept;
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR file) noexcept;
|
||||
|
||||
|
||||
void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uuid) noexcept;
|
||||
|
||||
ox::Error buildUuidMap(Context &ctx) noexcept;
|
||||
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::CRStringView path) noexcept;
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept;
|
||||
|
||||
ox::Result<ox::UUID> getUuid(Context &ctx, ox::FileAddress const&fileAddr) noexcept;
|
||||
|
||||
@ -53,7 +53,7 @@ constexpr ox::Result<ox::UUID> uuidUrlToUuid(ox::StringView uuidUrl) noexcept {
|
||||
|
||||
ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringView uuid) noexcept;
|
||||
|
||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept;
|
||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::StringViewCR uuid) noexcept;
|
||||
|
||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexcept;
|
||||
|
||||
@ -114,7 +114,7 @@ ox::Result<keel::AssetRef<T>> readObjFile(
|
||||
template<typename T>
|
||||
ox::Result<keel::AssetRef<T>> readObjNoCache(
|
||||
keel::Context &ctx,
|
||||
ox::CRStringView assetId) noexcept {
|
||||
ox::StringViewCR assetId) noexcept {
|
||||
if constexpr(ox::preloadable<T>::value) {
|
||||
oxRequire(addr, getPreloadAddr(ctx, assetId));
|
||||
return keel::AssetRef<T>(std::bit_cast<T const*>(uintptr_t{addr}));
|
||||
@ -130,7 +130,7 @@ ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) noexcept;
|
||||
template<typename T>
|
||||
ox::Result<keel::AssetRef<T>> readObj(
|
||||
keel::Context &ctx,
|
||||
ox::CRStringView assetId,
|
||||
ox::StringViewCR assetId,
|
||||
[[maybe_unused]] bool forceLoad = false) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
return readObjFile<T>(ctx, assetId, forceLoad);
|
||||
@ -169,9 +169,9 @@ ox::Error writeObj(
|
||||
|
||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept;
|
||||
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::CRStringView path) noexcept;
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept;
|
||||
|
||||
ox::Result<char*> loadRom(ox::CRStringView path = "") noexcept;
|
||||
ox::Result<char*> loadRom(ox::StringViewCR path = "") noexcept;
|
||||
|
||||
void unloadRom(char*) noexcept;
|
||||
|
||||
|
@ -142,7 +142,7 @@ ox::Error preloadDir(
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &romFs,
|
||||
ox::Preloader<PlatSpec> &pl,
|
||||
ox::CRStringView path) noexcept {
|
||||
ox::StringViewCR path) noexcept {
|
||||
// copy
|
||||
oxTracef("pack.preload", "path: {}", path);
|
||||
oxRequire(fileList, romFs.ls(path));
|
||||
|
@ -60,10 +60,10 @@ class BaseConverter {
|
||||
constexpr virtual int srcTypeVersion() const noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr virtual bool srcMatches(ox::CRStringView pSrcTypeName, int pSrcTypeVersion) const noexcept = 0;
|
||||
constexpr virtual bool srcMatches(ox::StringViewCR pSrcTypeName, int pSrcTypeVersion) const noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr virtual bool dstMatches(ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept = 0;
|
||||
constexpr virtual bool dstMatches(ox::StringViewCR dstTypeName, int dstTypeVersion) const noexcept = 0;
|
||||
|
||||
virtual ox::Result<ox::UPtr<Wrap>> convertPtrToPtr(keel::Context &ctx, Wrap &src) const noexcept = 0;
|
||||
|
||||
@ -72,8 +72,8 @@ class BaseConverter {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool matches(
|
||||
ox::CRStringView srcTypeName, int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept {
|
||||
ox::StringViewCR srcTypeName, int srcTypeVersion,
|
||||
ox::StringViewCR dstTypeName, int dstTypeVersion) const noexcept {
|
||||
return srcMatches(srcTypeName, srcTypeVersion)
|
||||
&& dstMatches(dstTypeName, dstTypeVersion);
|
||||
}
|
||||
@ -94,7 +94,7 @@ class Converter: public BaseConverter {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool srcMatches(ox::CRStringView pSrcTypeName, int pSrcTypeVersion) const noexcept final {
|
||||
constexpr bool srcMatches(ox::StringViewCR pSrcTypeName, int pSrcTypeVersion) const noexcept final {
|
||||
constexpr auto SrcTypeName = ox::requireModelTypeName<SrcType>();
|
||||
constexpr auto SrcTypeVersion = ox::requireModelTypeVersion<SrcType>();
|
||||
return pSrcTypeName == SrcTypeName
|
||||
@ -102,7 +102,7 @@ class Converter: public BaseConverter {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool dstMatches(ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept final {
|
||||
constexpr bool dstMatches(ox::StringViewCR dstTypeName, int dstTypeVersion) const noexcept final {
|
||||
constexpr auto DstTypeName = ox::StringView{ox::requireModelTypeName<DstType>()};
|
||||
constexpr auto DstTypeVersion = ox::requireModelTypeVersion<DstType>();
|
||||
return dstTypeName == DstTypeName
|
||||
@ -133,7 +133,7 @@ class Converter: public BaseConverter {
|
||||
ox::Result<ox::UPtr<Wrap>> convert(
|
||||
keel::Context &ctx,
|
||||
ox::BufferView const&srcBuffer,
|
||||
ox::CRStringView dstTypeName,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int dstTypeVersion) noexcept;
|
||||
|
||||
template<typename DstType>
|
||||
|
@ -9,7 +9,7 @@ namespace keel {
|
||||
ox::Error init(
|
||||
keel::Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::CRStringView appName) noexcept {
|
||||
ox::StringViewCR appName) noexcept {
|
||||
ctx.appName = appName;
|
||||
std::ignore = setRomFs(ctx, std::move(fs));
|
||||
#ifndef OX_BARE_METAL
|
||||
@ -28,7 +28,7 @@ ox::Error init(
|
||||
return {};
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::UPtr<ox::FileSystem> &&fs, ox::CRStringView appName) noexcept {
|
||||
ox::Result<ox::UPtr<Context>> init(ox::UPtr<ox::FileSystem> &&fs, ox::StringViewCR appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
oxReturnError(keel::init(*ctx, std::move(fs), appName));
|
||||
return ctx;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace keel {
|
||||
|
||||
ox::Result<char*> loadRom(ox::CRStringView path) noexcept {
|
||||
ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
|
||||
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
|
||||
if (!file.good()) {
|
||||
oxErrorf("Could not find ROM file: {}", path);
|
||||
@ -47,7 +47,7 @@ void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uui
|
||||
ctx.uuidToPath[uuid.toString()] = filePath;
|
||||
}
|
||||
|
||||
static ox::Error buildUuidMap(Context &ctx, ox::CRStringView path) noexcept {
|
||||
static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
oxRequire(files, ctx.rom->ls(path));
|
||||
for (auto const&f : files) {
|
||||
oxRequireM(filePath, ox::join("/", ox::Array<ox::StringView, 2>{path, f}));
|
||||
@ -74,7 +74,7 @@ ox::Error buildUuidMap(Context &ctx) noexcept {
|
||||
return buildUuidMap(ctx, "");
|
||||
}
|
||||
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::CRStringView path) noexcept {
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
oxRequire(out, ctx.pathToUuid.at(path));
|
||||
return *out;
|
||||
@ -136,7 +136,7 @@ ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringView uuid) noe
|
||||
#endif
|
||||
}
|
||||
|
||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept {
|
||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::StringViewCR uuid) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid));
|
||||
return ox::CStringView(*out);
|
||||
@ -186,7 +186,7 @@ ox::Error buildUuidMap(Context&) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
ox::Result<char*> loadRom(ox::CRStringView) noexcept {
|
||||
ox::Result<char*> loadRom(ox::StringViewCR) noexcept {
|
||||
// put the header in the wrong order to prevent mistaking this code for the
|
||||
// media section
|
||||
constexpr auto headerP2 = "R_______________";
|
||||
@ -206,7 +206,7 @@ ox::Result<char*> loadRom(ox::CRStringView) noexcept {
|
||||
void unloadRom(char*) noexcept {
|
||||
}
|
||||
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::CRStringView path) noexcept {
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept {
|
||||
oxRequire(stat, ctx.rom->stat(path));
|
||||
oxRequire(buff, static_cast<ox::MemFS*>(ctx.rom.get())->directAccess(path));
|
||||
PreloadPtr p;
|
||||
@ -238,7 +238,7 @@ ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
||||
return buildUuidMap(ctx);
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::CRStringView path) noexcept {
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept {
|
||||
auto const lastDot = ox::lastIndexOf(path, '.');
|
||||
if (!lastDot.error && substr(path, lastDot.value) == ".oxfs") {
|
||||
oxRequire(rom, loadRom(path));
|
||||
|
@ -107,7 +107,7 @@ static ox::Error doTransformations(
|
||||
keel::Context &ctx,
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &dest,
|
||||
ox::CRStringView filePath) noexcept {
|
||||
ox::StringViewCR filePath) noexcept {
|
||||
// load file
|
||||
oxRequire(s, dest.stat(filePath));
|
||||
// do transformations
|
||||
@ -130,7 +130,7 @@ static ox::Error transformClaw(
|
||||
keel::Context &ctx,
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &dest,
|
||||
ox::CRStringView path) noexcept {
|
||||
ox::StringViewCR path) noexcept {
|
||||
// copy
|
||||
oxTracef("pack.transformClaw", "path: {}", path);
|
||||
oxRequire(fileList, dest.ls(path));
|
||||
@ -155,8 +155,8 @@ static ox::Error copy(
|
||||
Manifest &manifest,
|
||||
ox::FileSystem &src,
|
||||
ox::FileSystem &dest,
|
||||
ox::CRStringView path,
|
||||
ox::CRStringView logPrefix = "") noexcept {
|
||||
ox::StringViewCR path,
|
||||
ox::StringViewCR logPrefix = "") noexcept {
|
||||
oxOutf("{}copying directory: {}\n", logPrefix, path);
|
||||
auto const childLogPrefix = ox::sfmt("{}\t", logPrefix);
|
||||
// copy
|
||||
|
@ -11,9 +11,9 @@ namespace keel {
|
||||
|
||||
static ox::Result<BaseConverter const*> findConverter(
|
||||
ox::SpanView<BaseConverter const*> const&converters,
|
||||
ox::CRStringView srcTypeName,
|
||||
ox::StringViewCR srcTypeName,
|
||||
int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int dstTypeVersion) noexcept {
|
||||
for (auto const&c : converters) {
|
||||
if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
||||
@ -27,9 +27,9 @@ static ox::Result<ox::UPtr<Wrap>> convert(
|
||||
keel::Context &ctx,
|
||||
ox::SpanView<BaseConverter const*> const&converters,
|
||||
ox::BufferView const&srcBuffer,
|
||||
ox::CRStringView srcTypeName,
|
||||
ox::StringViewCR srcTypeName,
|
||||
int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int dstTypeVersion) noexcept {
|
||||
// look for direct converter
|
||||
auto [c, err] = findConverter(
|
||||
@ -55,7 +55,7 @@ static ox::Result<ox::UPtr<Wrap>> convert(
|
||||
ox::Result<ox::UPtr<Wrap>> convert(
|
||||
keel::Context &ctx,
|
||||
ox::BufferView const&srcBuffer,
|
||||
ox::CRStringView dstTypeName,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int dstTypeVersion) noexcept {
|
||||
oxRequire(hdr, readAssetHeader(srcBuffer));
|
||||
return convert(
|
||||
|
Reference in New Issue
Block a user