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

@@ -31,44 +31,6 @@
#include <string>
#include <utf8.h>
Tokenizer::Tokenizer(const std::string& src, const char sep, uint32 vectorReserve)
{
m_str = new char[src.length() + 1];
memcpy(m_str, src.c_str(), src.length() + 1);
if (vectorReserve)
{
m_storage.reserve(vectorReserve);
}
char* posold = m_str;
char* posnew = m_str;
for (;;)
{
if (*posnew == sep)
{
m_storage.push_back(posold);
posold = posnew + 1;
*posnew = '\0';
}
else if (*posnew == '\0')
{
// Hack like, but the old code accepted these kind of broken strings,
// so changing it would break other things
if (posold != posnew)
{
m_storage.push_back(posold);
}
break;
}
++posnew;
}
}
void stripLineInvisibleChars(std::string& str)
{
static std::string const invChars = " \t\7\n";