Squashed 'deps/nostalgia/' changes from c501fc04..ab025e88
ab025e88 [nostalgia] Change Palette converter color idx to be 0 based bd2e88cd [olympic,nostalgia] Cleanup with StringParam f4a9872f [ox/std] Add StringParam f8aa60e4 [ox/std] Fix itoa result length calculation 3ead305f [nostalgia/core/studio/tilesheeteditor] Fix Fill command to properly end eb498ca5 [ox/event] Comment out Signal disconnect warning git-subtree-dir: deps/nostalgia git-subtree-split: ab025e88daed941b926fd8d9d9b824c22c32749c
This commit is contained in:
@@ -123,7 +123,7 @@ class Editor: public studio::BaseEditor {
|
||||
ox::String m_itemName;
|
||||
|
||||
public:
|
||||
Editor(ox::StringView itemPath) noexcept;
|
||||
Editor(ox::StringParam itemPath) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
ox::CStringView itemPath() const noexcept final;
|
||||
|
@@ -19,17 +19,17 @@ class ItemMaker {
|
||||
ox::String const parentDir;
|
||||
ox::String const fileExt;
|
||||
constexpr explicit ItemMaker(
|
||||
ox::StringView pName,
|
||||
ox::StringView pParentDir,
|
||||
ox::StringView pFileExt) noexcept:
|
||||
typeName(pName),
|
||||
parentDir(pParentDir),
|
||||
fileExt(pFileExt) {
|
||||
ox::StringParam pName,
|
||||
ox::StringParam pParentDir,
|
||||
ox::StringParam pFileExt) noexcept:
|
||||
typeName{std::move(pName)},
|
||||
parentDir{std::move(pParentDir)},
|
||||
fileExt{std::move(pFileExt)} {
|
||||
}
|
||||
virtual ~ItemMaker() noexcept = default;
|
||||
|
||||
[[nodiscard]]
|
||||
inline virtual ox::String itemPath(ox::StringView pName) const noexcept {
|
||||
virtual ox::String itemPath(ox::StringView pName) const noexcept {
|
||||
return ox::sfmt("/{}/{}.{}", parentDir, pName, fileExt);
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ class ItemMaker {
|
||||
* @param pName
|
||||
* @return path of file or error in Result
|
||||
*/
|
||||
virtual ox::Result<ox::String> write(
|
||||
studio::StudioContext &ctx, ox::CRStringView pName) const noexcept = 0;
|
||||
virtual ox::Result<ox::String> write(StudioContext &ctx, ox::StringView pName) const noexcept = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@@ -50,36 +49,36 @@ class ItemMakerT: public ItemMaker {
|
||||
ox::ClawFormat const m_fmt;
|
||||
public:
|
||||
constexpr ItemMakerT(
|
||||
ox::StringView pDisplayName,
|
||||
ox::StringView pParentDir,
|
||||
ox::StringView fileExt,
|
||||
ox::StringParam pDisplayName,
|
||||
ox::StringParam pParentDir,
|
||||
ox::StringParam fileExt,
|
||||
ox::ClawFormat pFmt = ox::ClawFormat::Metal) noexcept:
|
||||
ItemMaker(pDisplayName, pParentDir, fileExt),
|
||||
ItemMaker(std::move(pDisplayName), std::move(pParentDir), std::move(fileExt)),
|
||||
m_fmt(pFmt) {
|
||||
}
|
||||
constexpr ItemMakerT(
|
||||
ox::StringView pDisplayName,
|
||||
ox::StringView pParentDir,
|
||||
ox::StringView fileExt,
|
||||
ox::StringParam pDisplayName,
|
||||
ox::StringParam pParentDir,
|
||||
ox::StringParam fileExt,
|
||||
T pItem,
|
||||
ox::ClawFormat pFmt) noexcept:
|
||||
ItemMaker(pDisplayName, pParentDir, fileExt),
|
||||
ItemMaker(std::move(pDisplayName), std::move(pParentDir), std::move(fileExt)),
|
||||
m_item(std::move(pItem)),
|
||||
m_fmt(pFmt) {
|
||||
}
|
||||
constexpr ItemMakerT(
|
||||
ox::StringView pDisplayName,
|
||||
ox::StringView pParentDir,
|
||||
ox::StringView fileExt,
|
||||
ox::StringParam pDisplayName,
|
||||
ox::StringParam pParentDir,
|
||||
ox::StringParam fileExt,
|
||||
T &&pItem,
|
||||
ox::ClawFormat pFmt) noexcept:
|
||||
ItemMaker(pDisplayName, pParentDir, fileExt),
|
||||
m_item(std::move(pItem)),
|
||||
m_fmt(pFmt) {
|
||||
ItemMaker(std::move(pDisplayName), std::move(pParentDir), std::move(fileExt)),
|
||||
m_item(std::move(pItem)),
|
||||
m_fmt(pFmt) {
|
||||
}
|
||||
ox::Result<ox::String> write(studio::StudioContext &sctx, ox::CRStringView pName) const noexcept override {
|
||||
ox::Result<ox::String> write(studio::StudioContext &sctx, ox::StringView const pName) const noexcept override {
|
||||
auto const path = itemPath(pName);
|
||||
keel::createUuidMapping(keelCtx(sctx.tctx), path, ox::UUID::generate().unwrap());
|
||||
createUuidMapping(keelCtx(sctx.tctx), path, ox::UUID::generate().unwrap());
|
||||
oxReturnError(sctx.project->writeObj(path, m_item, m_fmt));
|
||||
return path;
|
||||
}
|
||||
|
@@ -35,9 +35,9 @@ class Module {
|
||||
|
||||
template<typename Editor>
|
||||
[[nodiscard]]
|
||||
studio::EditorMaker editorMaker(studio::StudioContext &ctx, ox::CRStringView ext) noexcept {
|
||||
studio::EditorMaker editorMaker(studio::StudioContext &ctx, ox::StringParam ext) noexcept {
|
||||
return {
|
||||
{ox::String(ext)},
|
||||
{std::move(ext)},
|
||||
[&ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
||||
return ox::makeCatch<Editor>(ctx, path);
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class Popup {
|
||||
m_size = {static_cast<float>(sz.width), static_cast<float>(sz.height)};
|
||||
}
|
||||
|
||||
constexpr void setTitle(ox::String title) noexcept {
|
||||
constexpr void setTitle(ox::StringParam title) noexcept {
|
||||
m_title = std::move(title);
|
||||
}
|
||||
|
||||
|
@@ -115,8 +115,8 @@ void BaseEditor::setRequiresConstantRefresh(bool value) noexcept {
|
||||
}
|
||||
|
||||
|
||||
Editor::Editor(ox::StringView itemPath) noexcept:
|
||||
m_itemPath(itemPath),
|
||||
Editor::Editor(ox::StringParam itemPath) noexcept:
|
||||
m_itemPath(std::move(itemPath)),
|
||||
m_itemName(m_itemPath.substr(std::find(m_itemPath.rbegin(), m_itemPath.rend(), '/').offset() + 1)) {
|
||||
m_undoStack.changeTriggered.connect(this, &Editor::markUnsavedChanges);
|
||||
}
|
||||
|
Reference in New Issue
Block a user