diff --git a/src/nostalgia/core/studio/module.cpp b/src/nostalgia/core/studio/module.cpp index ae9cd595..b38c882e 100644 --- a/src/nostalgia/core/studio/module.cpp +++ b/src/nostalgia/core/studio/module.cpp @@ -2,7 +2,8 @@ * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include "ox/std/memory.hpp" +#include + #include "paletteeditor-imgui.hpp" #include "tilesheeteditor-imgui.hpp" @@ -14,7 +15,7 @@ ox::Vector Module::editors(core::Context *ctx) noexcept { return { { {"ng"}, - [ctx](const ox::String &path) -> ox::Result { + [ctx](ox::CRStringView path) -> ox::Result { try { return ox::make(ctx, path); } catch (const ox::Exception &ex) { @@ -24,7 +25,7 @@ ox::Vector Module::editors(core::Context *ctx) noexcept { }, { {"npal"}, - [ctx](const ox::String &path) -> ox::Result { + [ctx](ox::CRStringView path) -> ox::Result { return PaletteEditorImGui::make(ctx, path); } } diff --git a/src/nostalgia/core/studio/paletteeditor-imgui.cpp b/src/nostalgia/core/studio/paletteeditor-imgui.cpp index dbf15833..8cdad656 100644 --- a/src/nostalgia/core/studio/paletteeditor-imgui.cpp +++ b/src/nostalgia/core/studio/paletteeditor-imgui.cpp @@ -13,7 +13,7 @@ namespace nostalgia::core { -ox::Result PaletteEditorImGui::make(Context *ctx, const ox::String &path) noexcept { +ox::Result PaletteEditorImGui::make(Context *ctx, ox::CRStringView path) noexcept { auto out = ox::UniquePtr(new PaletteEditorImGui); out->m_ctx = ctx; out->m_itemPath = path; diff --git a/src/nostalgia/core/studio/paletteeditor-imgui.hpp b/src/nostalgia/core/studio/paletteeditor-imgui.hpp index 3ef53e3a..198141f6 100644 --- a/src/nostalgia/core/studio/paletteeditor-imgui.hpp +++ b/src/nostalgia/core/studio/paletteeditor-imgui.hpp @@ -21,7 +21,7 @@ class PaletteEditorImGui: public studio::Editor { PaletteEditorImGui() noexcept = default; public: - static ox::Result make(Context *ctx, const ox::String &path) noexcept; + static ox::Result make(Context *ctx, ox::CRStringView path) noexcept; /** * Returns the name of item being edited. diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp index b7d2d9bd..dd9bc4be 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp @@ -38,7 +38,7 @@ ox::Error toPngFile(const ox::String &path, const TileSheet::SubSheet &s, const return OxError(lodepng_encode_file(path.c_str(), outData.data(), width, height, fmt, 8)); } -TileSheetEditorImGui::TileSheetEditorImGui(Context *ctx, const ox::String &path): m_tileSheetEditor(ctx, path) { +TileSheetEditorImGui::TileSheetEditorImGui(Context *ctx, ox::CRStringView path): m_tileSheetEditor(ctx, path) { m_ctx = ctx; m_itemPath = path; const auto lastSlash = ox::find(m_itemPath.rbegin(), m_itemPath.rend(), '/').offset(); diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp index 9043320e..66767ede 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp @@ -54,7 +54,7 @@ class TileSheetEditorImGui: public studio::BaseEditor { Tool m_tool = Tool::Draw; public: - TileSheetEditorImGui(Context *ctx, const ox::String &path); + TileSheetEditorImGui(Context *ctx, ox::CRStringView path); ~TileSheetEditorImGui() override = default; diff --git a/src/nostalgia/core/studio/tilesheeteditorview.cpp b/src/nostalgia/core/studio/tilesheeteditorview.cpp index 6093f098..daee65ef 100644 --- a/src/nostalgia/core/studio/tilesheeteditorview.cpp +++ b/src/nostalgia/core/studio/tilesheeteditorview.cpp @@ -10,7 +10,7 @@ namespace nostalgia::core { -TileSheetEditorView::TileSheetEditorView(Context *ctx, const ox::String &path): m_model(ctx, path), m_pixelsDrawer(&m_model) { +TileSheetEditorView::TileSheetEditorView(Context *ctx, ox::CRStringView path): m_model(ctx, path), m_pixelsDrawer(&m_model) { // build shaders oxThrowError(m_pixelsDrawer.buildShader()); oxThrowError(m_pixelGridDrawer.buildShader()); diff --git a/src/nostalgia/core/studio/tilesheeteditorview.hpp b/src/nostalgia/core/studio/tilesheeteditorview.hpp index 4364c5d2..ecbd82cf 100644 --- a/src/nostalgia/core/studio/tilesheeteditorview.hpp +++ b/src/nostalgia/core/studio/tilesheeteditorview.hpp @@ -49,7 +49,7 @@ class TileSheetEditorView: public ox::SignalHandler { std::size_t m_palIdx = 0; public: - TileSheetEditorView(Context *ctx, const ox::String &path); + TileSheetEditorView(Context *ctx, ox::CRStringView path); ~TileSheetEditorView() override = default; diff --git a/src/nostalgia/studio/lib/module.hpp b/src/nostalgia/studio/lib/module.hpp index da22a027..1c754ce3 100644 --- a/src/nostalgia/studio/lib/module.hpp +++ b/src/nostalgia/studio/lib/module.hpp @@ -17,7 +17,7 @@ namespace nostalgia::studio { class ItemMaker; struct EditorMaker { - using Func = std::function(const ox::String&)>; + using Func = std::function(ox::CRStringView)>; ox::Vector fileTypes; Func make; };