Convert string class names
Automated using git grep & sed.
Replace StringC classes with StringView classes.
Remove the CFX_ prefix and put string classes in fxcrt namespace.
Change AsStringC() to AsStringView().
Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*,
Foo).
Couple of tests needed to have their names regularlized.
BUG=pdfium:894
Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d
Reviewed-on: https://pdfium-review.googlesource.com/14151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index c3ab2b8..625ce46 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -68,7 +68,7 @@
}
void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontName) {
+ const ByteString& sFontName) {
ASSERT(pFont);
if (m_pDefaultFont)
@@ -83,7 +83,7 @@
AddFontData(m_pDefaultFont.Get(), m_sDefaultFontName, nCharset);
}
-CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
+CPDF_Font* CBA_FontMap::FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) {
if (m_pAnnotDict->GetStringFor("Subtype") != "Widget")
return nullptr;
@@ -109,7 +109,7 @@
}
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString* sFontAlias,
+ ByteString* sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
@@ -121,7 +121,7 @@
CPDF_Document* pDocument = GetDocument();
CPDF_Font* pFind = nullptr;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -145,13 +145,12 @@
return pFind;
}
-void CBA_FontMap::AddedFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias) {
+void CBA_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) {
AddFontToAnnotDict(pFont, sFontAlias);
}
void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
- const CFX_ByteString& sAlias) {
+ const ByteString& sAlias) {
if (!pFont)
return;
@@ -194,7 +193,7 @@
}
}
-CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
+CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(ByteString* sAlias) {
CPDF_Dictionary* pAcroFormDict = nullptr;
const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget");
if (bWidget) {
@@ -203,7 +202,7 @@
pAcroFormDict = pRootDict->GetDictFor("AcroForm");
}
- CFX_ByteString sDA;
+ ByteString sDA;
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pAnnotDict.Get(), "DA");
if (pObj)
sDA = pObj->GetString();
@@ -211,17 +210,17 @@
if (bWidget) {
if (sDA.IsEmpty()) {
pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
- sDA = pObj ? pObj->GetString() : CFX_ByteString();
+ sDA = pObj ? pObj->GetString() : ByteString();
}
}
if (sDA.IsEmpty())
return nullptr;
- CPDF_SimpleParser syntax(sDA.AsStringC());
+ CPDF_SimpleParser syntax(sDA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString sFontName(syntax.GetWord());
- CFX_ByteString sDecodedFontName = PDF_NameDecode(sFontName);
+ ByteString sFontName(syntax.GetWord());
+ ByteString sDecodedFontName = PDF_NameDecode(sFontName);
*sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1);
CPDF_Dictionary* pFontDict = nullptr;
@@ -243,7 +242,7 @@
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
-void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
+void CBA_FontMap::SetAPType(const ByteString& sAPType) {
m_sAPType = sAPType;
Reset();
diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h
index 7eb7d4e..807cb65 100644
--- a/fpdfsdk/formfiller/cba_fontmap.h
+++ b/fpdfsdk/formfiller/cba_fontmap.h
@@ -19,28 +19,28 @@
~CBA_FontMap() override;
void Reset();
- void SetDefaultFont(CPDF_Font* pFont, const CFX_ByteString& sFontName);
- void SetAPType(const CFX_ByteString& sAPType);
+ void SetDefaultFont(CPDF_Font* pFont, const ByteString& sFontName);
+ void SetAPType(const ByteString& sAPType);
private:
// CPWL_FontMap:
void Initialize() override;
CPDF_Document* GetDocument() override;
- CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
+ CPDF_Font* FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) override;
- void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) override;
+ void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) override;
CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString* sFontAlias,
+ ByteString* sFontAlias,
int32_t nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString* csNameTag);
- void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
+ CPDF_Font* GetAnnotDefaultFont(ByteString* csNameTag);
+ void AddFontToAnnotDict(CPDF_Font* pFont, const ByteString& sAlias);
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pAnnotDict;
CFX_UnownedPtr<CPDF_Font> m_pDefaultFont;
- CFX_ByteString m_sDefaultFontName;
- CFX_ByteString m_sAPType;
+ ByteString m_sDefaultFontName;
+ ByteString m_sAPType;
};
#endif // FPDFSDK_FORMFILLER_CBA_FONTMAP_H_
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index aeb31f5..ab34a65 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -52,7 +52,7 @@
pWnd->SetFillerNotify(pFormFiller);
int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
- CFX_WideString swText;
+ WideString swText;
if (nCurSel < 0)
swText = m_pWidget->GetValue();
else
@@ -94,7 +94,7 @@
if (!pWnd)
return;
- CFX_WideString swText = pWnd->GetText();
+ WideString swText = pWnd->GetText();
int32_t nCurSel = pWnd->GetSelect();
bool bSetValue = false;
@@ -235,15 +235,15 @@
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
+ WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.UTF16LE_Encode();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
-CFX_WideString CFFL_ComboBox::GetSelectExportText() {
- CFX_WideString swRet;
+WideString CFFL_ComboBox::GetSelectExportText() {
+ WideString swRet;
int nExport = -1;
CPDFSDK_PageView* pPageView = GetCurPageView(true);
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index dc8441d..bdc0934 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -16,7 +16,7 @@
int nIndex;
int nStart;
int nEnd;
- CFX_WideString sValue;
+ WideString sValue;
};
class CFFL_ComboBox : public CFFL_TextObject,
@@ -50,7 +50,7 @@
void OnSetFocus(CPWL_Edit* pEdit) override;
private:
- CFX_WideString GetSelectExportText();
+ WideString GetSelectExportText();
FFL_ComboBoxState m_State;
};
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index fd569c7..2c6138b 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -233,19 +233,19 @@
return pWnd && pWnd->OnChar(nChar, nFlags);
}
-CFX_WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
if (!IsValid())
- return CFX_WideString();
+ return WideString();
CPDFSDK_PageView* pPageView = GetCurPageView(true);
ASSERT(pPageView);
CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false);
- return pWnd ? pWnd->GetSelectedText() : CFX_WideString();
+ return pWnd ? pWnd->GetSelectedText() : WideString();
}
void CFFL_FormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
if (!IsValid())
return;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h
index e9c2c55..8078d35 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -75,8 +75,8 @@
uint32_t nFlags);
virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
- void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text);
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 989539f..3625e9d 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -516,15 +516,14 @@
UnRegisterFormFiller(pAnnot);
}
-CFX_WideString CFFL_InteractiveFormFiller::GetSelectedText(
- CPDFSDK_Annot* pAnnot) {
+WideString CFFL_InteractiveFormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
- return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : CFX_WideString();
+ return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : WideString();
}
void CFFL_InteractiveFormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
if (!pFormFiller)
@@ -690,8 +689,7 @@
CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm();
bool bFormatted = false;
- CFX_WideString sValue =
- pInterForm->OnFormat(pWidget->GetFormField(), bFormatted);
+ WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormatted);
if (!(*pAnnot))
return;
@@ -857,8 +855,8 @@
std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
CPWL_Wnd::PrivateData* pAttached,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ WideString& strChange,
+ const WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 0982f1d..553cbe8 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -83,8 +83,8 @@
CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister);
void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
- void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text);
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
static bool IsVisible(CPDFSDK_Widget* pWidget);
static bool IsReadOnly(CPDFSDK_Widget* pWidget);
@@ -133,8 +133,8 @@
float* fPopupRet) override;
// Returns {bRC, bExit}.
std::pair<bool, bool> OnBeforeKeyStroke(CPWL_Wnd::PrivateData* pAttached,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ WideString& strChange,
+ const WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 8bf0825..76434a5 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -74,7 +74,7 @@
pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller());
int32_t nMaxLen = m_pWidget->GetMaxLen();
- CFX_WideString swValue = m_pWidget->GetValue();
+ WideString swValue = m_pWidget->GetValue();
if (nMaxLen > 0) {
if (pWnd->HasFlag(PES_CHARARRAY)) {
@@ -136,8 +136,8 @@
if (!pWnd)
return;
- CFX_WideString sOldValue = m_pWidget->GetValue();
- CFX_WideString sNewValue = pWnd->GetText();
+ WideString sOldValue = m_pWidget->GetValue();
+ WideString sNewValue = pWnd->GetText();
m_pWidget->SetValue(sNewValue, false);
m_pWidget->ResetFieldAppearance(true);
@@ -239,9 +239,9 @@
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
+ WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.UTF16LE_Encode();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index 2a99413..49ffc0f 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -21,7 +21,7 @@
int nStart;
int nEnd;
- CFX_WideString sValue;
+ WideString sValue;
};
class CFFL_TextField : public CFFL_TextObject,