feat(Core/Common): delete old Tokenizer (#10121)

This commit is contained in:
Kargatum
2022-01-21 14:59:05 +07:00
committed by GitHub
parent a25ef74de3
commit 6d7f58e6ed
24 changed files with 284 additions and 225 deletions

View File

@@ -20,6 +20,7 @@
#include "ScriptMgr.h"
#include "Util.h"
#include "WorldPacket.h"
#include "Tokenize.h"
#include <iterator>
#include <sstream>
@@ -43,10 +44,10 @@ void Motd::SetMotd(std::string motd)
WorldPacket data(SMSG_MOTD); // new in 2.0.1
Tokenizer motdTokens(motd, '@');
std::vector<std::string_view> motdTokens = Acore::Tokenize(motd, '@', true);
data << uint32(motdTokens.size()); // line count
for (Tokenizer::const_reference token : motdTokens)
for (std::string_view token : motdTokens)
data << token;
MotdPacket = data;
@@ -55,7 +56,7 @@ void Motd::SetMotd(std::string motd)
return;
std::ostringstream oss;
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<char const*>(oss, "\n"));
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<std::string_view>(oss, "\n"));
oss << *(motdTokens.end() - 1); // copy back element
FormattedMotd = oss.str();
}