[nostalgia,olympic] Rename string len() functions to size()

This commit is contained in:
2025-07-25 22:48:08 -05:00
parent b126a3a859
commit aa875e9be2
9 changed files with 17 additions and 12 deletions

View File

@ -146,7 +146,7 @@ ox::Error cmdExportTilesheet(studio::Project &project, ox::SpanView<ox::CString>
// load objects // load objects
auto &kctx = project.kctx(); auto &kctx = project.kctx();
OX_REQUIRE(ts, keel::readObj<TileSheet>(kctx, srcPath).transformError(4, "could not load TileSheet")); OX_REQUIRE(ts, keel::readObj<TileSheet>(kctx, srcPath).transformError(4, "could not load TileSheet"));
OX_REQUIRE(pal, keel::readObj<Palette>(kctx, palPath.len() ? palPath : ts->defaultPalette) OX_REQUIRE(pal, keel::readObj<Palette>(kctx, palPath.size() ? palPath : ts->defaultPalette)
.transformError(5, "could not load Palette")); .transformError(5, "could not load Palette"));
// export to the destination file // export to the destination file
return exportSubsheetToPng( return exportSubsheetToPng(

View File

@ -3,6 +3,11 @@ add_library(
OlympicApplib INTERFACE OlympicApplib INTERFACE
) )
target_link_libraries(
OlympicApplib INTERFACE
OxLogConn
)
target_sources( target_sources(
OlympicApplib INTERFACE OlympicApplib INTERFACE
applib.cpp applib.cpp

View File

@ -59,7 +59,7 @@ static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path, DuplicateSet
auto const [uuid, err] = readUuidHeader(buff); auto const [uuid, err] = readUuidHeader(buff);
if (!err) { if (!err) {
// check for duplication // check for duplication
if (duplicates && ctx.uuidToPath[uuid.toString()].len()) { if (duplicates && ctx.uuidToPath[uuid.toString()].size()) {
auto &dl = (*duplicates)[uuid]; auto &dl = (*duplicates)[uuid];
if (dl.empty()) { if (dl.empty()) {
dl.emplace_back(ctx.uuidToPath[uuid.toString()]); dl.emplace_back(ctx.uuidToPath[uuid.toString()]);

View File

@ -88,7 +88,7 @@ static ox::Error pack(
oxOutf("Final ROM buff size: {} bytes\n", romBuff.size()); oxOutf("Final ROM buff size: {} bytes\n", romBuff.size());
OX_RETURN_ERROR(writeFileBuff(argRomBin, romBuff)); OX_RETURN_ERROR(writeFileBuff(argRomBin, romBuff));
OX_REQUIRE(manifestJson, ox::writeOCString(manifest)); OX_REQUIRE(manifestJson, ox::writeOCString(manifest));
OX_RETURN_ERROR(writeFileBuff(argManifest, {manifestJson.data(), manifestJson.len()})); OX_RETURN_ERROR(writeFileBuff(argManifest, {manifestJson.data(), manifestJson.size()}));
return {}; return {};
} }

View File

@ -16,7 +16,7 @@ static std::map<ox::StringView, ox::Error(*)()> tests = {
constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db"; constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db";
constexpr ox::StringView hdr = "K1;8d814442-f46e-4cc3-8edc-ca3c01cc86db;"; constexpr ox::StringView hdr = "K1;8d814442-f46e-4cc3-8edc-ca3c01cc86db;";
OX_REQUIRE(uuid, ox::UUID::fromString(uuidStr)); OX_REQUIRE(uuid, ox::UUID::fromString(uuidStr));
ox::Array<char, hdr.len()> buff; ox::Array<char, hdr.size()> buff;
ox::CharBuffWriter bw(buff); ox::CharBuffWriter bw(buff);
OX_RETURN_ERROR(keel::writeUuidHeader(bw, uuid)); OX_RETURN_ERROR(keel::writeUuidHeader(bw, uuid));
oxExpect(ox::StringView(buff.data(), buff.size()), hdr); oxExpect(ox::StringView(buff.data(), buff.size()), hdr);

View File

@ -192,7 +192,7 @@ void NewMenu::drawLastPageButtons(Context &sctx) noexcept {
} }
void NewMenu::finish(Context &sctx) noexcept { void NewMenu::finish(Context &sctx) noexcept {
if (m_itemName.len() == 0) { if (m_itemName.size() == 0) {
oxLogError(ox::Error{1, "New file error: no file name"}); oxLogError(ox::Error{1, "New file error: no file name"});
return; return;
} }

View File

@ -57,7 +57,7 @@ void ProjectExplorer::dirContextMenu(ox::StringViewCR path) const noexcept {
if (ImGui::MenuItem("Add Directory")) { if (ImGui::MenuItem("Add Directory")) {
addDir.emit(path); addDir.emit(path);
} }
if (path.len() && ImGui::MenuItem("Delete")) { if (path.size() && ImGui::MenuItem("Delete")) {
deleteItem.emit(path); deleteItem.emit(path);
} }
ImGui::EndPopup(); ImGui::EndPopup();

View File

@ -40,8 +40,8 @@ constexpr ox::Result<ox::StringView> fileExt(ox::StringViewCR path) noexcept {
[[nodiscard]] [[nodiscard]]
constexpr ox::StringView parentDir(ox::StringView path) noexcept { constexpr ox::StringView parentDir(ox::StringView path) noexcept {
if (path.len() && path[path.len() - 1] == '/') { if (path.size() && path[path.size() - 1] == '/') {
path = substr(path, 0, path.len() - 1); path = substr(path, 0, path.size() - 1);
} }
auto const extStart = ox::find(path.crbegin(), path.crend(), '/').offset(); auto const extStart = ox::find(path.crbegin(), path.crend(), '/').offset();
return substr(path, 0, extStart); return substr(path, 0, extStart);

View File

@ -13,10 +13,10 @@ namespace studio {
FDFilterItem::FDFilterItem(ox::StringViewCR pName, ox::StringViewCR pSpec) noexcept { FDFilterItem::FDFilterItem(ox::StringViewCR pName, ox::StringViewCR pSpec) noexcept {
OX_ALLOW_UNSAFE_BUFFERS_BEGIN OX_ALLOW_UNSAFE_BUFFERS_BEGIN
name.resize(pName.len() + 1); name.resize(pName.size() + 1);
ox::strncpy(name.data(), pName.data(), pName.len()); ox::strncpy(name.data(), pName.data(), pName.size());
spec.resize(pSpec.len() + 1); spec.resize(pSpec.size() + 1);
ox::strncpy(spec.data(), pSpec.data(), pSpec.len()); ox::strncpy(spec.data(), pSpec.data(), pSpec.size());
OX_ALLOW_UNSAFE_BUFFERS_END OX_ALLOW_UNSAFE_BUFFERS_END
} }