From 8c9ebbedaee54d6a24d1e5f1c82461a8d37d6afa Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 10 Dec 2023 15:09:51 -0600 Subject: [PATCH] [nostalgia,studio] Replace some String returns with StringView --- .../core/src/studio/paletteeditor/paletteeditor-imgui.cpp | 4 ++-- .../core/src/studio/paletteeditor/paletteeditor-imgui.hpp | 4 ++-- .../src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp | 4 ++-- .../src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp | 4 ++-- .../modules/scene/src/studio/sceneeditor-imgui.cpp | 4 ++-- .../modules/scene/src/studio/sceneeditor-imgui.hpp | 4 ++-- src/studio/applib/src/clawviewer.cpp | 4 ++-- src/studio/applib/src/clawviewer.hpp | 4 ++-- src/studio/modlib/include/studio/editor.hpp | 6 +++--- src/studio/modlib/src/editor.cpp | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index 9c345dff..f02aad86 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -22,11 +22,11 @@ PaletteEditorImGui::PaletteEditorImGui(turbine::Context &ctx, ox::CRStringView p m_pal(*keel::readObj(keelCtx(m_ctx), ox::FileAddress(m_itemPath.c_str())).unwrapThrow()) { } -ox::String const&PaletteEditorImGui::itemName() const noexcept { +ox::CStringView PaletteEditorImGui::itemName() const noexcept { return m_itemPath; } -ox::String const&PaletteEditorImGui::itemDisplayName() const noexcept { +ox::CStringView PaletteEditorImGui::itemDisplayName() const noexcept { return m_itemName; } diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp index 03ea77b7..0775c34d 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -26,9 +26,9 @@ class PaletteEditorImGui: public studio::Editor { /** * Returns the name of item being edited. */ - ox::String const&itemName() const noexcept final; + ox::CStringView itemName() const noexcept final; - ox::String const&itemDisplayName() const noexcept final; + ox::CStringView itemDisplayName() const noexcept final; void draw(turbine::Context*) noexcept final; diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index b5d728b2..faffc9df 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -54,11 +54,11 @@ TileSheetEditorImGui::TileSheetEditorImGui(turbine::Context &ctx, ox::CRStringVi model()->paletteChanged.connect(this, &TileSheetEditorImGui::setPaletteSelection); } -ox::String const&TileSheetEditorImGui::itemName() const noexcept { +ox::CStringView TileSheetEditorImGui::itemName() const noexcept { return m_itemPath; } -ox::String const&TileSheetEditorImGui::itemDisplayName() const noexcept { +ox::CStringView TileSheetEditorImGui::itemDisplayName() const noexcept { return m_itemName; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index f70938ea..cd076267 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -59,9 +59,9 @@ class TileSheetEditorImGui: public studio::BaseEditor { ~TileSheetEditorImGui() override = default; - ox::String const&itemName() const noexcept override; + ox::CStringView itemName() const noexcept override; - ox::String const&itemDisplayName() const noexcept override; + ox::CStringView itemDisplayName() const noexcept override; void exportFile() override; diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp index 7529f28e..8fb172c1 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp @@ -20,11 +20,11 @@ SceneEditorImGui::SceneEditorImGui(turbine::Context &ctx, ox::StringView path): setRequiresConstantRefresh(false); } -ox::CRString SceneEditorImGui::itemName() const noexcept { +ox::CStringView SceneEditorImGui::itemName() const noexcept { return m_itemPath; } -ox::CRString SceneEditorImGui::itemDisplayName() const noexcept { +ox::CStringView SceneEditorImGui::itemDisplayName() const noexcept { return m_itemName; } diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp index 5e25385c..fe370eb4 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp @@ -28,9 +28,9 @@ class SceneEditorImGui: public studio::Editor { /** * Returns the name of item being edited. */ - ox::CRString itemName() const noexcept final; + ox::CStringView itemName() const noexcept final; - ox::CRString itemDisplayName() const noexcept final; + ox::CStringView itemDisplayName() const noexcept final; void draw(turbine::Context*) noexcept final; diff --git a/src/studio/applib/src/clawviewer.cpp b/src/studio/applib/src/clawviewer.cpp index deef325b..c484bd34 100644 --- a/src/studio/applib/src/clawviewer.cpp +++ b/src/studio/applib/src/clawviewer.cpp @@ -14,11 +14,11 @@ ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept: m_obj(std::move(obj)) { } -ox::CRString ClawEditor::itemName() const noexcept { +ox::CStringView ClawEditor::itemName() const noexcept { return m_itemName; } -ox::CRString ClawEditor::itemDisplayName() const noexcept { +ox::CStringView ClawEditor::itemDisplayName() const noexcept { return m_itemDisplayName; } diff --git a/src/studio/applib/src/clawviewer.hpp b/src/studio/applib/src/clawviewer.hpp index 01d8acc6..1608929d 100644 --- a/src/studio/applib/src/clawviewer.hpp +++ b/src/studio/applib/src/clawviewer.hpp @@ -23,9 +23,9 @@ class ClawEditor: public studio::Editor { /** * Returns the name of item being edited. */ - ox::CRString itemName() const noexcept final; + ox::CStringView itemName() const noexcept final; - ox::CRString itemDisplayName() const noexcept final; + ox::CStringView itemDisplayName() const noexcept final; void draw(turbine::Context*) noexcept final; diff --git a/src/studio/modlib/include/studio/editor.hpp b/src/studio/modlib/include/studio/editor.hpp index 47a163c2..f49433ce 100644 --- a/src/studio/modlib/include/studio/editor.hpp +++ b/src/studio/modlib/include/studio/editor.hpp @@ -32,10 +32,10 @@ class BaseEditor: public Widget { * Returns the name of item being edited. */ [[nodiscard]] - virtual const ox::String &itemName() const noexcept = 0; + virtual ox::CStringView itemName() const noexcept = 0; [[nodiscard]] - virtual const ox::String &itemDisplayName() const noexcept; + virtual ox::CStringView itemDisplayName() const noexcept; virtual void cut(); @@ -113,7 +113,7 @@ class BaseEditor: public Widget { ox::Signal cutEnabledChanged; ox::Signal copyEnabledChanged; ox::Signal pasteEnabledChanged; - ox::Signal closed; + ox::Signal closed; }; diff --git a/src/studio/modlib/src/editor.cpp b/src/studio/modlib/src/editor.cpp index dd3d0375..2aa3f690 100644 --- a/src/studio/modlib/src/editor.cpp +++ b/src/studio/modlib/src/editor.cpp @@ -10,7 +10,7 @@ namespace studio { -const ox::String &BaseEditor::itemDisplayName() const noexcept { +ox::CStringView BaseEditor::itemDisplayName() const noexcept { return itemName(); }