Core/Misc: std::string -> std::string_view in a bunch of places, notably chat commands and Util.h

(cherry picked from commit a41bbd9ad9)
This commit is contained in:
Treeston
2020-08-23 00:31:57 +02:00
committed by Shauren
parent 5ba95cb42f
commit 0473beff2b
4 changed files with 108 additions and 116 deletions

View File

@@ -441,7 +441,7 @@ public:
return DoTeleport(handler, loc);
}
static bool HandleGoInstanceCommand(ChatHandler* handler, std::vector<std::string> const& labels)
static bool HandleGoInstanceCommand(ChatHandler* handler, std::vector<std::string_view> labels)
{
if (labels.empty())
return false;
@@ -453,7 +453,7 @@ public:
uint32 count = 0;
std::string const& scriptName = sObjectMgr->GetScriptName(pair.second.ScriptId);
char const* mapName = ASSERT_NOTNULL(sMapStore.LookupEntry(pair.first))->MapName[handler->GetSessionDbcLocale()];
for (auto const& label : labels)
for (std::string_view label : labels)
if (StringContainsStringI(scriptName, label))
++count;
@@ -526,7 +526,7 @@ public:
return false;
}
static bool HandleGoBossCommand(ChatHandler* handler, std::vector<std::string> const& needles)
static bool HandleGoBossCommand(ChatHandler* handler, std::vector<std::string_view> needles)
{
if (needles.empty())
return false;
@@ -543,7 +543,7 @@ public:
uint32 count = 0;
std::string const& scriptName = sObjectMgr->GetScriptName(data.ScriptID);
for (auto const& label : needles)
for (std::string_view label : needles)
if (StringContainsStringI(scriptName, label) || StringContainsStringI(data.Name, label))
++count;