[keel,nostalgia,studio,turbine] Fixes for ox::String explicit change

This commit is contained in:
2023-11-28 23:32:29 -06:00
parent 3a62650d62
commit da98aa864c
10 changed files with 28 additions and 44 deletions

View File

@@ -33,7 +33,7 @@ constexpr ox::Result<ox::StringView> fileExt(ox::CRStringView path) noexcept {
if (!extStart) {
return OxError(1, "Cannot open a file without valid extension.");
}
return path.substr(extStart + 1);
return substr(path, extStart + 1);
}
class Project {

View File

@@ -104,7 +104,7 @@ ox::Error BaseEditor::saveItem() noexcept {
ox::StringView BaseEditor::pathToItemName(ox::CRStringView path) noexcept {
const auto lastSlash = std::find(path.rbegin(), path.rend(), '/').offset();
return path.substr(lastSlash + 1);
return substr(path, lastSlash + 1);
}
void BaseEditor::setRequiresConstantRefresh(bool value) noexcept {

View File

@@ -23,7 +23,7 @@ static void generateTypes(ox::TypeStore *ts) noexcept {
Project::Project(keel::Context *ctx, ox::String path, ox::CRStringView projectDataDir) noexcept:
m_ctx(ctx),
m_path(path),
m_path(std::move(path)),
m_projectDataDir(projectDataDir),
m_typeStore(ctx->rom.get(), ox::sfmt("/.{}/type_descriptors", projectDataDir)),
m_fs(ctx->rom.get()) {
@@ -57,8 +57,7 @@ bool Project::exists(ox::CRStringView path) const noexcept {
}
const ox::Vector<ox::String> &Project::fileList(ox::CRStringView ext) noexcept {
// Warning: StringView to String
return m_fileExtFileMap[ox::String(ext)];
return m_fileExtFileMap[ext];
}
void Project::buildFileIndex() noexcept {
@@ -81,8 +80,7 @@ void Project::indexFile(ox::CRStringView path) noexcept {
if (err) {
return;
}
// Warning: StringView to String
m_fileExtFileMap[ox::String(ext)].emplace_back(path);
m_fileExtFileMap[ext].emplace_back(path);
}
ox::Error Project::writeBuff(const ox::StringView &path, const ox::Buffer &buff) noexcept {
@@ -90,8 +88,7 @@ ox::Error Project::writeBuff(const ox::StringView &path, const ox::Buffer &buff)
ox::Buffer outBuff;
outBuff.reserve(buff.size() + HdrSz);
ox::BufferWriter writer(&outBuff);
// Warning: StringView to String
const auto [uuid, err] = m_ctx->pathToUuid.at(ox::String(path));
const auto [uuid, err] = m_ctx->pathToUuid.at(path);
if (!err) {
oxReturnError(keel::writeUuidHeader(writer, *uuid));
}