Merge commit '9b5f7886cadc5c3dc826d00fa5b2e71696151dfd'

This commit is contained in:
2025-06-23 20:49:01 -05:00
60 changed files with 370 additions and 345 deletions

View File

@ -55,7 +55,7 @@ void registerStudioModules() noexcept;
#if defined(_WIN32) && OLYMPIC_GUI_APP
int WinMain() {
auto const argc = __argc;
auto const argv = const_cast<const char**>(__argv);
auto const argv = const_cast<char const**>(__argv);
#else
int main(int const argc, char const **argv) {
#endif

View File

@ -26,7 +26,7 @@ ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const&uuid) noexce
template<typename T>
ox::Result<T> readAsset(ox::BufferView buff) noexcept {
std::size_t offset = 0;
const auto err = readUuidHeader(buff).error;
auto const err = readUuidHeader(buff).error;
if (!err) {
offset = K1HdrSz; // the size of K1 headers
}

View File

@ -37,8 +37,8 @@ ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, ox::BufferView buff) no
}
ox::Result<ox::StringView> readAssetTypeId(ox::BufferView const buff) noexcept {
const auto err = readUuidHeader(buff).error;
const auto offset = err ? 0u : K1HdrSz;
auto const err = readUuidHeader(buff).error;
auto const offset = err ? 0u : K1HdrSz;
if (offset >= buff.size()) [[unlikely]] {
return ox::Error(1, "Buffer too small for expected data");
}
@ -47,8 +47,8 @@ ox::Result<ox::StringView> readAssetTypeId(ox::BufferView const buff) noexcept {
ox::Result<AssetHdr> readAssetHeader(ox::BufferView buff) noexcept {
ox::Result<AssetHdr> out;
const auto err = readUuidHeader(buff).moveTo(out.value.uuid);
const auto offset = err ? 0u : K1HdrSz;
auto const err = readUuidHeader(buff).moveTo(out.value.uuid);
auto const offset = err ? 0u : K1HdrSz;
if (offset >= buff.size()) [[unlikely]] {
return ox::Error(1, "Buffer too small for expected data");
}

View File

@ -49,7 +49,7 @@ static ox::Result<ox::UPtr<Wrap>> convert(
if (!subConverter.converter().dstMatches(dstTypeName, dstTypeVersion)) {
continue;
}
const auto [intermediate, chainErr] =
auto const [intermediate, chainErr] =
convert(ctx, converters, src, srcTypeName, srcTypeVersion,
subConverter.converter().srcTypeName(), subConverter.converter().srcTypeVersion());
if (!chainErr) {

View File

@ -25,7 +25,7 @@ static std::map<ox::StringView, ox::Error(*)()> tests = {
},
};
int main(int argc, const char **argv) {
int main(int argc, char const **argv) {
int retval = -1;
if (argc > 0) {
auto const args = ox::Span{argv, static_cast<size_t>(argc)};

View File

@ -61,7 +61,7 @@ static ox::Error runApp(
static ox::Error run(
ox::StringViewCR appName,
ox::StringViewCR projectDataDir,
ox::SpanView<const char*>) {
ox::SpanView<ox::CString>) {
// seed UUID generator
auto const time = std::time(nullptr);
ox::UUID::seedGenerator({

View File

@ -140,14 +140,14 @@ void ClawEditor::drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue co
void ClawEditor::drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept {
using Str = ox::BasicString<100>;
for (const auto &c : obj) {
for (auto const &c : obj) {
ImGui::TableNextRow(0, 5);
auto pathStr = ox::join<Str>("##", path).unwrap();
auto lbl = ox::sfmt<Str>("{}##{}", c->name, pathStr);
const auto rowSelected = false;
const auto hasChildren = c->value.type() == ox::ModelValue::Type::Object
auto const rowSelected = false;
auto const hasChildren = c->value.type() == ox::ModelValue::Type::Object
|| c->value.type() == ox::ModelValue::Type::Vector;
const auto flags = ImGuiTreeNodeFlags_SpanFullWidth
auto const flags = ImGuiTreeNodeFlags_SpanFullWidth
| ImGuiTreeNodeFlags_OpenOnArrow
| (hasChildren ? 0 : ImGuiTreeNodeFlags_Leaf)
| (rowSelected ? ImGuiTreeNodeFlags_Selected : 0);
@ -158,7 +158,7 @@ void ClawEditor::drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept {
//}
path.push_back(c->name);
if (c->value.type() == ox::ModelValue::Type::Object) {
const auto open = ImGui::TreeNodeEx(lbl.c_str(), flags);
auto const open = ImGui::TreeNodeEx(lbl.c_str(), flags);
ImGui::SameLine();
drawRow(c->value);
if (open) {

View File

@ -635,8 +635,7 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
keel::DuplicateSet ds;
OX_RETURN_ERROR(keel::setRomFs(keelCtx(m_tctx), std::move(fs), ds));
if (ds.size()) {
ox::String msg;
msg += "Multiple files have the same UUID:\n";
ox::String msg{"Multiple files have the same UUID:\n"};
for (auto const &k : ds.keys()) {
msg += ox::sfmt("\n\t{}:\n", k.toString());
for (auto const &v : ds[k]) {

View File

@ -131,7 +131,7 @@ class ChildStackItem {
class IDStackItem {
public:
explicit IDStackItem(int id) noexcept;
explicit IDStackItem(const char *id) noexcept;
explicit IDStackItem(ox::CString const id) noexcept;
explicit IDStackItem(ox::CStringViewCR id) noexcept;
~IDStackItem() noexcept;
};
@ -244,7 +244,7 @@ bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show,
* @return true if new value selected, false otherwise
*/
bool ComboBox(
ox::CStringView lbl,
ox::CStringView const &lbl,
ox::SpanView<ox::CStringView> list,
size_t &selectedIdx) noexcept;
@ -255,7 +255,7 @@ bool ComboBox(
* @param selectedIdx
* @return true if new value selected, false otherwise
*/
bool ComboBox(ox::CStringView lbl, ox::Span<const ox::String> list, size_t &selectedIdx) noexcept;
bool ComboBox(ox::CStringView const &lbl, ox::Span<ox::String const> list, size_t &selectedIdx) noexcept;
/**
*

View File

@ -18,11 +18,11 @@ ChildStackItem::~ChildStackItem() noexcept {
ImGui::EndChild();
}
IDStackItem::IDStackItem(int id) noexcept {
IDStackItem::IDStackItem(int const id) noexcept {
ImGui::PushID(id);
}
IDStackItem::IDStackItem(const char *id) noexcept {
IDStackItem::IDStackItem(ox::CString const id) noexcept {
ImGui::PushID(id);
}
@ -55,7 +55,7 @@ bool PushButton(ox::CStringViewCR lbl, ImVec2 const &btnSz) noexcept {
}
PopupResponse PopupControlsOkCancel(
float popupWidth,
float const popupWidth,
bool &popupOpen,
ox::CStringViewCR ok,
ox::CStringViewCR cancel) {
@ -110,14 +110,14 @@ bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show,
}
bool ComboBox(
ox::CStringView lbl,
ox::SpanView<ox::CStringView> list,
ox::CStringView const &lbl,
ox::SpanView<ox::CStringView> const list,
size_t &selectedIdx) noexcept {
bool out{};
auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : "";
if (ImGui::BeginCombo(lbl.c_str(), first, 0)) {
for (auto i = 0u; i < list.size(); ++i) {
const auto selected = (selectedIdx == i);
auto const selected = (selectedIdx == i);
if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) {
selectedIdx = i;
out = true;
@ -129,14 +129,14 @@ bool ComboBox(
}
bool ComboBox(
ox::CStringView lbl,
ox::Span<const ox::String> list,
ox::CStringView const &lbl,
ox::Span<ox::String const> const list,
size_t &selectedIdx) noexcept {
bool out{};
auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : "";
if (ImGui::BeginCombo(lbl.c_str(), first, 0)) {
for (auto i = 0u; i < list.size(); ++i) {
const auto selected = (selectedIdx == i);
auto const selected = (selectedIdx == i);
if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) {
selectedIdx = i;
out = true;
@ -150,13 +150,13 @@ bool ComboBox(
bool ComboBox(
ox::CStringViewCR lbl,
std::function<ox::CStringView(size_t)> const &f,
size_t strCnt,
size_t const strCnt,
size_t &selectedIdx) noexcept {
bool out{};
auto const first = selectedIdx < strCnt ? f(selectedIdx).c_str() : "";
if (ImGui::BeginCombo(lbl.c_str(), first, 0)) {
for (auto i = 0u; i < strCnt; ++i) {
const auto selected = (selectedIdx == i);
auto const selected = (selectedIdx == i);
if (ImGui::Selectable(f(i).c_str(), selected) && selectedIdx != i) {
selectedIdx = i;
out = true;