mirror of https://github.com/odrling/Aegisub
Use STL names for wxString functions with a bunch of aliases
This commit is contained in:
parent
2f4cae46b4
commit
59db22e905
|
@ -253,7 +253,6 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
|
||||||
int start = curLine;
|
int start = curLine;
|
||||||
int nrows = context->subsGrid->GetRows();
|
int nrows = context->subsGrid->GetRows();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
size_t tempPos;
|
|
||||||
int regFlags = wxRE_ADVANCED;
|
int regFlags = wxRE_ADVANCED;
|
||||||
if (!matchCase) {
|
if (!matchCase) {
|
||||||
if (isReg)
|
if (isReg)
|
||||||
|
@ -275,27 +274,28 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
|
||||||
boost::flyweight<wxString> *Text = nullptr;
|
boost::flyweight<wxString> *Text = nullptr;
|
||||||
while (!found) {
|
while (!found) {
|
||||||
Text = get_text(context->subsGrid->GetDialogue(curLine), field);
|
Text = get_text(context->subsGrid->GetDialogue(curLine), field);
|
||||||
|
size_t tempPos;
|
||||||
if (DoReplace && LastWasFind)
|
if (DoReplace && LastWasFind)
|
||||||
tempPos = pos;
|
tempPos = pos;
|
||||||
else
|
else
|
||||||
tempPos = pos+replaceLen;
|
tempPos = pos + replaceLen;
|
||||||
|
|
||||||
if (isReg) {
|
if (isReg) {
|
||||||
if (regex.Matches(Text->get().Mid(tempPos))) {
|
if (regex.Matches(Text->get().substr(tempPos))) {
|
||||||
size_t match_start;
|
size_t match_start;
|
||||||
regex.GetMatch(&match_start,&matchLen,0);
|
regex.GetMatch(&match_start, &matchLen, 0);
|
||||||
pos = match_start + tempPos;
|
pos = match_start + tempPos;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wxString src = Text->get().Mid(tempPos);
|
wxString src = Text->get().substr(tempPos);
|
||||||
if (!matchCase) src.MakeLower();
|
if (!matchCase) src.MakeLower();
|
||||||
int textPos = src.Find(LookFor);
|
size_t textPos = src.find(LookFor);
|
||||||
if (textPos != -1) {
|
if (textPos != src.npos) {
|
||||||
pos = tempPos+textPos;
|
pos = tempPos+textPos;
|
||||||
found = true;
|
found = true;
|
||||||
matchLen = LookFor.Length();
|
matchLen = LookFor.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,14 +314,14 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
|
||||||
replaceLen = matchLen;
|
replaceLen = matchLen;
|
||||||
else {
|
else {
|
||||||
if (isReg) {
|
if (isReg) {
|
||||||
wxString toReplace = Text->get().Mid(pos,matchLen);
|
wxString toReplace = Text->get().substr(pos,matchLen);
|
||||||
regex.ReplaceFirst(&toReplace,ReplaceWith);
|
regex.ReplaceFirst(&toReplace,ReplaceWith);
|
||||||
*Text = Text->get().Left(pos) + toReplace + Text->get().Mid(pos+matchLen);
|
*Text = Text->get().Left(pos) + toReplace + Text->get().substr(pos+matchLen);
|
||||||
replaceLen = toReplace.Length();
|
replaceLen = toReplace.size();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*Text = Text->get().Left(pos) + ReplaceWith + Text->get().Mid(pos+matchLen);
|
*Text = Text->get().Left(pos) + ReplaceWith + Text->get().substr(pos+matchLen);
|
||||||
replaceLen = ReplaceWith.Length();
|
replaceLen = ReplaceWith.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
context->ass->Commit(_("replace"), AssFile::COMMIT_DIAG_TEXT);
|
context->ass->Commit(_("replace"), AssFile::COMMIT_DIAG_TEXT);
|
||||||
|
@ -380,9 +380,9 @@ void SearchReplaceEngine::ReplaceAll() {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
Left.reserve(Right.size());
|
Left.reserve(Right.size());
|
||||||
while (pos + LookFor.size() <= Right.size()) {
|
while (pos + LookFor.size() <= Right.size()) {
|
||||||
if (Right.Mid(pos, LookFor.size()).CmpNoCase(LookFor) == 0) {
|
if (Right.substr(pos, LookFor.size()).CmpNoCase(LookFor) == 0) {
|
||||||
Left.Append(Right.Left(pos)).Append(ReplaceWith);
|
Left.Append(Right.Left(pos)).Append(ReplaceWith);
|
||||||
Right = Right.Mid(pos + LookFor.Len());
|
Right = Right.substr(pos + LookFor.size());
|
||||||
++count;
|
++count;
|
||||||
replaced = true;
|
replaced = true;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
Loading…
Reference in New Issue