mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
More QStringRef -> QStringView
Follow-up to stuff that was originally added in 1330076d5d
This commit is contained in:
parent
32f81a668f
commit
52ef16418d
|
@ -769,14 +769,14 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
};
|
};
|
||||||
|
|
||||||
auto addReplEmotes = [&twitchEmotes](const IgnorePhrase &phrase,
|
auto addReplEmotes = [&twitchEmotes](const IgnorePhrase &phrase,
|
||||||
const QStringRef &midrepl,
|
const QStringView &midrepl,
|
||||||
int startIndex) mutable {
|
int startIndex) mutable {
|
||||||
if (!phrase.containsEmote())
|
if (!phrase.containsEmote())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QStringRef> words = midrepl.split(' ');
|
const QVector<QStringView> words = QStringView{midrepl}.split(u' ');
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (const auto &word : words)
|
for (const auto &word : words)
|
||||||
{
|
{
|
||||||
|
@ -852,8 +852,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
|
|
||||||
shiftIndicesAfter(from + len, midsize - len);
|
shiftIndicesAfter(from + len, midsize - len);
|
||||||
|
|
||||||
auto midExtendedRef =
|
auto midExtendedView =
|
||||||
this->originalMessage_.midRef(pos1, pos2 - pos1);
|
QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1);
|
||||||
|
|
||||||
for (auto &tup : vret)
|
for (auto &tup : vret)
|
||||||
{
|
{
|
||||||
|
@ -866,7 +866,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
QRegularExpression emoteregex(
|
QRegularExpression emoteregex(
|
||||||
"\\b" + tup.name.string + "\\b",
|
"\\b" + tup.name.string + "\\b",
|
||||||
QRegularExpression::UseUnicodePropertiesOption);
|
QRegularExpression::UseUnicodePropertiesOption);
|
||||||
auto _match = emoteregex.match(midExtendedRef);
|
auto _match = emoteregex.match(midExtendedView);
|
||||||
if (_match.hasMatch())
|
if (_match.hasMatch())
|
||||||
{
|
{
|
||||||
int last = _match.lastCapturedIndex();
|
int last = _match.lastCapturedIndex();
|
||||||
|
@ -878,7 +878,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addReplEmotes(phrase, midExtendedRef, pos1);
|
addReplEmotes(phrase, midExtendedView, pos1);
|
||||||
|
|
||||||
from += midsize;
|
from += midsize;
|
||||||
}
|
}
|
||||||
|
@ -917,8 +917,8 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
|
|
||||||
shiftIndicesAfter(from + len, replacesize - len);
|
shiftIndicesAfter(from + len, replacesize - len);
|
||||||
|
|
||||||
auto midExtendedRef =
|
auto midExtendedView =
|
||||||
this->originalMessage_.midRef(pos1, pos2 - pos1);
|
QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1);
|
||||||
|
|
||||||
for (auto &tup : vret)
|
for (auto &tup : vret)
|
||||||
{
|
{
|
||||||
|
@ -931,7 +931,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
QRegularExpression emoteregex(
|
QRegularExpression emoteregex(
|
||||||
"\\b" + tup.name.string + "\\b",
|
"\\b" + tup.name.string + "\\b",
|
||||||
QRegularExpression::UseUnicodePropertiesOption);
|
QRegularExpression::UseUnicodePropertiesOption);
|
||||||
auto match = emoteregex.match(midExtendedRef);
|
auto match = emoteregex.match(midExtendedView);
|
||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
{
|
{
|
||||||
int last = match.lastCapturedIndex();
|
int last = match.lastCapturedIndex();
|
||||||
|
@ -943,7 +943,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addReplEmotes(phrase, midExtendedRef, pos1);
|
addReplEmotes(phrase, midExtendedView, pos1);
|
||||||
|
|
||||||
from += replacesize;
|
from += replacesize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue