Squashed 'deps/nostalgia/' changes from 671b8eda..fae1e73e
fae1e73e [nostalgia/gfx] Make getSubSheet check root subsheet name 51f2905c [nostalgia/gfx/studio] Make TileSheetEditor use export-tilesheet functions for export, fix exporting Root subsheet 0c866d1b [studio,nostalgia/gfx] Add system for adding sub-commands in Modules, add export-tilesheet command fdf39d1a [ox/std] Add Result::transformError a523a75e [ox/std] Add missing include to StringParam cdaa64ed [ox/clargs] Fix arg parsing for first '-' 37b5fcc0 [teagba] Put parentheses around all registers f5f2c3be [studio/applib] Make Studio remove files unable to be opened from open file list in config f6ef2b5a [turbine,nostalgia] Make memory regions cast to bounded ox::Arrays bf958a4a [teagba] Make memory regions cast to bounded ox::Arrays 6a70e478 [nostalgia/gfx] Cleanup git-subtree-dir: deps/nostalgia git-subtree-split: fae1e73e54a420d4b93af67e03144d5442825a11
This commit is contained in:
12
deps/ox/src/ox/clargs/clargs.cpp
vendored
12
deps/ox/src/ox/clargs/clargs.cpp
vendored
@ -15,7 +15,7 @@ ClArgs::ClArgs(int argc, const char **args) noexcept: ClArgs({args, static_cast<
|
||||
|
||||
ClArgs::ClArgs(ox::SpanView<const char*> args) noexcept {
|
||||
for (auto i = 0u; i < args.size(); ++i) {
|
||||
auto arg = StringView(args[i]);
|
||||
auto arg = StringView{args[i]};
|
||||
if (arg[0] == '-') {
|
||||
while (arg[0] == '-' && arg.len()) {
|
||||
arg = substr(arg, 1);
|
||||
@ -23,8 +23,8 @@ ClArgs::ClArgs(ox::SpanView<const char*> args) noexcept {
|
||||
m_bools[arg] = true;
|
||||
// parse additional arguments
|
||||
if (i < args.size() && args[i + 1]) {
|
||||
auto val = String(args[i + 1]);
|
||||
if (val.len() && val[i] != '-') {
|
||||
auto const val = StringView{args[i + 1]};
|
||||
if (val.len() && val[0] != '-') {
|
||||
if (val == "false") {
|
||||
m_bools[arg] = false;
|
||||
}
|
||||
@ -40,17 +40,17 @@ ClArgs::ClArgs(ox::SpanView<const char*> args) noexcept {
|
||||
}
|
||||
|
||||
bool ClArgs::getBool(ox::StringViewCR arg, bool defaultValue) const noexcept {
|
||||
auto [value, err] = m_ints.at(arg);
|
||||
auto const [value, err] = m_ints.at(arg);
|
||||
return !err ? *value : defaultValue;
|
||||
}
|
||||
|
||||
String ClArgs::getString(ox::StringViewCR arg, ox::StringView defaultValue) const noexcept {
|
||||
auto [value, err] = m_strings.at(arg);
|
||||
auto const [value, err] = m_strings.at(arg);
|
||||
return !err ? ox::String(*value) : ox::String(defaultValue);
|
||||
}
|
||||
|
||||
int ClArgs::getInt(ox::StringViewCR arg, int defaultValue) const noexcept {
|
||||
auto [value, err] = m_ints.at(arg);
|
||||
auto const [value, err] = m_ints.at(arg);
|
||||
return !err ? *value : defaultValue;
|
||||
}
|
||||
|
||||
|
7
deps/ox/src/ox/std/error.hpp
vendored
7
deps/ox/src/ox/std/error.hpp
vendored
@ -307,6 +307,13 @@ struct [[nodiscard]] Result {
|
||||
return std::move(value);
|
||||
}
|
||||
|
||||
constexpr Result transformError(ErrorCode const ec, CString const msg) && {
|
||||
if (error) {
|
||||
error = Error{ec, msg};
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
1
deps/ox/src/ox/std/stringparam.hpp
vendored
1
deps/ox/src/ox/std/stringparam.hpp
vendored
@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cstringview.hpp"
|
||||
#include "string.hpp"
|
||||
|
||||
namespace ox {
|
||||
|
Reference in New Issue
Block a user