mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 22:06:40 +00:00
Use std::string_view to avoid redundant std::string construction
This commit is contained in:
parent
caf971b979
commit
ba69146ced
4 changed files with 10 additions and 9 deletions
|
@ -12,7 +12,7 @@ CSMWorld::Scope CSMWorld::getScopeFromId (const std::string& id)
|
|||
std::string::size_type i = id.find ("::");
|
||||
|
||||
if (i!=std::string::npos)
|
||||
namespace_ = Misc::StringUtils::lowerCase (id.substr (0, i));
|
||||
namespace_ = Misc::StringUtils::lowerCase(std::string_view(id).substr(0, i));
|
||||
|
||||
if (namespace_=="project")
|
||||
return Scope_Project;
|
||||
|
|
|
@ -293,5 +293,5 @@ bool MWDialogue::SelectWrapper::selectCompare (bool value) const
|
|||
|
||||
std::string MWDialogue::SelectWrapper::getName() const
|
||||
{
|
||||
return Misc::StringUtils::lowerCase (mSelect.mSelectRule.substr (5));
|
||||
return Misc::StringUtils::lowerCase(std::string_view(mSelect.mSelectRule).substr(5));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Interpreter{
|
|||
if(eschar == '%' || eschar == '^')
|
||||
{
|
||||
retval << text.substr(start, i - start);
|
||||
std::string temp = Misc::StringUtils::lowerCase(text.substr(i+1, 100));
|
||||
std::string temp = Misc::StringUtils::lowerCase(std::string_view(text).substr(i + 1, 100));
|
||||
|
||||
bool found = false;
|
||||
try
|
||||
|
@ -170,10 +170,10 @@ namespace Interpreter{
|
|||
sort(globals.begin(), globals.end(), longerStr);
|
||||
}
|
||||
|
||||
for(unsigned int j = 0; j < globals.size(); j++){
|
||||
if(globals[j].length() > temp.length()){ // Just in case there's a global with a huuuge name
|
||||
temp = Misc::StringUtils::lowerCase(text.substr(i+1, globals[j].length()));
|
||||
}
|
||||
for(unsigned int j = 0; j < globals.size(); j++)
|
||||
{
|
||||
if (globals[j].length() > temp.length()) // Just in case there's a global with a huuuge name
|
||||
temp = Misc::StringUtils::lowerCase(std::string_view(text).substr(i + 1, globals[j].length()));
|
||||
|
||||
found = check(temp, globals[j], &i, &start);
|
||||
if(found){
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace Resource
|
|||
|
||||
void RetrieveAnimationsVisitor::apply(osg::Node& node)
|
||||
{
|
||||
if (node.libraryName() == std::string("osgAnimation") && node.className() == std::string("Bone") && Misc::StringUtils::lowerCase(node.getName()) == std::string("bip01"))
|
||||
if (node.libraryName() == std::string_view("osgAnimation") && node.className() == std::string_view("Bone")
|
||||
&& Misc::StringUtils::lowerCase(node.getName()) == std::string_view("bip01"))
|
||||
{
|
||||
osg::ref_ptr<SceneUtil::OsgAnimationController> callback = new SceneUtil::OsgAnimationController();
|
||||
|
||||
|
|
Loading…
Reference in a new issue