2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 07:47:42 +00:00

string_view refactor

This commit is contained in:
Jack Andersen
2017-11-12 20:19:18 -10:00
parent 742ab2514f
commit f7ec7bdc0c
345 changed files with 907 additions and 921 deletions

View File

@@ -25,9 +25,9 @@ namespace DNAMP2
{
logvisor::Module Log("urde::DNAMP2");
static bool GetNoShare(const std::string& name)
static bool GetNoShare(std::string_view name)
{
std::string lowerName = name;
std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid"))
return false;
@@ -65,9 +65,9 @@ PAKBridge::PAKBridge(hecl::Database::Project& project,
}
}
static hecl::SystemString LayerName(const std::string& name)
static hecl::SystemString LayerName(std::string_view name)
{
hecl::SystemString ret = hecl::SystemStringView(name).sys_str();
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
ch = _S('-');
@@ -91,7 +91,7 @@ void PAKBridge::build()
}
bool named;
std::string bestName = m_pak.bestEntryName(e, named);
level.name = hecl::SystemStringView(bestName).sys_str();
level.name = hecl::SystemStringConv(bestName).sys_str();
level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0;
@@ -127,11 +127,11 @@ void PAKBridge::build()
}
if (areaDeps.name.empty())
{
areaDeps.name = hecl::SystemStringView(area.internalAreaName).sys_str();
areaDeps.name = hecl::SystemStringConv(area.internalAreaName).sys_str();
if (areaDeps.name.empty())
{
std::string idStr = area.areaMREAId.toString();
areaDeps.name = _S("MREA_") + hecl::SystemStringView(idStr).sys_str();
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
}
hecl::SystemChar num[16];