diff --git a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp index b6bb81c7..e15a97d3 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp @@ -200,7 +200,7 @@ uint_t spriteCount(Context &ctx) noexcept; ox::Error initConsole(Context &ctx) noexcept; -void puts(Context &ctx, int column, int row, ox::CRStringView str) noexcept; +void puts(Context &ctx, int column, int row, ox::StringViewCR str) noexcept; } diff --git a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp b/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp index 9e4b09a3..dfbe0303 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp @@ -306,9 +306,9 @@ uint8_t getPixel8Bpp( ox::Point const&pt, TileSheet::SubSheetIdx const&subsheetIdx) noexcept; -ox::Result getIdFor(TileSheet const&ts, ox::CRStringView path) noexcept; +ox::Result getIdFor(TileSheet const&ts, ox::StringViewCR path) noexcept; -ox::Result getTileOffset(TileSheet const&ts, ox::CRStringView pNamePath) noexcept; +ox::Result getTileOffset(TileSheet const&ts, ox::StringViewCR pNamePath) noexcept; ox::Result getNameFor(TileSheet::SubSheet const&ss, SubSheetId pId) noexcept; diff --git a/src/nostalgia/modules/core/src/gfx.cpp b/src/nostalgia/modules/core/src/gfx.cpp index 3c941f8b..85f64009 100644 --- a/src/nostalgia/modules/core/src/gfx.cpp +++ b/src/nostalgia/modules/core/src/gfx.cpp @@ -168,7 +168,7 @@ void puts( Context &ctx, int const column, int const row, - ox::CRStringView str) noexcept { + ox::StringViewCR str) noexcept { auto const col = static_cast(column); for (auto i = 0u; i < str.bytes(); ++i) { setBgTile( diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp index 2138c850..6166ce8d 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp @@ -9,7 +9,7 @@ namespace nostalgia::core { core::PaletteChangeCommand::PaletteChangeCommand( TileSheet::SubSheetIdx idx, TileSheet &img, - ox::CRStringView newPalette) noexcept: + ox::StringViewCR newPalette) noexcept: m_img(img), m_idx(std::move(idx)), m_oldPalette(m_img.defaultPalette), diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp index 8561099e..c4540b74 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp @@ -19,7 +19,7 @@ class PaletteChangeCommand: public TileSheetCommand { PaletteChangeCommand( TileSheet::SubSheetIdx idx, TileSheet &img, - ox::CRStringView newPalette) noexcept; + ox::StringViewCR newPalette) noexcept; ox::Error redo() noexcept final; diff --git a/src/nostalgia/modules/core/src/tilesheet.cpp b/src/nostalgia/modules/core/src/tilesheet.cpp index ad58bcd2..99428aa8 100644 --- a/src/nostalgia/modules/core/src/tilesheet.cpp +++ b/src/nostalgia/modules/core/src/tilesheet.cpp @@ -348,7 +348,7 @@ static ox::Result getIdFor( return OxError(1, "SubSheet not found"); } -ox::Result getIdFor(TileSheet const&ts, ox::CRStringView path) noexcept { +ox::Result getIdFor(TileSheet const&ts, ox::StringViewCR path) noexcept { return getIdFor(ts.subsheet, ox::split<8>(path, '.')); } @@ -379,7 +379,7 @@ static ox::Result getTileOffset( return OxError(1, "SubSheet not found"); } -ox::Result getTileOffset(TileSheet const&ts, ox::CRStringView pNamePath) noexcept { +ox::Result getTileOffset(TileSheet const&ts, ox::StringViewCR pNamePath) noexcept { return core::getTileOffset(ts.subsheet, ox::split<8>(pNamePath, '.'), ts.bpp); } diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor.cpp b/src/nostalgia/modules/scene/src/studio/sceneeditor.cpp index 6b15bb92..50788ab1 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor.cpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor.cpp @@ -8,7 +8,7 @@ namespace nostalgia::scene { -SceneEditor::SceneEditor(turbine::Context &ctx, ox::CRStringView path): +SceneEditor::SceneEditor(turbine::Context &ctx, ox::StringViewCR path): m_ctx(ctx), m_scene(*keel::readObj(keelCtx(m_ctx), path).unwrapThrow()) { } diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor.hpp b/src/nostalgia/modules/scene/src/studio/sceneeditor.hpp index 38438936..6891d230 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor.hpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor.hpp @@ -19,7 +19,7 @@ class SceneEditor { SceneStatic m_scene; public: - SceneEditor(turbine::Context &ctx, ox::CRStringView path); + SceneEditor(turbine::Context &ctx, ox::StringViewCR path); [[nodiscard]] SceneStatic const&scene() const noexcept { diff --git a/src/olympic/keel/include/keel/keel.hpp b/src/olympic/keel/include/keel/keel.hpp index ec0b5581..203bb157 100644 --- a/src/olympic/keel/include/keel/keel.hpp +++ b/src/olympic/keel/include/keel/keel.hpp @@ -17,10 +17,10 @@ namespace keel { ox::Error init( keel::Context &ctx, ox::UPtr &&fs, - ox::CRStringView appName) noexcept; + ox::StringViewCR appName) noexcept; ox::Result> init( ox::UPtr &&fs, - ox::CRStringView appName) noexcept; + ox::StringViewCR appName) noexcept; } diff --git a/src/olympic/keel/include/keel/media.hpp b/src/olympic/keel/include/keel/media.hpp index 29b94ad4..7132e7ac 100644 --- a/src/olympic/keel/include/keel/media.hpp +++ b/src/olympic/keel/include/keel/media.hpp @@ -30,14 +30,14 @@ oxModelBegin(PreloadPtr) oxModelEnd() ox::Result getPreloadAddr(keel::Context &ctx, ox::FileAddress const&file) noexcept; -ox::Result getPreloadAddr(keel::Context &ctx, ox::CRStringView file) noexcept; +ox::Result 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 pathToUuid(Context &ctx, ox::CRStringView path) noexcept; +ox::Result pathToUuid(Context &ctx, ox::StringViewCR path) noexcept; ox::Result getUuid(Context &ctx, ox::FileAddress const&fileAddr) noexcept; @@ -53,7 +53,7 @@ constexpr ox::Result uuidUrlToUuid(ox::StringView uuidUrl) noexcept { ox::Result uuidUrlToPath(Context &ctx, ox::StringView uuid) noexcept; -ox::Result uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept; +ox::Result uuidToPath(Context &ctx, ox::StringViewCR uuid) noexcept; ox::Result uuidToPath(Context &ctx, ox::UUID const&uuid) noexcept; @@ -114,7 +114,7 @@ ox::Result> readObjFile( template ox::Result> readObjNoCache( keel::Context &ctx, - ox::CRStringView assetId) noexcept { + ox::StringViewCR assetId) noexcept { if constexpr(ox::preloadable::value) { oxRequire(addr, getPreloadAddr(ctx, assetId)); return keel::AssetRef(std::bit_cast(uintptr_t{addr})); @@ -130,7 +130,7 @@ ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) noexcept; template ox::Result> readObj( keel::Context &ctx, - ox::CRStringView assetId, + ox::StringViewCR assetId, [[maybe_unused]] bool forceLoad = false) noexcept { #ifndef OX_BARE_METAL return readObjFile(ctx, assetId, forceLoad); @@ -169,9 +169,9 @@ ox::Error writeObj( ox::Error setRomFs(Context &ctx, ox::UPtr &&fs) noexcept; -ox::Result> loadRomFs(ox::CRStringView path) noexcept; +ox::Result> loadRomFs(ox::StringViewCR path) noexcept; -ox::Result loadRom(ox::CRStringView path = "") noexcept; +ox::Result loadRom(ox::StringViewCR path = "") noexcept; void unloadRom(char*) noexcept; diff --git a/src/olympic/keel/include/keel/pack.hpp b/src/olympic/keel/include/keel/pack.hpp index 8d018208..532b4ef6 100644 --- a/src/olympic/keel/include/keel/pack.hpp +++ b/src/olympic/keel/include/keel/pack.hpp @@ -142,7 +142,7 @@ ox::Error preloadDir( ox::TypeStore &ts, ox::FileSystem &romFs, ox::Preloader &pl, - ox::CRStringView path) noexcept { + ox::StringViewCR path) noexcept { // copy oxTracef("pack.preload", "path: {}", path); oxRequire(fileList, romFs.ls(path)); diff --git a/src/olympic/keel/include/keel/typeconv.hpp b/src/olympic/keel/include/keel/typeconv.hpp index a204103c..94ac91ef 100644 --- a/src/olympic/keel/include/keel/typeconv.hpp +++ b/src/olympic/keel/include/keel/typeconv.hpp @@ -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> 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(); constexpr auto SrcTypeVersion = ox::requireModelTypeVersion(); 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()}; constexpr auto DstTypeVersion = ox::requireModelTypeVersion(); return dstTypeName == DstTypeName @@ -133,7 +133,7 @@ class Converter: public BaseConverter { ox::Result> convert( keel::Context &ctx, ox::BufferView const&srcBuffer, - ox::CRStringView dstTypeName, + ox::StringViewCR dstTypeName, int dstTypeVersion) noexcept; template diff --git a/src/olympic/keel/src/keel.cpp b/src/olympic/keel/src/keel.cpp index 894069f0..39f78e98 100644 --- a/src/olympic/keel/src/keel.cpp +++ b/src/olympic/keel/src/keel.cpp @@ -9,7 +9,7 @@ namespace keel { ox::Error init( keel::Context &ctx, ox::UPtr &&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> init(ox::UPtr &&fs, ox::CRStringView appName) noexcept { +ox::Result> init(ox::UPtr &&fs, ox::StringViewCR appName) noexcept { auto ctx = ox::make_unique(); oxReturnError(keel::init(*ctx, std::move(fs), appName)); return ctx; diff --git a/src/olympic/keel/src/media.cpp b/src/olympic/keel/src/media.cpp index dfcad3e1..7f2b7cbc 100644 --- a/src/olympic/keel/src/media.cpp +++ b/src/olympic/keel/src/media.cpp @@ -12,7 +12,7 @@ namespace keel { -ox::Result loadRom(ox::CRStringView path) noexcept { +ox::Result 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{path, f})); @@ -74,7 +74,7 @@ ox::Error buildUuidMap(Context &ctx) noexcept { return buildUuidMap(ctx, ""); } -ox::Result pathToUuid(Context &ctx, ox::CRStringView path) noexcept { +ox::Result 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 uuidUrlToPath(Context &ctx, ox::StringView uuid) noe #endif } -ox::Result uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept { +ox::Result 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 loadRom(ox::CRStringView) noexcept { +ox::Result 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 loadRom(ox::CRStringView) noexcept { void unloadRom(char*) noexcept { } -ox::Result getPreloadAddr(keel::Context &ctx, ox::CRStringView path) noexcept { +ox::Result getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept { oxRequire(stat, ctx.rom->stat(path)); oxRequire(buff, static_cast(ctx.rom.get())->directAccess(path)); PreloadPtr p; @@ -238,7 +238,7 @@ ox::Error setRomFs(Context &ctx, ox::UPtr &&fs) noexcept { return buildUuidMap(ctx); } -ox::Result> loadRomFs(ox::CRStringView path) noexcept { +ox::Result> loadRomFs(ox::StringViewCR path) noexcept { auto const lastDot = ox::lastIndexOf(path, '.'); if (!lastDot.error && substr(path, lastDot.value) == ".oxfs") { oxRequire(rom, loadRom(path)); diff --git a/src/olympic/keel/src/pack.cpp b/src/olympic/keel/src/pack.cpp index 6a8d9a17..1f18eb60 100644 --- a/src/olympic/keel/src/pack.cpp +++ b/src/olympic/keel/src/pack.cpp @@ -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 diff --git a/src/olympic/keel/src/typeconv.cpp b/src/olympic/keel/src/typeconv.cpp index b8bef6af..909ac105 100644 --- a/src/olympic/keel/src/typeconv.cpp +++ b/src/olympic/keel/src/typeconv.cpp @@ -11,9 +11,9 @@ namespace keel { static ox::Result findConverter( ox::SpanView 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> convert( keel::Context &ctx, ox::SpanView 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> convert( ox::Result> convert( keel::Context &ctx, ox::BufferView const&srcBuffer, - ox::CRStringView dstTypeName, + ox::StringViewCR dstTypeName, int dstTypeVersion) noexcept { oxRequire(hdr, readAssetHeader(srcBuffer)); return convert( diff --git a/src/olympic/studio/applib/src/clawviewer.cpp b/src/olympic/studio/applib/src/clawviewer.cpp index 89a61b7d..ad8466e0 100644 --- a/src/olympic/studio/applib/src/clawviewer.cpp +++ b/src/olympic/studio/applib/src/clawviewer.cpp @@ -93,7 +93,7 @@ void ClawEditor::drawRow(ox::ModelValue const&value) noexcept { ImGui::Text("%s", val.c_str()); } -void ClawEditor::drawVar(ObjPath &path, ox::CRStringView name, ox::ModelValue const&value) noexcept { +void ClawEditor::drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue const&value) noexcept { using Str = ox::BasicString<100>; path.push_back(name); if (value.type() == ox::ModelValue::Type::Object) { diff --git a/src/olympic/studio/applib/src/clawviewer.hpp b/src/olympic/studio/applib/src/clawviewer.hpp index 1b201f5c..3be1f96c 100644 --- a/src/olympic/studio/applib/src/clawviewer.hpp +++ b/src/olympic/studio/applib/src/clawviewer.hpp @@ -23,7 +23,7 @@ class ClawEditor: public Editor { private: static void drawRow(ox::ModelValue const&value) noexcept; - void drawVar(ObjPath &path, ox::CRStringView name, ox::ModelValue const&value) noexcept; + void drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue const&value) noexcept; void drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept; }; diff --git a/src/olympic/studio/applib/src/main.cpp b/src/olympic/studio/applib/src/main.cpp index 324cebcb..e1cf5cf9 100644 --- a/src/olympic/studio/applib/src/main.cpp +++ b/src/olympic/studio/applib/src/main.cpp @@ -34,8 +34,8 @@ static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) } static ox::Error runApp( - ox::CRStringView appName, - ox::CRStringView projectDataDir, + ox::StringViewCR appName, + ox::StringViewCR projectDataDir, ox::UPtr &&fs) noexcept { oxRequireM(ctx, turbine::init(std::move(fs), appName)); turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName); @@ -50,8 +50,8 @@ static ox::Error runApp( } static ox::Error run( - ox::CRStringView appName, - ox::CRStringView projectDataDir, + ox::StringViewCR appName, + ox::StringViewCR projectDataDir, int, char const**) { // seed UUID generator diff --git a/src/olympic/studio/applib/src/projectexplorer.cpp b/src/olympic/studio/applib/src/projectexplorer.cpp index 8961c4c0..56b1d2b4 100644 --- a/src/olympic/studio/applib/src/projectexplorer.cpp +++ b/src/olympic/studio/applib/src/projectexplorer.cpp @@ -51,7 +51,7 @@ void ProjectExplorer::setModel(ox::UPtr &&model) noexcept { m_treeModel = std::move(model); } -ox::Error ProjectExplorer::refreshProjectTreeModel(ox::CRStringView) noexcept { +ox::Error ProjectExplorer::refreshProjectTreeModel(ox::StringViewCR) noexcept { oxRequireM(model, buildProjectTreeModel(*this, "Project", "/", nullptr)); setModel(std::move(model)); return OxError(0); diff --git a/src/olympic/studio/applib/src/projectexplorer.hpp b/src/olympic/studio/applib/src/projectexplorer.hpp index b7c15a45..1e3cc732 100644 --- a/src/olympic/studio/applib/src/projectexplorer.hpp +++ b/src/olympic/studio/applib/src/projectexplorer.hpp @@ -23,7 +23,7 @@ class ProjectExplorer: public studio::Widget { void setModel(ox::UPtr &&model) noexcept; - ox::Error refreshProjectTreeModel(ox::CRStringView = {}) noexcept; + ox::Error refreshProjectTreeModel(ox::StringViewCR = {}) noexcept; [[nodiscard]] inline ox::FileSystem *romFs() noexcept { diff --git a/src/olympic/studio/applib/src/studioapp.cpp b/src/olympic/studio/applib/src/studioapp.cpp index e54e1167..2dfada02 100644 --- a/src/olympic/studio/applib/src/studioapp.cpp +++ b/src/olympic/studio/applib/src/studioapp.cpp @@ -318,7 +318,7 @@ void StudioUI::handleKeyInput() noexcept { } } -ox::Error StudioUI::createOpenProject(ox::CRStringView path) noexcept { +ox::Error StudioUI::createOpenProject(ox::StringViewCR path) noexcept { std::error_code ec; std::filesystem::create_directories(toStdStringView(path), ec); oxReturnError(OxError(ec.value() != 0, "Could not create project directory")); @@ -346,11 +346,11 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept { return m_projectExplorer.refreshProjectTreeModel(); } -ox::Error StudioUI::openFile(ox::CRStringView path) noexcept { +ox::Error StudioUI::openFile(ox::StringViewCR path) noexcept { return openFileActiveTab(path, true); } -ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab) noexcept { +ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept { if (!m_project) { return OxError(1, "No project open to open a file from"); } @@ -394,7 +394,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab) return {}; } -ox::Error StudioUI::closeFile(ox::CRStringView path) noexcept { +ox::Error StudioUI::closeFile(ox::StringViewCR path) noexcept { if (!m_openFiles.contains(path)) { return {}; } diff --git a/src/olympic/studio/applib/src/studioapp.hpp b/src/olympic/studio/applib/src/studioapp.hpp index 059c9f72..efd374c6 100644 --- a/src/olympic/studio/applib/src/studioapp.hpp +++ b/src/olympic/studio/applib/src/studioapp.hpp @@ -83,15 +83,15 @@ class StudioUI: public ox::SignalHandler { void handleKeyInput() noexcept; - ox::Error createOpenProject(ox::CRStringView path) noexcept; + ox::Error createOpenProject(ox::StringViewCR path) noexcept; ox::Error openProjectPath(ox::StringParam path) noexcept; - ox::Error openFile(ox::CRStringView path) noexcept; + ox::Error openFile(ox::StringViewCR path) noexcept; - ox::Error openFileActiveTab(ox::CRStringView path, bool makeActiveTab) noexcept; + ox::Error openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept; - ox::Error closeFile(ox::CRStringView path) noexcept; + ox::Error closeFile(ox::StringViewCR path) noexcept; }; } diff --git a/src/olympic/studio/modlib/include/studio/configio.hpp b/src/olympic/studio/modlib/include/studio/configio.hpp index 69b4443f..711bbcb4 100644 --- a/src/olympic/studio/modlib/include/studio/configio.hpp +++ b/src/olympic/studio/modlib/include/studio/configio.hpp @@ -33,7 +33,7 @@ inline ox::String slashesToPct(ox::StringView str) noexcept { ox::String configPath(keel::Context const&ctx) noexcept; template -ox::Result readConfig(keel::Context &ctx, ox::CRStringView name) noexcept { +ox::Result readConfig(keel::Context &ctx, ox::StringViewCR name) noexcept { oxAssert(name != "", "Config type has no TypeName"); auto const path = ox::sfmt("/{}.json", detail::slashesToPct(name)); ox::PassThroughFS fs(configPath(ctx)); @@ -52,7 +52,7 @@ ox::Result readConfig(keel::Context &ctx) noexcept { } template -ox::Error writeConfig(keel::Context &ctx, ox::CRStringView name, T const&data) noexcept { +ox::Error writeConfig(keel::Context &ctx, ox::StringViewCR name, T const&data) noexcept { oxAssert(name != "", "Config type has no TypeName"); auto const path = ox::sfmt("/{}.json", detail::slashesToPct(name)); ox::PassThroughFS fs(configPath(ctx)); @@ -76,7 +76,7 @@ ox::Error writeConfig(keel::Context &ctx, T const&data) noexcept { } template -void openConfig(keel::Context &ctx, ox::CRStringView name, Func f) noexcept { +void openConfig(keel::Context &ctx, ox::StringViewCR name, Func f) noexcept { oxAssert(name != "", "Config type has no TypeName"); auto const [c, err] = readConfig(ctx, name); oxLogError(err); @@ -90,7 +90,7 @@ void openConfig(keel::Context &ctx, Func f) noexcept { } template -void editConfig(keel::Context &ctx, ox::CRStringView name, Func f) noexcept { +void editConfig(keel::Context &ctx, ox::StringViewCR name, Func f) noexcept { oxAssert(name != "", "Config type has no TypeName"); auto [c, err] = readConfig(ctx, name); oxLogError(err); diff --git a/src/olympic/studio/modlib/include/studio/filedialog.hpp b/src/olympic/studio/modlib/include/studio/filedialog.hpp index 40c13c85..e8415f08 100644 --- a/src/olympic/studio/modlib/include/studio/filedialog.hpp +++ b/src/olympic/studio/modlib/include/studio/filedialog.hpp @@ -17,7 +17,7 @@ struct FDFilterItem { String name{}; String spec{}; constexpr FDFilterItem() noexcept = default; - FDFilterItem(ox::CRStringView pName, ox::CRStringView pSpec) noexcept; + FDFilterItem(ox::StringViewCR pName, ox::StringViewCR pSpec) noexcept; }; ox::Result saveFile(ox::Vector const&exts) noexcept; diff --git a/src/olympic/studio/modlib/include/studio/module.hpp b/src/olympic/studio/modlib/include/studio/module.hpp index a8fac916..78fcd820 100644 --- a/src/olympic/studio/modlib/include/studio/module.hpp +++ b/src/olympic/studio/modlib/include/studio/module.hpp @@ -18,7 +18,7 @@ namespace studio { class ItemMaker; struct EditorMaker { - using Func = std::function(ox::CRStringView)>; + using Func = std::function(ox::StringViewCR)>; ox::Vector fileTypes; Func make; }; @@ -38,7 +38,7 @@ template studio::EditorMaker editorMaker(studio::StudioContext &ctx, ox::StringParam ext) noexcept { return { {std::move(ext)}, - [&ctx](ox::CRStringView path) -> ox::Result { + [&ctx](ox::StringViewCR path) -> ox::Result { return ox::makeCatch(ctx, path); } }; diff --git a/src/olympic/studio/modlib/include/studio/project.hpp b/src/olympic/studio/modlib/include/studio/project.hpp index d363c0bc..0672271a 100644 --- a/src/olympic/studio/modlib/include/studio/project.hpp +++ b/src/olympic/studio/modlib/include/studio/project.hpp @@ -28,7 +28,7 @@ enum class ProjectEvent { }; [[nodiscard]] -constexpr ox::Result fileExt(ox::CRStringView path) noexcept { +constexpr ox::Result fileExt(ox::StringViewCR path) noexcept { auto const extStart = ox::find(path.crbegin(), path.crend(), '.').offset(); if (!extStart) { return OxError(1, "file path does not have valid extension"); @@ -57,7 +57,7 @@ class Project { ox::HashMap> m_fileExtFileMap; public: - explicit Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir); + explicit Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDataDir); ox::Error create() noexcept; @@ -67,14 +67,14 @@ class Project { [[nodiscard]] ox::FileSystem &romFs() noexcept; - ox::Error mkdir(ox::CRStringView path) const noexcept; + ox::Error mkdir(ox::StringViewCR path) const noexcept; /** * Writes a MetalClaw object to the project at the given path. */ template ox::Error writeObj( - ox::CRStringView path, + ox::StringViewCR path, T const&obj, ox::ClawFormat fmt) noexcept; @@ -83,53 +83,53 @@ class Project { */ template ox::Error writeObj( - ox::CRStringView path, + ox::StringViewCR path, T const&obj) noexcept; template - ox::Result loadObj(ox::CRStringView path) const noexcept; + ox::Result loadObj(ox::StringViewCR path) const noexcept; - ox::Result stat(ox::CRStringView path) const noexcept; + ox::Result stat(ox::StringViewCR path) const noexcept; [[nodiscard]] - bool exists(ox::CRStringView path) const noexcept; + bool exists(ox::StringViewCR path) const noexcept; template ox::Error subscribe(ProjectEvent e, ox::SignalHandler *tgt, Functor &&slot) const noexcept; [[nodiscard]] - ox::Vector const&fileList(ox::CRStringView ext) noexcept; + ox::Vector const&fileList(ox::StringViewCR ext) noexcept; ox::Error writeTypeStore() noexcept; private: void buildFileIndex() noexcept; - void indexFile(ox::CRStringView path) noexcept; + void indexFile(ox::StringViewCR path) noexcept; - ox::Error writeBuff(ox::CRStringView path, ox::BufferView const&buff) noexcept; + ox::Error writeBuff(ox::StringViewCR path, ox::BufferView const&buff) noexcept; - ox::Result loadBuff(ox::CRStringView path) const noexcept; + ox::Result loadBuff(ox::StringViewCR path) const noexcept; - ox::Error lsProcDir(ox::Vector *paths, ox::CRStringView path) const noexcept; + ox::Error lsProcDir(ox::Vector *paths, ox::StringViewCR path) const noexcept; - ox::Result> listFiles(ox::CRStringView path = "") const noexcept; + ox::Result> listFiles(ox::StringViewCR path = "") const noexcept; // signals public: - ox::Signal fileEvent; - ox::Signal fileAdded; + ox::Signal fileEvent; + ox::Signal fileAdded; // FileRecognized is triggered for all matching files upon a new // subscription to a section of the project and upon the addition of a // file. - ox::Signal fileRecognized; - ox::Signal fileDeleted; + ox::Signal fileRecognized; + ox::Signal fileDeleted; ox::Signal fileUpdated; }; template -ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat fmt) noexcept { +ox::Error Project::writeObj(ox::StringViewCR path, T const&obj, ox::ClawFormat fmt) noexcept { oxRequireM(buff, ox::writeClaw(obj, fmt)); // write to FS oxReturnError(mkdir(parentDir(path))); @@ -151,14 +151,14 @@ ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat f } template -ox::Error Project::writeObj(ox::CRStringView path, T const&obj) noexcept { +ox::Error Project::writeObj(ox::StringViewCR path, T const&obj) noexcept { oxRequire(ext, fileExt(path)); auto const fmt = m_typeFmt[ext].or_value(ox::ClawFormat::Metal); return writeObj(path, obj, fmt); } template -ox::Result Project::loadObj(ox::CRStringView path) const noexcept { +ox::Result Project::loadObj(ox::StringViewCR path) const noexcept { oxRequire(buff, loadBuff(path)); if constexpr(ox::is_same_v) { return keel::readAsset(m_typeStore, buff); diff --git a/src/olympic/studio/modlib/src/filedialog_nfd.cpp b/src/olympic/studio/modlib/src/filedialog_nfd.cpp index e0102591..9420f315 100644 --- a/src/olympic/studio/modlib/src/filedialog_nfd.cpp +++ b/src/olympic/studio/modlib/src/filedialog_nfd.cpp @@ -11,7 +11,7 @@ namespace studio { -FDFilterItem::FDFilterItem(ox::CRStringView pName, ox::CRStringView pSpec) noexcept { +FDFilterItem::FDFilterItem(ox::StringViewCR pName, ox::StringViewCR pSpec) noexcept { name.resize(pName.len() + 1); ox::strncpy(name.data(), pName.data(), pName.len()); spec.resize(pSpec.len() + 1); diff --git a/src/olympic/studio/modlib/src/project.cpp b/src/olympic/studio/modlib/src/project.cpp index 9e0e06e5..2975dbbf 100644 --- a/src/olympic/studio/modlib/src/project.cpp +++ b/src/olympic/studio/modlib/src/project.cpp @@ -26,7 +26,7 @@ static void generateTypes(ox::TypeStore &ts) noexcept { } } -Project::Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir): +Project::Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDataDir): m_ctx(ctx), m_path(std::move(path)), m_projectDataDir(projectDataDir), @@ -55,7 +55,7 @@ ox::FileSystem &Project::romFs() noexcept { return m_fs; } -ox::Error Project::mkdir(ox::CRStringView path) const noexcept { +ox::Error Project::mkdir(ox::StringViewCR path) const noexcept { auto const [stat, err] = m_fs.stat(path); if (err) { oxReturnError(m_fs.mkdir(path, true)); @@ -65,15 +65,15 @@ ox::Error Project::mkdir(ox::CRStringView path) const noexcept { ox::Error{} : OxError(1, "path exists as normal file"); } -ox::Result Project::stat(ox::CRStringView path) const noexcept { +ox::Result Project::stat(ox::StringViewCR path) const noexcept { return m_fs.stat(path); } -bool Project::exists(ox::CRStringView path) const noexcept { +bool Project::exists(ox::StringViewCR path) const noexcept { return m_fs.stat(path).error == 0; } -ox::Vector const&Project::fileList(ox::CRStringView ext) noexcept { +ox::Vector const&Project::fileList(ox::StringViewCR ext) noexcept { return m_fileExtFileMap[ext]; } @@ -104,7 +104,7 @@ void Project::buildFileIndex() noexcept { } } -void Project::indexFile(ox::CRStringView path) noexcept { +void Project::indexFile(ox::StringViewCR path) noexcept { auto const [ext, err] = fileExt(path); if (err) { return; @@ -112,7 +112,7 @@ void Project::indexFile(ox::CRStringView path) noexcept { m_fileExtFileMap[ext].emplace_back(path); } -ox::Error Project::writeBuff(ox::CRStringView path, ox::BufferView const&buff) noexcept { +ox::Error Project::writeBuff(ox::StringViewCR path, ox::BufferView const&buff) noexcept { constexpr auto HdrSz = 40; ox::Buffer outBuff; outBuff.reserve(buff.size() + HdrSz); @@ -133,11 +133,11 @@ ox::Error Project::writeBuff(ox::CRStringView path, ox::BufferView const&buff) n return {}; } -ox::Result Project::loadBuff(ox::CRStringView path) const noexcept { +ox::Result Project::loadBuff(ox::StringViewCR path) const noexcept { return m_fs.read(path); } -ox::Error Project::lsProcDir(ox::Vector *paths, ox::CRStringView path) const noexcept { +ox::Error Project::lsProcDir(ox::Vector *paths, ox::StringViewCR path) const noexcept { oxRequire(files, m_fs.ls(path)); for (auto const&name : files) { auto fullPath = ox::sfmt("{}/{}", path, name); @@ -156,7 +156,7 @@ ox::Error Project::lsProcDir(ox::Vector *paths, ox::CRStringView pat return {}; } -ox::Result> Project::listFiles(ox::CRStringView path) const noexcept { +ox::Result> Project::listFiles(ox::StringViewCR path) const noexcept { ox::Vector paths; oxReturnError(lsProcDir(&paths, path)); return paths; diff --git a/src/olympic/turbine/include/turbine/clipboard.hpp b/src/olympic/turbine/include/turbine/clipboard.hpp index 83de7261..20445151 100644 --- a/src/olympic/turbine/include/turbine/clipboard.hpp +++ b/src/olympic/turbine/include/turbine/clipboard.hpp @@ -30,7 +30,7 @@ class ClipboardObject: public BaseClipboardObject { ox::String getClipboardText(Context &ctx) noexcept; -void setClipboardText(Context &ctx, ox::CRStringView text) noexcept; +void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept; void setClipboardObject(Context &ctx, ox::UPtr &&obj) noexcept; diff --git a/src/olympic/turbine/include/turbine/gfx.hpp b/src/olympic/turbine/include/turbine/gfx.hpp index 7e863cbb..5ff11ba3 100644 --- a/src/olympic/turbine/include/turbine/gfx.hpp +++ b/src/olympic/turbine/include/turbine/gfx.hpp @@ -26,7 +26,7 @@ void removeDrawer(Context &ctx, Drawer *cd) noexcept; ox::Error initGfx(Context &ctx) noexcept; -void setWindowTitle(Context &ctx, ox::CRStringView title) noexcept; +void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept; void focusWindow(Context &ctx) noexcept; diff --git a/src/olympic/turbine/include/turbine/turbine.hpp b/src/olympic/turbine/include/turbine/turbine.hpp index d24897bf..e27341dd 100644 --- a/src/olympic/turbine/include/turbine/turbine.hpp +++ b/src/olympic/turbine/include/turbine/turbine.hpp @@ -16,7 +16,7 @@ namespace turbine { using TimeMs = uint64_t; -ox::Result init(ox::UPtr &&fs, ox::CRStringView appName) noexcept; +ox::Result init(ox::UPtr &&fs, ox::StringViewCR appName) noexcept; ox::Error run(Context &ctx) noexcept; diff --git a/src/olympic/turbine/src/gba/clipboard.cpp b/src/olympic/turbine/src/gba/clipboard.cpp index eae5fbee..03a74ae9 100644 --- a/src/olympic/turbine/src/gba/clipboard.cpp +++ b/src/olympic/turbine/src/gba/clipboard.cpp @@ -12,7 +12,7 @@ ox::String getClipboardText(Context&) noexcept { return {}; } -void setClipboardText(Context&, ox::CRStringView) noexcept { +void setClipboardText(Context&, ox::StringViewCR) noexcept { } } diff --git a/src/olympic/turbine/src/gba/gfx.cpp b/src/olympic/turbine/src/gba/gfx.cpp index e244e3cb..a777074f 100644 --- a/src/olympic/turbine/src/gba/gfx.cpp +++ b/src/olympic/turbine/src/gba/gfx.cpp @@ -24,7 +24,7 @@ ox::Error initGfx(Context&) noexcept { return {}; } -void setWindowTitle(Context&, ox::CRStringView) noexcept { +void setWindowTitle(Context&, ox::StringViewCR) noexcept { } int getScreenWidth(Context&) noexcept { diff --git a/src/olympic/turbine/src/gba/turbine.cpp b/src/olympic/turbine/src/gba/turbine.cpp index 96432a2d..9840912e 100644 --- a/src/olympic/turbine/src/gba/turbine.cpp +++ b/src/olympic/turbine/src/gba/turbine.cpp @@ -57,7 +57,7 @@ static ox::Result findPreloadSection() noexcept { } ox::Result init( - ox::UPtr &&fs, ox::CRStringView appName) noexcept { + ox::UPtr &&fs, ox::StringViewCR appName) noexcept { auto ctx = ox::make_unique(); oxReturnError(keel::init(ctx->keelCtx, std::move(fs), appName)); #ifdef OX_BARE_METAL diff --git a/src/olympic/turbine/src/glfw/clipboard.cpp b/src/olympic/turbine/src/glfw/clipboard.cpp index 2fd824bb..fa9a6a01 100644 --- a/src/olympic/turbine/src/glfw/clipboard.cpp +++ b/src/olympic/turbine/src/glfw/clipboard.cpp @@ -16,7 +16,7 @@ ox::String getClipboardText(Context &ctx) noexcept { return ox::String(glfwGetClipboardString(ctx.window)); } -void setClipboardText(Context &ctx, ox::CRStringView text) noexcept { +void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept { auto cstr = ox_malloca(text.bytes() + 1, char); ox::strncpy(cstr.get(), text.data(), text.bytes()); glfwSetClipboardString(ctx.window, cstr.get()); diff --git a/src/olympic/turbine/src/glfw/gfx.cpp b/src/olympic/turbine/src/glfw/gfx.cpp index 9eeef906..7507b5eb 100644 --- a/src/olympic/turbine/src/glfw/gfx.cpp +++ b/src/olympic/turbine/src/glfw/gfx.cpp @@ -219,7 +219,7 @@ ox::Error initGfx(Context &ctx) noexcept { return {}; } -void setWindowTitle(Context &ctx, ox::CRStringView title) noexcept { +void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept { auto cstr = ox_malloca(title.bytes() + 1, char); ox::strncpy(cstr.get(), title.data(), title.bytes()); glfwSetWindowTitle(ctx.window, cstr.get()); diff --git a/src/olympic/turbine/src/glfw/turbine.cpp b/src/olympic/turbine/src/glfw/turbine.cpp index fb307e6d..d8446064 100644 --- a/src/olympic/turbine/src/glfw/turbine.cpp +++ b/src/olympic/turbine/src/glfw/turbine.cpp @@ -41,7 +41,7 @@ static void draw(GLFWwindow *window, int, int) noexcept { } ox::Result init( - ox::UPtr &&fs, ox::CRStringView appName) noexcept { + ox::UPtr &&fs, ox::StringViewCR appName) noexcept { auto ctx = ox::make_unique(); oxReturnError(keel::init(ctx->keelCtx, std::move(fs), appName)); using namespace std::chrono;