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:
2024-08-30 21:13:18 -05:00
parent 88617af409
commit a1a34f27f9
23 changed files with 101 additions and 64 deletions

View File

@ -264,8 +264,8 @@ class Signal<Error(Args...)> {
}
void cleanup(Signal *signal) noexcept final {
auto err = m_receiver->destruction.disconnectSignal(signal);
oxErrorf("{}", toStr(err));
std::ignore = m_receiver->destruction.disconnectSignal(signal);
//oxErrorf("{}", toStr(err));
//oxAssert(err, "Signal could not notify receiver that it is being destroyed. Destruction of receiver will cause use-after-free.");
}

View File

@ -128,6 +128,7 @@ install(
stringview.hpp
strongint.hpp
strconv.hpp
stringparam.hpp
strops.hpp
trace.hpp
typeinfo.hpp

View File

@ -234,12 +234,16 @@ constexpr auto itoa(Integer v) noexcept {
switch (sizeof(Integer)) {
case 1:
out = 3;
break;
case 2:
out = 5;
break;
case 4:
out = 10;
break;
case 8:
out = 21;
break;
}
return out + ox::is_signed_v<Integer>;
}();

View File

@ -46,6 +46,7 @@
#include "stddef.hpp"
#include "string.hpp"
#include "stringliteral.hpp"
#include "stringparam.hpp"
#include "stringview.hpp"
#include "strongint.hpp"
#include "strops.hpp"

32
deps/ox/src/ox/std/stringparam.hpp vendored Normal file
View File

@ -0,0 +1,32 @@
/*
* Copyright 2015 - 2024 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "string.hpp"
namespace ox {
class StringParam {
private:
ox::String m_value;
public:
StringParam(StringParam const&) = delete;
constexpr StringParam(StringParam &&o) noexcept: m_value{std::move(o.m_value)} {}
constexpr StringParam(char const*value) noexcept: m_value{value} {}
constexpr StringParam(detail::BaseStringView const&value) noexcept: m_value{value} {}
constexpr StringParam(ox::String const&value) noexcept: m_value{value} {}
constexpr StringParam(ox::String &&value) noexcept: m_value{std::move(value)} {}
constexpr operator ox::String() && noexcept { return std::move(m_value); }
explicit constexpr operator ox::CStringView() const noexcept { return m_value; }
explicit constexpr operator ox::StringView() const noexcept { return m_value; }
[[nodiscard]]
constexpr ox::CStringView view() const noexcept { return m_value; }
};
}