summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp6
-rw-r--r--core/fpdftext/cpdf_textpage.cpp30
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp26
3 files changed, 30 insertions, 32 deletions
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index d795e71639..fb228ec832 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -152,7 +152,7 @@ void CPDF_LinkExtract::ParseLink() {
if (strBeCheck.GetLength() > 5) {
while (strBeCheck.GetLength() > 0) {
- wchar_t ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1);
+ wchar_t ch = strBeCheck[strBeCheck.GetLength() - 1];
if (ch == L')' || ch == L',' || ch == L'>' || ch == L'.') {
strBeCheck = strBeCheck.Left(strBeCheck.GetLength() - 1);
nCount--;
@@ -242,7 +242,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
// Check the local part.
int pPos = aPos; // Used to track the position of '@' or '.'.
for (int i = aPos - 1; i >= 0; i--) {
- wchar_t ch = str->GetAt(i);
+ wchar_t ch = (*str)[i];
if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
continue;
@@ -278,7 +278,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
int nLen = str->GetLength();
pPos = 0; // Used to track the position of '.'.
for (int i = aPos + 1; i < nLen; i++) {
- wchar_t wch = str->GetAt(i);
+ wchar_t wch = (*str)[i];
if (wch == L'-' || FXSYS_iswalnum(wch))
continue;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 1470ad700d..a4c8b8fba0 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -701,7 +701,7 @@ void CPDF_TextPage::CloseTempLine() {
CFX_WideString str = m_TempTextBuf.MakeString();
bool bPrevSpace = false;
for (int i = 0; i < str.GetLength(); i++) {
- if (str.GetAt(i) != ' ') {
+ if (str[i] != ' ') {
bPrevSpace = false;
continue;
}
@@ -841,8 +841,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
CPDF_Font* pFont = pTextObj->GetFont();
bExist = false;
for (FX_STRSIZE i = 0; i < nItems; i++) {
- if (pFont->CharCodeFromUnicode(actText.GetAt(i)) !=
- CPDF_Font::kInvalidCharCode) {
+ if (pFont->CharCodeFromUnicode(actText[i]) != CPDF_Font::kInvalidCharCode) {
bExist = true;
break;
}
@@ -852,7 +851,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
bExist = false;
for (FX_STRSIZE i = 0; i < nItems; i++) {
- wchar_t wChar = actText.GetAt(i);
+ wchar_t wChar = actText[i];
if ((wChar > 0x80 && wChar < 0xFFFD) || (wChar <= 0x80 && isprint(wChar))) {
bExist = true;
break;
@@ -889,7 +888,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
matrix.Concat(Obj.m_formMatrix);
for (FX_STRSIZE k = 0; k < nItems; k++) {
- wchar_t wChar = actText.GetAt(k);
+ wchar_t wChar = actText[k];
if (wChar <= 0x80 && !isprint(wChar))
wChar = 0x20;
if (wChar >= 0xFFFD)
@@ -1005,12 +1004,12 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += (wchar_t)item.m_CharCode;
- wchar_t curChar = wstrItem.GetAt(0);
+ wchar_t curChar = wstrItem[0];
if (curChar == 0x2D || curChar == 0xAD)
return;
}
while (m_TempTextBuf.GetSize() > 0 &&
- m_TempTextBuf.AsStringC().GetAt(m_TempTextBuf.GetLength() - 1) ==
+ m_TempTextBuf.AsStringC()[m_TempTextBuf.GetLength() - 1] ==
0x20) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1053,7 +1052,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CFX_WideString str = m_TempTextBuf.MakeString();
if (str.IsEmpty())
str = m_TextBuf.AsStringC();
- if (str.IsEmpty() || str.GetAt(str.GetLength() - 1) == TEXT_SPACE_CHAR)
+ if (str.IsEmpty() || str[str.GetLength() - 1] == TEXT_SPACE_CHAR)
continue;
float fontsize_h = pTextObj->m_TextState.GetFontSizeH();
@@ -1164,7 +1163,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
}
if (!bDel) {
for (int nIndex = 0; nIndex < nTotal; nIndex++) {
- charinfo.m_Unicode = wstrItem.GetAt(nIndex);
+ charinfo.m_Unicode = wstrItem[nIndex];
if (charinfo.m_Unicode) {
charinfo.m_Index = m_TextBuf.GetLength();
m_TempTextBuf.AppendChar(charinfo.m_Unicode);
@@ -1175,8 +1174,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
}
} else if (i == 0) {
CFX_WideString str = m_TempTextBuf.MakeString();
- if (!str.IsEmpty() &&
- str.GetAt(str.GetLength() - 1) == TEXT_SPACE_CHAR) {
+ if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
}
@@ -1225,12 +1223,12 @@ bool CPDF_TextPage::IsHyphen(wchar_t curChar) {
if (nCount < 1)
return false;
int nIndex = nCount - 1;
- wchar_t wcTmp = strCurText.GetAt(nIndex);
+ wchar_t wcTmp = strCurText[nIndex];
while (wcTmp == 0x20 && nIndex > 0 && nIndex <= nCount - 1)
- wcTmp = strCurText.GetAt(--nIndex);
+ wcTmp = strCurText[--nIndex];
if (0x2D == wcTmp || 0xAD == wcTmp) {
if (--nIndex > 0) {
- wchar_t preChar = strCurText.GetAt((nIndex));
+ wchar_t preChar = strCurText[nIndex];
if (FXSYS_iswalpha(preChar) && FXSYS_iswalpha(curChar))
return true;
}
@@ -1268,7 +1266,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += static_cast<wchar_t>(item.m_CharCode);
- wchar_t curChar = wstrItem.GetAt(0);
+ wchar_t curChar = wstrItem[0];
if (WritingMode == TextOrientation::Horizontal) {
if (this_rect.Height() > 4.5 && prev_rect.Height() > 4.5) {
float top = this_rect.top < prev_rect.top ? this_rect.top : prev_rect.top;
@@ -1357,7 +1355,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
if (PrevStr.IsEmpty())
return GenerateCharacter::None;
- wchar_t preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
+ wchar_t preChar = PrevStr[PrevStr.GetLength() - 1];
CFX_Matrix matrix = pObj->GetTextMatrix();
matrix.Concat(formMatrix);
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 3c8e532a7f..55f940cad7 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -110,7 +110,7 @@ bool CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
m_csFindWhatArray.clear();
int i = 0;
while (i < len) {
- if (findwhatStr.GetAt(i) != ' ')
+ if (findwhatStr[i] != ' ')
break;
i++;
}
@@ -150,7 +150,7 @@ bool CPDF_TextPageFind::FindNext() {
CFX_WideString csWord = m_csFindWhatArray[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
- wchar_t strInsert = m_strText.GetAt(nStartPos);
+ wchar_t strInsert = m_strText[nStartPos];
if (strInsert == TEXT_LINEFEED_CHAR || strInsert == TEXT_SPACE_CHAR ||
strInsert == TEXT_RETURN_CHAR || strInsert == 160) {
nResultPos = nStartPos + 1;
@@ -174,16 +174,16 @@ bool CPDF_TextPageFind::FindNext() {
bool bMatch = true;
if (iWord != 0 && !bSpaceStart) {
int PreResEndPos = nStartPos;
- int curChar = csWord.GetAt(0);
+ int curChar = csWord[0];
CFX_WideString lastWord = m_csFindWhatArray[iWord - 1];
- int lastChar = lastWord.GetAt(lastWord.GetLength() - 1);
+ int lastChar = lastWord[lastWord.GetLength() - 1];
if (nStartPos == nResultPos &&
!(IsIgnoreSpaceCharacter(lastChar) ||
IsIgnoreSpaceCharacter(curChar))) {
bMatch = false;
}
for (int d = PreResEndPos; d < nResultPos; d++) {
- wchar_t strInsert = m_strText.GetAt(d);
+ wchar_t strInsert = m_strText[d];
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -192,7 +192,7 @@ bool CPDF_TextPageFind::FindNext() {
}
} else if (bSpaceStart) {
if (nResultPos > 0) {
- wchar_t strInsert = m_strText.GetAt(nResultPos - 1);
+ wchar_t strInsert = m_strText[nResultPos - 1];
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -293,7 +293,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
int pos = 0;
while (pos < csWord.GetLength()) {
CFX_WideString curStr = csWord.Mid(pos, 1);
- wchar_t curChar = csWord.GetAt(pos);
+ wchar_t curChar = csWord[pos];
if (IsIgnoreSpaceCharacter(curChar)) {
if (pos > 0 && curChar == 0x2019) {
pos++;
@@ -326,12 +326,12 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
int char_count = endPos - startPos + 1;
if (char_count < 1)
return false;
- if (char_count == 1 && csPageText.GetAt(startPos) > 255)
+ if (char_count == 1 && csPageText[startPos] > 255)
return true;
if (startPos - 1 >= 0)
- char_left = csPageText.GetAt(startPos - 1);
+ char_left = csPageText[startPos - 1];
if (startPos + char_count < csPageText.GetLength())
- char_right = csPageText.GetAt(startPos + char_count);
+ char_right = csPageText[startPos + char_count];
if ((char_left > 'A' && char_left < 'a') ||
(char_left > 'a' && char_left < 'z') ||
(char_left > 0xfb00 && char_left < 0xfb06) || std::iswdigit(char_left) ||
@@ -348,9 +348,9 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
return false;
}
if (char_count > 0) {
- if (std::iswdigit(char_left) && std::iswdigit(csPageText.GetAt(startPos)))
+ if (std::iswdigit(char_left) && std::iswdigit(csPageText[startPos]))
return false;
- if (std::iswdigit(char_right) && std::iswdigit(csPageText.GetAt(endPos)))
+ if (std::iswdigit(char_right) && std::iswdigit(csPageText[endPos]))
return false;
}
return true;
@@ -386,7 +386,7 @@ CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) {
str2.clear();
int nlen = str.GetLength();
for (int i = nlen - 1; i >= 0; i--)
- str2 += str.GetAt(i);
+ str2 += str[i];
return str2;
}