mirror of https://github.com/AxioDL/metaforce.git
Add handy StringUtils begin/end compare functions
This commit is contained in:
parent
735e6b2096
commit
f0b1837300
|
@ -1089,6 +1089,11 @@ public:
|
|||
return hecl::ProjectPath(getProject(), getRelativePath() + _S('|') + auxStr);
|
||||
}
|
||||
|
||||
hecl::ProjectPath ensureAuxInfo(const SystemString& auxStr) const
|
||||
{
|
||||
return ensureAuxInfo(auxStr.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Type of path
|
||||
*/
|
||||
|
@ -1194,6 +1199,29 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief handy functions not directly provided via STL strings
|
||||
*/
|
||||
class StringUtils
|
||||
{
|
||||
public:
|
||||
static bool BeginsWith(const SystemString& str, const SystemChar* test)
|
||||
{
|
||||
size_t len = StrLen(test);
|
||||
if (len > str.size())
|
||||
return false;
|
||||
return !StrCmp(str.data(), test);
|
||||
}
|
||||
|
||||
static bool EndsWith(const SystemString& str, const SystemChar* test)
|
||||
{
|
||||
size_t len = StrLen(test);
|
||||
if (len > str.size())
|
||||
return false;
|
||||
return !StrCmp(&*(str.end() - len), test);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Mutex-style centralized resource-path tracking
|
||||
*
|
||||
|
|
|
@ -123,7 +123,12 @@ void ProjectPath::assign(const ProjectPath& parentPath, const std::string& path)
|
|||
ProjectPath ProjectPath::getCookedPath(const Database::DataSpecEntry& spec) const
|
||||
{
|
||||
ProjectPath woExt = getWithExtension(nullptr, true);
|
||||
return ProjectPath(m_proj->getProjectCookedPath(spec), woExt.getRelativePath());
|
||||
ProjectPath ret(m_proj->getProjectCookedPath(spec), woExt.getRelativePath());
|
||||
|
||||
if (getAuxInfo().size())
|
||||
return ret.getWithExtension((_S('.') + getAuxInfo()).c_str());
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
ProjectPath::Type ProjectPath::getPathType() const
|
||||
|
|
Loading…
Reference in New Issue