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/BUILD.gn b/BUILD.gn
index b4b93b5..8606748 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -803,13 +803,13 @@
static_library("fxcrt") {
sources = [
+ "core/fxcrt/bytestring.cpp",
+ "core/fxcrt/bytestring.h",
"core/fxcrt/cfx_autorestorer.h",
"core/fxcrt/cfx_binarybuf.cpp",
"core/fxcrt/cfx_binarybuf.h",
"core/fxcrt/cfx_bitstream.cpp",
"core/fxcrt/cfx_bitstream.h",
- "core/fxcrt/cfx_bytestring.cpp",
- "core/fxcrt/cfx_bytestring.h",
"core/fxcrt/cfx_datetime.cpp",
"core/fxcrt/cfx_datetime.h",
"core/fxcrt/cfx_fileaccess_posix.cpp",
@@ -823,15 +823,12 @@
"core/fxcrt/cfx_observable.h",
"core/fxcrt/cfx_retain_ptr.h",
"core/fxcrt/cfx_shared_copy_on_write.h",
- "core/fxcrt/cfx_string_c_template.h",
"core/fxcrt/cfx_string_data_template.h",
"core/fxcrt/cfx_string_pool_template.h",
"core/fxcrt/cfx_unowned_ptr.h",
"core/fxcrt/cfx_utf8decoder.cpp",
"core/fxcrt/cfx_utf8decoder.h",
"core/fxcrt/cfx_weak_ptr.h",
- "core/fxcrt/cfx_widestring.cpp",
- "core/fxcrt/cfx_widestring.h",
"core/fxcrt/cfx_widetextbuf.cpp",
"core/fxcrt/cfx_widetextbuf.h",
"core/fxcrt/fx_bidi.cpp",
@@ -858,6 +855,9 @@
"core/fxcrt/fx_unicode.h",
"core/fxcrt/ifx_fileaccess.h",
"core/fxcrt/ifx_pauseindicator.h",
+ "core/fxcrt/string_view_template.h",
+ "core/fxcrt/widestring.cpp",
+ "core/fxcrt/widestring.h",
"core/fxcrt/xml/cxml_attritem.cpp",
"core/fxcrt/xml/cxml_attritem.h",
"core/fxcrt/xml/cxml_attrmap.cpp",
@@ -1917,7 +1917,7 @@
"core/fxcodec/codec/fx_codec_rle_unittest.cpp",
"core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp",
"core/fxcodec/jbig2/JBig2_Image_unittest.cpp",
- "core/fxcrt/cfx_bytestring_unittest.cpp",
+ "core/fxcrt/bytestring_unittest.cpp",
"core/fxcrt/cfx_maybe_owned_unittest.cpp",
"core/fxcrt/cfx_observable_unittest.cpp",
"core/fxcrt/cfx_retain_ptr_unittest.cpp",
@@ -1925,7 +1925,6 @@
"core/fxcrt/cfx_string_pool_template_unittest.cpp",
"core/fxcrt/cfx_unowned_ptr_unittest.cpp",
"core/fxcrt/cfx_weak_ptr_unittest.cpp",
- "core/fxcrt/cfx_widestring_unittest.cpp",
"core/fxcrt/fx_bidi_unittest.cpp",
"core/fxcrt/fx_coordinates_unittest.cpp",
"core/fxcrt/fx_extension_unittest.cpp",
@@ -1933,6 +1932,7 @@
"core/fxcrt/fx_random_unittest.cpp",
"core/fxcrt/fx_string_unittest.cpp",
"core/fxcrt/fx_system_unittest.cpp",
+ "core/fxcrt/widestring_unittest.cpp",
"core/fxge/dib/cstretchengine_unittest.cpp",
"fpdfsdk/fpdfdoc_unittest.cpp",
"fpdfsdk/fpdfeditimg_unittest.cpp",
diff --git a/core/fpdfapi/cmaps/cmap_int.h b/core/fpdfapi/cmaps/cmap_int.h
index e84dc11..e661792 100644
--- a/core/fpdfapi/cmaps/cmap_int.h
+++ b/core/fpdfapi/cmaps/cmap_int.h
@@ -23,7 +23,7 @@
int m_UseOffset;
};
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& name,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& name,
int charset,
int coding,
const FXCMAP_CMap*& pMap);
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index 80ebbde..01c8da9 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -53,7 +53,7 @@
}; // extern "C"
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& bsName,
int charset,
int coding,
const FXCMAP_CMap*& pMap) {
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 38a21ba..c3143b5 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -33,7 +33,7 @@
bool WriteBlock(const void* pBuf, size_t size) override;
bool WriteByte(uint8_t byte) override;
bool WriteDWord(uint32_t i) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
FX_FILESIZE CurrentOffset() const override { return offset_; }
@@ -105,7 +105,7 @@
return WriteBlock(buf, static_cast<size_t>(FXSYS_strlen(buf)));
}
-bool CFX_FileBufferArchive::WriteString(const CFX_ByteStringC& str) {
+bool CFX_FileBufferArchive::WriteString(const ByteStringView& str) {
return WriteBlock(str.raw_str(), str.GetLength());
}
@@ -220,7 +220,7 @@
break;
case CPDF_Object::STRING: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
bool bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
if (!pObj->WriteTo(m_Archive.get()))
@@ -229,9 +229,9 @@
}
CPDF_Encryptor encryptor(m_pCryptoHandler.Get(), objnum,
(uint8_t*)str.c_str(), str.GetLength());
- CFX_ByteString content = PDF_EncodeString(
- CFX_ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
- if (!m_Archive->WriteString(content.AsStringC()))
+ ByteString content = PDF_EncodeString(
+ ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
+ if (!m_Archive->WriteString(content.AsStringView()))
return false;
break;
}
@@ -290,10 +290,10 @@
bool bSignDict = p->IsSignatureDict();
for (const auto& it : *p) {
bool bSignValue = false;
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!m_Archive->WriteString("/") ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
@@ -521,11 +521,11 @@
m_XrefStart = m_Archive->CurrentOffset();
if (!IsIncremental() || !m_pParser->IsXRefStream()) {
if (!IsIncremental() || m_pParser->GetLastXRefOffset() == 0) {
- CFX_ByteString str;
+ ByteString str;
str = pdfium::ContainsKey(m_ObjectOffsets, 1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (!m_Archive->WriteString(str.AsStringC()))
+ if (!m_Archive->WriteString(str.AsStringView()))
return -1;
m_CurObjNum = 1;
@@ -542,7 +542,7 @@
}
}
if (m_iStage == 81) {
- CFX_ByteString str;
+ ByteString str;
uint32_t i = m_CurObjNum;
uint32_t j;
while (i <= dwLastObjNum) {
@@ -575,7 +575,7 @@
m_iStage = 90;
}
if (m_iStage == 82) {
- CFX_ByteString str;
+ ByteString str;
uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
uint32_t i = m_CurObjNum;
while (i < iCount) {
@@ -627,7 +627,7 @@
if (m_pParser) {
CPDF_Dictionary* p = m_pParser->GetTrailer();
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (key == "Encrypt" || key == "Size" || key == "Filter" ||
key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
@@ -635,7 +635,7 @@
continue;
}
if (!m_Archive->WriteString(("/")) ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return -1;
}
if (!pValue->IsInline()) {
@@ -782,7 +782,7 @@
} else {
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
}
}
@@ -795,7 +795,7 @@
}
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
return;
}
@@ -803,7 +803,7 @@
m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
if (m_pEncryptDict && !pOldIDArray && m_pParser && !idArrayPreExisting) {
if (m_pEncryptDict->GetStringFor("Filter") == "Standard") {
- CFX_ByteString user_pass = m_pParser->GetPassword();
+ ByteString user_pass = m_pParser->GetPassword();
uint32_t flag = PDF_ENCRYPT_CONTENT;
CPDF_SecurityHandler handler;
handler.OnCreate(m_pEncryptDict.Get(), m_pIDArray.get(),
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 9153bf4..c0c6604 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -121,9 +121,9 @@
pStream->GetObjNum());
}
-CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
+ByteString CPDF_PageContentGenerator::RealizeResource(
uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType) {
+ const ByteString& bsType) {
ASSERT(dwResourceObjNum);
if (!m_pObjHolder->m_pResources) {
m_pObjHolder->m_pResources = m_pDocument->NewIndirect<CPDF_Dictionary>();
@@ -135,7 +135,7 @@
if (!pResList)
pResList = m_pObjHolder->m_pResources->SetNewFor<CPDF_Dictionary>(bsType);
- CFX_ByteString name;
+ ByteString name;
int idnum = 1;
while (1) {
name.Format("FX%c%d", bsType[0], idnum);
@@ -188,7 +188,7 @@
pImage->ConvertStreamToIndirectObject();
uint32_t dwObjNum = pStream->GetObjNum();
- CFX_ByteString name = RealizeResource(dwObjNum, "XObject");
+ ByteString name = RealizeResource(dwObjNum, "XObject");
if (bWasInline)
pImageObj->SetImage(m_pDocument->GetPageData()->GetImage(dwObjNum));
@@ -295,7 +295,7 @@
return;
}
- CFX_ByteString name;
+ ByteString name;
auto it = m_pObjHolder->m_GraphicsMap.find(graphD);
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
@@ -330,7 +330,7 @@
defaultGraphics.strokeAlpha = 1.0f;
defaultGraphics.blendType = FXDIB_BLEND_NORMAL;
auto it = m_pObjHolder->m_GraphicsMap.find(defaultGraphics);
- CFX_ByteString name;
+ ByteString name;
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
} else {
@@ -368,7 +368,7 @@
return;
fontD.baseFont = pFont->GetBaseFont();
auto it = m_pObjHolder->m_FontsMap.find(fontD);
- CFX_ByteString dictName;
+ ByteString dictName;
if (it != m_pObjHolder->m_FontsMap.end()) {
dictName = it->second;
} else {
@@ -387,7 +387,7 @@
}
*buf << "/" << PDF_NameEncode(dictName) << " " << pTextObj->GetFontSize()
<< " Tf ";
- CFX_ByteString text;
+ ByteString text;
for (uint32_t charcode : pTextObj->m_CharCodes) {
if (charcode != CPDF_Font::kInvalidCharCode)
pFont->AppendChar(&text, charcode);
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 518d358..433ad33 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -37,8 +37,8 @@
void ProcessGraphics(std::ostringstream* buf, CPDF_PageObject* pPageObj);
void ProcessDefaultGraphics(std::ostringstream* buf);
void ProcessText(std::ostringstream* buf, CPDF_TextObject* pTextObj);
- CFX_ByteString RealizeResource(uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType);
+ ByteString RealizeResource(uint32_t dwResourceObjNum,
+ const ByteString& bsType);
CFX_UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 1dd6d25..a0db869 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -36,8 +36,8 @@
}
CPDF_Dictionary* TestGetResource(CPDF_PageContentGenerator* pGen,
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+ const ByteString& type,
+ const ByteString& name) {
return pGen->m_pObjHolder->m_pResources->GetDictFor(type)->GetDictFor(name);
}
@@ -58,7 +58,7 @@
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf));
pPathObj = pdfium::MakeUnique<CPDF_PathObject>();
pPathObj->m_Path.AppendPoint(CFX_PointF(0, 0), FXPT_TYPE::MoveTo, false);
@@ -71,7 +71,7 @@
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
@@ -105,7 +105,7 @@
EXPECT_EQ(
"q 1 0 0 1 0 0 cm 3.102 4.67 m 5.45 0.29 l 4.24 3.15 4.65 2.98 3.456 0.24"
" c 10.6 11.15 l 11 12.5 l 11.46 12.67 11.84 12.96 12 13.64 c h f Q\n",
- CFX_ByteString(buf));
+ ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
@@ -132,7 +132,7 @@
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString(buf);
+ ByteString pathString(buf);
// Color RGB values used are integers divided by 255.
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /",
@@ -150,7 +150,7 @@
pPathObj->m_GraphState.SetLineWidth(10.5f);
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString2(buf);
+ ByteString pathString2(buf);
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG 10.5 w /",
pathString2.Left(55));
EXPECT_EQ(" gs 1 0 0 1 0 0 cm 1 2 m 3 4 l 5 6 l h B Q\n",
@@ -185,25 +185,25 @@
pTextObj->SetText("Hello World");
std::ostringstream buf;
TestProcessText(&generator, &buf, pTextObj.get());
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
auto secondResourceAt = textString.ReverseFind('/');
ASSERT_TRUE(secondResourceAt.has_value());
secondResourceAt = secondResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString midString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString midString =
textString.Mid(firstResourceAt.value(),
secondResourceAt.value() - firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString lastString =
textString.Right(textString.GetLength() - secondResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 =
+ ByteString compareString1 =
"q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /";
// Color RGB values used are integers divided by 255.
- CFX_ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
- CFX_ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
+ ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
+ ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength() +
compareString3.GetLength(),
textString.GetLength());
@@ -257,17 +257,16 @@
TestProcessText(&generator, &buf, pTextObj.get());
}
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString lastString =
textString.Right(textString.GetLength() - firstResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
- CFX_ByteString compareString2 =
- " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
+ ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
+ ByteString compareString2 = " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength(),
textString.GetLength());
EXPECT_EQ(compareString1, textString.Left(compareString1.GetLength()));
@@ -305,7 +304,7 @@
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream buf;
generator.ProcessPageObjects(&buf);
- EXPECT_EQ("", CFX_ByteString(buf));
+ EXPECT_EQ("", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
@@ -330,5 +329,5 @@
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream process_buf;
generator.ProcessPageObjects(&process_buf);
- EXPECT_EQ(content, CFX_ByteString(process_buf));
+ EXPECT_EQ(content, ByteString(process_buf));
}
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index a67abd2..9b326f5 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -239,12 +239,12 @@
return m_pCMap && m_pCMap->IsVertWriting();
}
-CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
wchar_t ret = GetUnicodeFromCharCode(charcode);
- return ret ? ret : CFX_WideString();
+ return ret ? ret : WideString();
}
wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
@@ -356,12 +356,12 @@
if (!pEncoding)
return false;
- CFX_ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
+ ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
m_bType1 = (subtype == "CIDFontType0");
CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager;
if (pEncoding->IsName()) {
- CFX_ByteString cmap = pEncoding->GetString();
+ ByteString cmap = pEncoding->GetString();
bool bPromptCJK = m_pFontFile && m_bType1;
m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK);
if (!m_pCMap)
@@ -380,7 +380,7 @@
CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo");
if (pCIDInfo) {
m_Charset = CPDF_CMapParser::CharsetFromOrdering(
- pCIDInfo->GetStringFor("Ordering").AsStringC());
+ pCIDInfo->GetStringFor("Ordering").AsStringView());
}
}
if (m_Charset != CIDSET_UNKNOWN) {
@@ -621,7 +621,7 @@
if (m_Flags & FXFONT_SYMBOLIC)
return cid;
- CFX_WideString uni_str = UnicodeFromCharCode(charcode);
+ WideString uni_str = UnicodeFromCharCode(charcode);
if (uni_str.IsEmpty())
return cid;
@@ -633,7 +633,7 @@
if (unicode == 0)
unicode = GetUnicodeFromCharCode(charcode);
if (unicode == 0) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (!unicode_str.IsEmpty())
unicode = unicode_str[0];
}
@@ -651,8 +651,8 @@
iBaseEncoding = PDFFONT_ENCODING_WINANSI;
else if (bMacRoman)
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
- const char* name = GetAdobeCharName(
- iBaseEncoding, std::vector<CFX_ByteString>(), charcode);
+ const char* name =
+ GetAdobeCharName(iBaseEncoding, std::vector<ByteString>(), charcode);
if (!name)
return charcode ? static_cast<int>(charcode) : -1;
@@ -729,7 +729,7 @@
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.GetFace())) ==
FXFT_ENCODING_UNICODE) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (unicode_str.IsEmpty())
return -1;
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 07982a4..f4ddcfd 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -54,7 +54,7 @@
bool IsVertWriting() const override;
bool IsUnicodeCompatible() const override;
bool Load() override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
uint16_t CIDFromCharCode(uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 0d3745e..54f7b34 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -248,7 +248,7 @@
CPDF_CMap::~CPDF_CMap() {}
void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& bsName,
+ const ByteString& bsName,
bool bPromptCJK) {
m_PredefinedCMap = bsName;
if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
@@ -257,14 +257,14 @@
m_bLoaded = true;
return;
}
- CFX_ByteString cmapid = m_PredefinedCMap;
+ ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Last() == 'V';
if (cmapid.GetLength() > 2) {
cmapid = cmapid.Left(cmapid.GetLength() - 2);
}
const PredefinedCMap* map = nullptr;
for (size_t i = 0; i < FX_ArraySize(g_PredefinedCMaps); ++i) {
- if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[i].m_pName)) {
+ if (cmapid == ByteStringView(g_PredefinedCMaps[i].m_pName)) {
map = &g_PredefinedCMaps[i];
break;
}
@@ -295,7 +295,7 @@
CPDF_CMapParser parser(this);
CPDF_SimpleParser syntax(pData, size);
while (1) {
- CFX_ByteStringC word = syntax.GetWord();
+ ByteStringView word = syntax.GetWord();
if (word.IsEmpty()) {
break;
}
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index f4d6ca9..3e23d03 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -51,7 +51,7 @@
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
void LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK);
void LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
@@ -70,7 +70,7 @@
CPDF_CMap();
~CPDF_CMap() override;
- CFX_ByteString m_PredefinedCMap;
+ ByteString m_PredefinedCMap;
bool m_bLoaded;
bool m_bVertical;
CIDSet m_Charset;
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 040af55..a449db6 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -17,7 +17,7 @@
CPDF_CMapManager::~CPDF_CMapManager() {}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end())
@@ -31,7 +31,7 @@
}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
const char* pname = name.c_str();
if (*pname == '/')
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h
index 1bc1c6f..6a860e6 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -11,7 +11,7 @@
#include <memory>
#include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/cfx_retain_ptr.h"
class CPDF_CMapManager {
@@ -19,17 +19,17 @@
CPDF_CMapManager();
~CPDF_CMapManager();
- CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
bool bPromptCJK);
CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
bool bPromptCJK);
std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
bool bPromptCJK);
- std::map<CFX_ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
+ std::map<ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
};
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 101ae5f..f7d4dc1 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -32,9 +32,9 @@
return static_cast<CIDSet>(index);
}
-CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) {
+ByteStringView CMap_GetString(const ByteStringView& word) {
if (word.GetLength() <= 2)
- return CFX_ByteStringC();
+ return ByteStringView();
return word.Right(word.GetLength() - 2);
}
@@ -45,7 +45,7 @@
CPDF_CMapParser::~CPDF_CMapParser() {}
-void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
+void CPDF_CMapParser::ParseWord(const ByteStringView& word) {
if (word.IsEmpty()) {
return;
}
@@ -126,7 +126,7 @@
}
if (m_CodeSeq % 2) {
CPDF_CMap::CodeRange range;
- if (CMap_GetCodeRange(range, m_LastWord.AsStringC(), word))
+ if (CMap_GetCodeRange(range, m_LastWord.AsStringView(), word))
m_CodeRanges.push_back(range);
}
m_CodeSeq++;
@@ -136,7 +136,7 @@
}
// Static.
-uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
+uint32_t CPDF_CMapParser::CMap_GetCode(const ByteStringView& word) {
if (word.IsEmpty())
return 0;
pdfium::base::CheckedNumeric<uint32_t> num = 0;
@@ -160,8 +160,8 @@
// Static.
bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second) {
+ const ByteStringView& first,
+ const ByteStringView& second) {
if (first.GetLength() == 0 || first[0] != '<')
return false;
@@ -193,7 +193,7 @@
}
// static
-CIDSet CPDF_CMapParser::CharsetFromOrdering(const CFX_ByteStringC& ordering) {
+CIDSet CPDF_CMapParser::CharsetFromOrdering(const ByteStringView& ordering) {
for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) {
if (ordering == g_CharsetNames[charset])
return CIDSetFromSizeT(charset);
diff --git a/core/fpdfapi/font/cpdf_cmapparser.h b/core/fpdfapi/font/cpdf_cmapparser.h
index b0a0ced..b3c8326 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.h
+++ b/core/fpdfapi/font/cpdf_cmapparser.h
@@ -20,7 +20,7 @@
explicit CPDF_CMapParser(CPDF_CMap* pMap);
~CPDF_CMapParser();
- void ParseWord(const CFX_ByteStringC& str);
+ void ParseWord(const ByteStringView& str);
bool HasAdditionalMappings() const {
return !m_AdditionalCharcodeToCIDMappings.empty();
}
@@ -28,16 +28,16 @@
return std::move(m_AdditionalCharcodeToCIDMappings);
}
- static CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering);
+ static CIDSet CharsetFromOrdering(const ByteStringView& ordering);
private:
friend class cpdf_cmapparser_CMap_GetCode_Test;
friend class cpdf_cmapparser_CMap_GetCodeRange_Test;
- static uint32_t CMap_GetCode(const CFX_ByteStringC& word);
+ static uint32_t CMap_GetCode(const ByteStringView& word);
static bool CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second);
+ const ByteStringView& first,
+ const ByteStringView& second);
CFX_UnownedPtr<CPDF_CMap> const m_pCMap;
int m_Status;
@@ -45,7 +45,7 @@
uint32_t m_CodePoints[4];
std::vector<CPDF_CMap::CodeRange> m_CodeRanges;
std::vector<CPDF_CMap::CIDRange> m_AdditionalCharcodeToCIDMappings;
- CFX_ByteString m_LastWord;
+ ByteString m_LastWord;
};
#endif // CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 0fd8b45..9aaaa27 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -37,7 +37,7 @@
{0xB7, 0xC2, 0xCB, 0xCE, 0x00},
{0xD0, 0xC2, 0xCB, 0xCE, 0x00}};
-void GetPredefinedEncoding(const CFX_ByteString& value, int* basemap) {
+void GetPredefinedEncoding(const ByteString& value, int* basemap) {
if (value == "WinAnsiEncoding")
*basemap = PDFFONT_ENCODING_WINANSI;
else if (value == "MacRomanEncoding")
@@ -140,17 +140,17 @@
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const {
+void CPDF_Font::AppendChar(ByteString* str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
- *str += CFX_ByteStringC(buf, len);
+ *str += ByteStringView(buf, len);
}
-CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
+WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
if (!m_bToUnicodeLoaded)
LoadUnicodeMap();
- return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString();
+ return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : WideString();
}
uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
@@ -297,8 +297,8 @@
// static
CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& name) {
- CFX_ByteString fontname(name);
+ const ByteStringView& name) {
+ ByteString fontname(name);
int font_id = PDF_GetStandardFontName(&fontname);
if (font_id < 0)
return nullptr;
@@ -319,12 +319,12 @@
std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict) {
- CFX_ByteString type = pFontDict->GetStringFor("Subtype");
+ ByteString type = pFontDict->GetStringFor("Subtype");
std::unique_ptr<CPDF_Font> pFont;
if (type == "TrueType") {
- CFX_ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
+ ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
for (size_t i = 0; i < FX_ArraySize(kChineseFontNames); ++i) {
- if (tag == CFX_ByteString(kChineseFontNames[i], 4)) {
+ if (tag == ByteString(kChineseFontNames[i], 4)) {
CPDF_Dictionary* pFontDesc = pFontDict->GetDictFor("FontDescriptor");
if (!pFontDesc || !pFontDesc->KeyExist("FontFile2"))
pFont = pdfium::MakeUnique<CPDF_CIDFont>();
@@ -358,7 +358,7 @@
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType) {
if (!pEncoding) {
@@ -380,7 +380,7 @@
iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
return;
}
- CFX_ByteString bsEncoding = pEncoding->GetString();
+ ByteString bsEncoding = pEncoding->GetString();
if (bsEncoding.Compare("MacExpertEncoding") == 0) {
bsEncoding = "WinAnsiEncoding";
}
@@ -394,7 +394,7 @@
if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- CFX_ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
+ ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) {
bsEncoding = "WinAnsiEncoding";
}
@@ -436,7 +436,7 @@
const char* CPDF_Font::GetAdobeCharName(
int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode) {
if (charcode < 0 || charcode >= 256) {
NOTREACHED();
@@ -466,7 +466,7 @@
if (!pdfium::IndexInBounds(m_FontFallbacks, fallbackFont))
return -1;
- CFX_WideString str = UnicodeFromCharCode(charcode);
+ WideString str = UnicodeFromCharCode(charcode);
uint32_t unicode = !str.IsEmpty() ? str[0] : charcode;
int glyph =
FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index f705422..e92e2f2 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -32,7 +32,7 @@
static std::unique_ptr<CPDF_Font> Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict);
static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& fontname);
+ const ByteStringView& fontname);
static const uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
virtual ~CPDF_Font();
@@ -59,17 +59,17 @@
virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
virtual int GlyphFromCharCodeExt(uint32_t charcode);
- virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
+ virtual WideString UnicodeFromCharCode(uint32_t charcode) const;
virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
virtual bool HasFontWidths() const;
- const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
+ const ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString* str, uint32_t charcode) const;
+ void AppendChar(ByteString* str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
@@ -97,20 +97,20 @@
void LoadUnicodeMap() const; // logically const only.
void LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType);
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
const char* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode);
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_Font m_Font;
std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks;
- CFX_ByteString m_BaseFont;
+ ByteString m_BaseFont;
CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index 2cc6445..6290f20 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1672,7 +1672,7 @@
}
std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
- CFX_WeakPtr<CFX_ByteStringPool> pPool) {
+ CFX_WeakPtr<ByteStringPool> pPool) {
int predefined = 0;
for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS;
cs++) {
@@ -1761,10 +1761,10 @@
return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
}
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
char glyph_name[64];
FXFT_adobe_name_from_unicode(glyph_name, unicode);
- return CFX_ByteString(glyph_name);
+ return ByteString(glyph_name);
}
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) {
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h
index 7a94db9..075cc04 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/core/fpdfapi/font/cpdf_fontencoding.h
@@ -28,7 +28,7 @@
wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
wchar_t PDF_UnicodeFromAdobeName(const char* name);
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding);
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode);
@@ -53,7 +53,7 @@
m_Unicodes[charcode] = unicode;
}
- std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool);
+ std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<ByteStringPool> pPool);
public:
wchar_t m_Unicodes[256];
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 56a4b13..ccf514d 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -196,13 +196,13 @@
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
}
-CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
if (ret == 0)
- return CFX_WideString();
+ return WideString();
return ret;
}
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
index 6a22f46..5291211 100644
--- a/core/fpdfapi/font/cpdf_simplefont.h
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -24,7 +24,7 @@
FX_RECT GetCharBBox(uint32_t charcode) override;
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
bool IsUnicodeCompatible() const override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
@@ -41,7 +41,7 @@
CPDF_FontEncoding m_Encoding;
uint16_t m_GlyphIndex[256];
uint16_t m_ExtGID[256];
- std::vector<CFX_ByteString> m_CharNames;
+ std::vector<ByteString> m_CharNames;
int m_BaseEncoding;
uint16_t m_CharWidth[256];
FX_RECT m_CharBBox[256];
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index 9076f4a..354f506 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -14,7 +14,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/numerics/safe_conversions.h"
-CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
+WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
uint32_t value = it->second;
@@ -25,22 +25,22 @@
const wchar_t* buf = m_MultiCharBuf.GetBuffer();
uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
- return CFX_WideString();
+ return WideString();
}
uint32_t index = value >> 16;
if (index >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
uint32_t len = buf[index];
if (index + len < index || index + len >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
- return CFX_WideString(buf + index + 1, len);
+ return WideString(buf + index + 1, len);
}
if (m_pBaseMap) {
return m_pBaseMap->UnicodeFromCID((uint16_t)charcode);
}
- return CFX_WideString();
+ return WideString();
}
uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
@@ -52,7 +52,7 @@
}
// Static.
-uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
+uint32_t CPDF_ToUnicodeMap::StringToCode(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
return 0;
@@ -70,8 +70,8 @@
return result;
}
-static CFX_WideString StringDataAdd(CFX_WideString str) {
- CFX_WideString ret;
+static WideString StringDataAdd(WideString str) {
+ WideString ret;
int len = str.GetLength();
wchar_t value = 1;
for (int i = len - 1; i >= 0; --i) {
@@ -89,13 +89,12 @@
}
// Static.
-CFX_WideString CPDF_ToUnicodeMap::StringToWideString(
- const CFX_ByteStringC& str) {
+WideString CPDF_ToUnicodeMap::StringToWideString(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString result;
+ WideString result;
if (str[0] == '<') {
int byte_pos = 0;
wchar_t ch = 0;
@@ -129,7 +128,7 @@
pAcc->LoadAllData(false);
CPDF_SimpleParser parser(pAcc->GetData(), pAcc->GetSize());
while (1) {
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
if (word.IsEmpty()) {
break;
}
@@ -141,7 +140,7 @@
}
uint32_t srccode = StringToCode(word);
word = parser.GetWord();
- CFX_WideString destcode = StringToWideString(word);
+ WideString destcode = StringToWideString(word);
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -156,23 +155,23 @@
}
} else if (word == "beginbfrange") {
while (1) {
- CFX_ByteString low, high;
+ ByteString low, high;
low = parser.GetWord();
if (low.IsEmpty() || low == "endbfrange") {
break;
}
high = parser.GetWord();
- uint32_t lowcode = StringToCode(low.AsStringC());
+ uint32_t lowcode = StringToCode(low.AsStringView());
uint32_t highcode =
- (lowcode & 0xffffff00) | (StringToCode(high.AsStringC()) & 0xff);
+ (lowcode & 0xffffff00) | (StringToCode(high.AsStringView()) & 0xff);
if (highcode == (uint32_t)-1) {
break;
}
- CFX_ByteString start(parser.GetWord());
+ ByteString start(parser.GetWord());
if (start == "[") {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_ByteString dest(parser.GetWord());
- CFX_WideString destcode = StringToWideString(dest.AsStringC());
+ ByteString dest(parser.GetWord());
+ WideString destcode = StringToWideString(dest.AsStringView());
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -187,17 +186,17 @@
}
parser.GetWord();
} else {
- CFX_WideString destcode = StringToWideString(start.AsStringC());
+ WideString destcode = StringToWideString(start.AsStringView());
int len = destcode.GetLength();
uint32_t value = 0;
if (len == 1) {
- value = StringToCode(start.AsStringC());
+ value = StringToCode(start.AsStringView());
for (uint32_t code = lowcode; code <= highcode; code++) {
m_Map[code] = value++;
}
} else {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_WideString retcode;
+ WideString retcode;
if (code == lowcode) {
retcode = destcode;
} else {
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.h b/core/fpdfapi/font/cpdf_tounicodemap.h
index 90a2638..4e11140 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.h
+++ b/core/fpdfapi/font/cpdf_tounicodemap.h
@@ -22,15 +22,15 @@
void Load(CPDF_Stream* pStream);
- CFX_WideString Lookup(uint32_t charcode) const;
+ WideString Lookup(uint32_t charcode) const;
uint32_t ReverseLookup(wchar_t unicode) const;
private:
friend class cpdf_tounicodemap_StringToCode_Test;
friend class cpdf_tounicodemap_StringToWideString_Test;
- static uint32_t StringToCode(const CFX_ByteStringC& str);
- static CFX_WideString StringToWideString(const CFX_ByteStringC& str);
+ static uint32_t StringToCode(const ByteStringView& str);
+ static WideString StringToWideString(const ByteStringView& str);
uint32_t GetUnicode();
diff --git a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
index 299f4d9..4a5dc25 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
@@ -21,7 +21,7 @@
EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("<c2"));
- CFX_WideString res = L"\xc2ab";
+ WideString res = L"\xc2ab";
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2abab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab 1234"));
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index 5fde646..a0542ec 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -137,7 +137,7 @@
if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
continue;
- CFX_WideString wsUnicode = UnicodeFromCharCode(charcode);
+ WideString wsUnicode = UnicodeFromCharCode(charcode);
if (!wsUnicode.IsEmpty()) {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index cedc847..afc87a2 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -39,7 +39,7 @@
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser) {
for (const auto& it : *pGS) {
- const CFX_ByteString& key_str = it.first;
+ const ByteString& key_str = it.first;
CPDF_Object* pElement = it.second.get();
CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr;
if (!pObject)
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index aee7316..c37b5a4 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -198,7 +198,7 @@
CFX_UnownedPtr<CPDF_CountedColorSpace> m_pCountedBaseCS;
int m_nBaseComponents;
int m_MaxIndex;
- CFX_ByteString m_Table;
+ ByteString m_Table;
float* m_pCompMinMax;
};
@@ -364,8 +364,7 @@
} // namespace
-CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(
- const CFX_ByteString& name) {
+CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(const ByteString& name) {
if (name == "DeviceRGB" || name == "RGB")
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
if (name == "DeviceGray" || name == "G")
@@ -422,7 +421,7 @@
if (!pFamilyObj)
return nullptr;
- CFX_ByteString familyname = pFamilyObj->GetString();
+ ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1)
return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname));
@@ -1029,7 +1028,7 @@
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
pAcc->LoadAllData(false);
- m_Table = CFX_ByteStringC(pAcc->GetData(), pAcc->GetSize());
+ m_Table = ByteStringView(pAcc->GetData(), pAcc->GetSize());
}
return true;
}
@@ -1080,7 +1079,7 @@
bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc,
CPDF_Array* pArray,
std::set<CPDF_Object*>* pVisited) {
- CFX_ByteString name = pArray->GetStringAt(1);
+ ByteString name = pArray->GetStringAt(1);
if (name == "None") {
m_Type = None;
return true;
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index 31dd326..d9f9a1d 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -42,7 +42,7 @@
class CPDF_ColorSpace {
public:
static CPDF_ColorSpace* GetStockCS(int Family);
- static CPDF_ColorSpace* ColorspaceFromName(const CFX_ByteString& name);
+ static CPDF_ColorSpace* ColorspaceFromName(const ByteString& name);
static std::unique_ptr<CPDF_ColorSpace> Load(CPDF_Document* pDoc,
CPDF_Object* pCSObj);
static std::unique_ptr<CPDF_ColorSpace> Load(
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 07f0bd9..7d411b2 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -36,7 +36,7 @@
return pData ? pData->GetMCID() : -1;
}
-void CPDF_ContentMark::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
m_Ref.GetPrivateCopy()->AddMark(name, pDict, bDirect);
@@ -48,7 +48,7 @@
m_Ref.SetNull();
}
-bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
+bool CPDF_ContentMark::HasMark(const ByteStringView& mark) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
return false;
@@ -60,7 +60,7 @@
return false;
}
-bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
+bool CPDF_ContentMark::LookupMark(const ByteStringView& mark,
CPDF_Dictionary*& pDict) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
@@ -105,7 +105,7 @@
return -1;
}
-void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::MarkData::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
CPDF_ContentMarkItem item;
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index ab966c0..1b2fe79 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -27,11 +27,9 @@
int CountItems() const;
const CPDF_ContentMarkItem& GetItem(int i) const;
- bool HasMark(const CFX_ByteStringC& mark) const;
- bool LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const;
- void AddMark(const CFX_ByteString& name,
- CPDF_Dictionary* pDict,
- bool bDirect);
+ bool HasMark(const ByteStringView& mark) const;
+ bool LookupMark(const ByteStringView& mark, CPDF_Dictionary*& pDict) const;
+ void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect);
void DeleteLastMark();
bool HasRef() const { return !!m_Ref; }
@@ -48,7 +46,7 @@
const CPDF_ContentMarkItem& GetItem(int index) const;
int GetMCID() const;
- void AddMark(const CFX_ByteString& name,
+ void AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDictNeedClone);
void DeleteLastMark();
diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h
index afd2833..83c700f 100644
--- a/core/fpdfapi/page/cpdf_contentmarkitem.h
+++ b/core/fpdfapi/page/cpdf_contentmarkitem.h
@@ -26,17 +26,17 @@
CPDF_ContentMarkItem& operator=(CPDF_ContentMarkItem&& other) = default;
- CFX_ByteString GetName() const { return m_MarkName; }
+ ByteString GetName() const { return m_MarkName; }
ParamType GetParamType() const { return m_ParamType; }
CPDF_Dictionary* GetParam() const;
bool HasMCID() const;
- void SetName(const CFX_ByteString& name) { m_MarkName = name; }
+ void SetName(const ByteString& name) { m_MarkName = name; }
void SetDirectDict(std::unique_ptr<CPDF_Dictionary> pDict);
void SetPropertiesDict(CPDF_Dictionary* pDict);
private:
- CFX_ByteString m_MarkName;
+ ByteString m_MarkName;
ParamType m_ParamType;
CFX_UnownedPtr<CPDF_Dictionary> m_pPropertiesDict;
std::unique_ptr<CPDF_Dictionary> m_pDirectDict;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 1af9d6e..08345da 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -144,7 +144,7 @@
return pFontData->AddRef();
}
-CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName,
+CPDF_Font* CPDF_DocPageData::GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding) {
if (fontName.IsEmpty())
return nullptr;
@@ -228,7 +228,7 @@
pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj);
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name);
if (!pCS && pResources) {
CPDF_Dictionary* pList = pResources->GetDictFor("ColorSpace");
@@ -422,7 +422,7 @@
uint8_t digest[20];
CRYPT_SHA1Generate(pAccessor->GetData(), pAccessor->GetSize(), digest);
- CFX_ByteString bsDigest(digest, 20);
+ ByteString bsDigest(digest, 20);
auto hash_it = m_HashProfileMap.find(bsDigest);
if (hash_it != m_HashProfileMap.end()) {
auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 40647bc..3f1d392 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -35,7 +35,7 @@
bool IsForceClear() const { return m_bForceClear; }
CPDF_Font* GetFont(CPDF_Dictionary* pFontDict);
- CPDF_Font* GetStandardFont(const CFX_ByteString& fontName,
+ CPDF_Font* GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding);
void ReleaseFont(const CPDF_Dictionary* pFontDict);
@@ -70,7 +70,7 @@
bool m_bForceClear;
CFX_UnownedPtr<CPDF_Document> const m_pPDFDoc;
- std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap;
+ std::map<ByteString, CPDF_Stream*> m_HashProfileMap;
std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap;
std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index 5407074..c5c259f 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -13,7 +13,7 @@
namespace {
-int RI_StringToId(const CFX_ByteString& ri) {
+int RI_StringToId(const ByteString& ri) {
uint32_t id = ri.GetID();
if (id == FXBSTR_ID('A', 'b', 's', 'o'))
return 1;
@@ -27,7 +27,7 @@
return 0;
}
-int GetBlendTypeInternal(const CFX_ByteString& mode) {
+int GetBlendTypeInternal(const ByteString& mode) {
switch (mode.GetID()) {
case FXBSTR_ID('N', 'o', 'r', 'm'):
case FXBSTR_ID('C', 'o', 'm', 'p'):
@@ -75,45 +75,45 @@
CPDF_GeneralState::~CPDF_GeneralState() {}
-void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) {
+void CPDF_GeneralState::SetRenderIntent(const ByteString& ri) {
m_Ref.GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri);
}
-CFX_ByteString CPDF_GeneralState::GetBlendMode() const {
+ByteString CPDF_GeneralState::GetBlendMode() const {
switch (GetBlendType()) {
case FXDIB_BLEND_NORMAL:
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
case FXDIB_BLEND_MULTIPLY:
- return CFX_ByteString("Multiply");
+ return ByteString("Multiply");
case FXDIB_BLEND_SCREEN:
- return CFX_ByteString("Screen");
+ return ByteString("Screen");
case FXDIB_BLEND_OVERLAY:
- return CFX_ByteString("Overlay");
+ return ByteString("Overlay");
case FXDIB_BLEND_DARKEN:
- return CFX_ByteString("Darken");
+ return ByteString("Darken");
case FXDIB_BLEND_LIGHTEN:
- return CFX_ByteString("Lighten");
+ return ByteString("Lighten");
case FXDIB_BLEND_COLORDODGE:
- return CFX_ByteString("ColorDodge");
+ return ByteString("ColorDodge");
case FXDIB_BLEND_COLORBURN:
- return CFX_ByteString("ColorBurn");
+ return ByteString("ColorBurn");
case FXDIB_BLEND_HARDLIGHT:
- return CFX_ByteString("HardLight");
+ return ByteString("HardLight");
case FXDIB_BLEND_SOFTLIGHT:
- return CFX_ByteString("SoftLight");
+ return ByteString("SoftLight");
case FXDIB_BLEND_DIFFERENCE:
- return CFX_ByteString("Difference");
+ return ByteString("Difference");
case FXDIB_BLEND_EXCLUSION:
- return CFX_ByteString("Exclusion");
+ return ByteString("Exclusion");
case FXDIB_BLEND_HUE:
- return CFX_ByteString("Hue");
+ return ByteString("Hue");
case FXDIB_BLEND_SATURATION:
- return CFX_ByteString("Saturation");
+ return ByteString("Saturation");
case FXDIB_BLEND_COLOR:
- return CFX_ByteString("Color");
+ return ByteString("Color");
case FXDIB_BLEND_LUMINOSITY:
- return CFX_ByteString("Luminosity");
+ return ByteString("Luminosity");
}
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
}
int CPDF_GeneralState::GetBlendType() const {
@@ -171,7 +171,7 @@
m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
}
-void CPDF_GeneralState::SetBlendMode(const CFX_ByteString& mode) {
+void CPDF_GeneralState::SetBlendMode(const ByteString& mode) {
StateData* pData = m_Ref.GetPrivateCopy();
pData->m_BlendMode = mode;
pData->m_BlendType = GetBlendTypeInternal(mode);
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index b5b48a9..95f5978 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -25,9 +25,9 @@
void Emplace() { m_Ref.Emplace(); }
bool HasRef() const { return !!m_Ref; }
- void SetRenderIntent(const CFX_ByteString& ri);
+ void SetRenderIntent(const ByteString& ri);
- CFX_ByteString GetBlendMode() const;
+ ByteString GetBlendMode() const;
int GetBlendType() const;
void SetBlendType(int type);
@@ -46,7 +46,7 @@
CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc);
- void SetBlendMode(const CFX_ByteString& mode);
+ void SetBlendMode(const ByteString& mode);
const CFX_Matrix* GetSMaskMatrix() const;
void SetSMaskMatrix(const CFX_Matrix& matrix);
@@ -83,7 +83,7 @@
StateData(const StateData& that);
~StateData();
- CFX_ByteString m_BlendMode;
+ ByteString m_BlendMode;
int m_BlendType;
CFX_UnownedPtr<CPDF_Object> m_pSoftMask;
CFX_Matrix m_SMaskMatrix;
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index a551bd1..6e8c0e1 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -201,7 +201,7 @@
pCS->AddNew<CPDF_Name>("Indexed");
pCS->AddNew<CPDF_Name>("DeviceRGB");
pCS->AddNew<CPDF_Number>(1);
- CFX_ByteString ct;
+ ByteString ct;
char* pBuf = ct.GetBuffer(6);
pBuf[0] = (char)reset_r;
pBuf[1] = (char)reset_g;
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 6213e5f..148b30a 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -97,7 +97,7 @@
m_pRenderContext = std::move(pContext);
}
-CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
+CPDF_Object* CPDF_Page::GetPageAttr(const ByteString& name) const {
CPDF_Dictionary* pPageDict = m_pFormDict.Get();
std::set<CPDF_Dictionary*> visited;
while (1) {
@@ -112,7 +112,7 @@
return nullptr;
}
-CFX_FloatRect CPDF_Page::GetBox(const CFX_ByteString& name) const {
+CFX_FloatRect CPDF_Page::GetBox(const ByteString& name) const {
CFX_FloatRect box;
CPDF_Array* pBox = ToArray(GetPageAttr(name));
if (pBox) {
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 47fba3c..e32a7f0 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -62,8 +62,8 @@
private:
void StartParse();
- CPDF_Object* GetPageAttr(const CFX_ByteString& name) const;
- CFX_FloatRect GetBox(const CFX_ByteString& name) const;
+ CPDF_Object* GetPageAttr(const ByteString& name) const;
+ CFX_FloatRect GetBox(const ByteString& name) const;
float m_PageWidth;
float m_PageHeight;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 9ac1a3b..c223d4b 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -37,8 +37,8 @@
};
struct FontData {
- CFX_ByteString baseFont;
- CFX_ByteString type;
+ ByteString baseFont;
+ ByteString type;
bool operator<(const FontData& other) const;
};
@@ -76,8 +76,8 @@
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pPageResources;
CFX_UnownedPtr<CPDF_Dictionary> m_pResources;
- std::map<GraphicsData, CFX_ByteString> m_GraphicsMap;
- std::map<FontData, CFX_ByteString> m_FontsMap;
+ std::map<GraphicsData, ByteString> m_GraphicsMap;
+ std::map<FontData, ByteString> m_FontsMap;
CFX_FloatRect m_BBox;
int m_Transparency;
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 658d73c..63560fc 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -133,7 +133,7 @@
bool CPDF_PSEngine::Parse(const char* str, int size) {
CPDF_SimpleParser parser(reinterpret_cast<const uint8_t*>(str), size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
return word == "{" ? m_MainProc.Parse(&parser, 0) : false;
}
@@ -142,7 +142,7 @@
return false;
while (1) {
- CFX_ByteStringC word = parser->GetWord();
+ ByteStringView word = parser->GetWord();
if (word.IsEmpty())
return false;
@@ -158,7 +158,7 @@
std::unique_ptr<CPDF_PSOP> op;
for (const PDF_PSOpName& op_name : kPsOpNames) {
- if (word == CFX_ByteStringC(op_name.name)) {
+ if (word == ByteStringView(op_name.name)) {
op = pdfium::MakeUnique<CPDF_PSOP>(op_name.op);
break;
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 3755b29..c58e456 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -156,18 +156,17 @@
struct AbbrReplacementOp {
bool is_replace_key;
- CFX_ByteString key;
- CFX_ByteStringC replacement;
+ ByteString key;
+ ByteStringView replacement;
};
-CFX_ByteStringC FindFullName(const AbbrPair* table,
- size_t count,
- const CFX_ByteStringC& abbr) {
+ByteStringView FindFullName(const AbbrPair* table,
+ size_t count,
+ const ByteStringView& abbr) {
auto* it = std::find_if(table, table + count, [abbr](const AbbrPair& pair) {
return pair.abbr == abbr;
});
- return it != table + count ? CFX_ByteStringC(it->full_name)
- : CFX_ByteStringC();
+ return it != table + count ? ByteStringView(it->full_name) : ByteStringView();
}
void ReplaceAbbr(CPDF_Object* pObj) {
@@ -176,10 +175,10 @@
CPDF_Dictionary* pDict = pObj->AsDictionary();
std::vector<AbbrReplacementOp> replacements;
for (const auto& it : *pDict) {
- CFX_ByteString key = it.first;
+ ByteString key = it.first;
CPDF_Object* value = it.second.get();
- CFX_ByteStringC fullname = FindFullName(
- InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringC());
+ ByteStringView fullname = FindFullName(
+ InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = true;
@@ -190,9 +189,10 @@
}
if (value->IsName()) {
- CFX_ByteString name = value->GetString();
- fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = value->GetString();
+ fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = false;
@@ -206,9 +206,9 @@
}
for (const auto& op : replacements) {
if (op.is_replace_key)
- pDict->ReplaceKey(op.key, CFX_ByteString(op.replacement));
+ pDict->ReplaceKey(op.key, ByteString(op.replacement));
else
- pDict->SetNewFor<CPDF_Name>(op.key, CFX_ByteString(op.replacement));
+ pDict->SetNewFor<CPDF_Name>(op.key, ByteString(op.replacement));
}
break;
}
@@ -217,11 +217,12 @@
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetObjectAt(i);
if (pElement->IsName()) {
- CFX_ByteString name = pElement->GetString();
- CFX_ByteStringC fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = pElement->GetString();
+ ByteStringView fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty())
- pArray->SetNewAt<CPDF_Name>(i, CFX_ByteString(fullname));
+ pArray->SetNewAt<CPDF_Name>(i, ByteString(fullname));
} else {
ReplaceAbbr(pElement);
}
@@ -307,7 +308,7 @@
return index;
}
-void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
+void CPDF_StreamContentParser::AddNameParam(const ByteStringView& bsName) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
if (bsName.GetLength() > 32) {
param.m_Type = ContentParam::OBJECT;
@@ -316,7 +317,7 @@
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Contains('#')) {
- CFX_ByteString str = PDF_NameDecode(bsName);
+ ByteString str = PDF_NameDecode(bsName);
memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength());
param.m_Name.m_Len = str.GetLength();
} else {
@@ -326,7 +327,7 @@
}
}
-void CPDF_StreamContentParser::AddNumberParam(const CFX_ByteStringC& str) {
+void CPDF_StreamContentParser::AddNumberParam(const ByteStringView& str) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
param.m_Type = ContentParam::NUMBER;
param.m_Number.m_bInteger = FX_atonum(str, ¶m.m_Number.m_Integer);
@@ -373,7 +374,7 @@
param.m_Type = ContentParam::OBJECT;
param.m_pObject = pdfium::MakeUnique<CPDF_Name>(
m_pDocument->GetByteStringPool(),
- CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
+ ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
return param.m_pObject.get();
}
if (param.m_Type == ContentParam::OBJECT)
@@ -383,9 +384,9 @@
return nullptr;
}
-CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
+ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
if (index >= m_ParamCount) {
- return CFX_ByteString();
+ return ByteString();
}
int real_index = m_ParamStartPos + m_ParamCount - index - 1;
if (real_index >= kParamBufSize) {
@@ -393,12 +394,12 @@
}
ContentParam& param = m_ParamBuf[real_index];
if (param.m_Type == ContentParam::NAME) {
- return CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
+ return ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
}
if (param.m_Type == 0 && param.m_pObject) {
return param.m_pObject->GetString();
}
- return CFX_ByteString();
+ return ByteString();
}
float CPDF_StreamContentParser::GetNumber(uint32_t index) {
@@ -559,7 +560,7 @@
});
}
-void CPDF_StreamContentParser::OnOperator(const CFX_ByteStringC& op) {
+void CPDF_StreamContentParser::OnOperator(const ByteStringView& op) {
static const OpCodes s_OpCodes = InitializeOpCodes();
auto it = s_OpCodes.find(op.GetID());
@@ -586,7 +587,7 @@
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
- CFX_ByteString tag = GetString(1);
+ ByteString tag = GetString(1);
CPDF_Object* pProperty = GetObject(0);
if (!pProperty) {
return;
@@ -619,7 +620,7 @@
break;
}
auto word = m_pSyntax->GetWord();
- CFX_ByteString key(word.Right(word.GetLength() - 1));
+ ByteString key(word.Right(word.GetLength() - 1));
auto pObj = m_pSyntax->ReadNextObject(false, false, 0);
if (!key.IsEmpty()) {
uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
@@ -634,7 +635,7 @@
if (pDict->KeyExist("ColorSpace")) {
pCSObj = pDict->GetDirectObjectFor("ColorSpace");
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj && pCSObj->IsInline())
@@ -727,7 +728,7 @@
}
void CPDF_StreamContentParser::Handle_ExecuteXObject() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
CPDF_ImageObject* pObj = AddImage(m_pLastImage);
@@ -744,7 +745,7 @@
return;
}
- CFX_ByteString type;
+ ByteString type;
if (pXObject->GetDict())
type = pXObject->GetDict()->GetStringFor("Subtype");
@@ -875,7 +876,7 @@
}
void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
CPDF_Dictionary* pGS = ToDictionary(FindResourceObj("ExtGState", name));
if (!pGS) {
m_bResourceMissing = true;
@@ -1155,9 +1156,8 @@
}
}
-CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+CPDF_Object* CPDF_StreamContentParser::FindResourceObj(const ByteString& type,
+ const ByteString& name) {
if (!m_pResources)
return nullptr;
CPDF_Dictionary* pDict = m_pResources->GetDictFor(type);
@@ -1170,7 +1170,7 @@
return pPageDict ? pPageDict->GetDirectObjectFor(name) : nullptr;
}
-CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
+CPDF_Font* CPDF_StreamContentParser::FindFont(const ByteString& name) {
CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name));
if (!pFontDict) {
m_bResourceMissing = true;
@@ -1186,12 +1186,12 @@
}
CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
- const CFX_ByteString& name) {
+ const ByteString& name) {
if (name == "Pattern") {
return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
}
if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
- CFX_ByteString defname = "Default";
+ ByteString defname = "Default";
defname += name.Right(name.GetLength() - 7);
CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
if (!pDefObj) {
@@ -1213,7 +1213,7 @@
return m_pDocument->LoadColorSpace(pCSObj);
}
-CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
+CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const ByteString& name,
bool bShading) {
CPDF_Object* pPattern =
FindResourceObj(bShading ? "Shading" : "Pattern", name);
@@ -1225,7 +1225,7 @@
m_pCurStates->m_ParentMatrix);
}
-void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
+void CPDF_StreamContentParser::AddTextObject(ByteString* pStrs,
float fInitKerning,
float* pKerning,
int nsegs) {
@@ -1290,7 +1290,7 @@
}
void CPDF_StreamContentParser::Handle_ShowText() {
- CFX_ByteString str = GetString(0);
+ ByteString str = GetString(0);
if (str.IsEmpty()) {
return;
}
@@ -1317,14 +1317,14 @@
}
return;
}
- std::vector<CFX_ByteString> strs(nsegs);
+ std::vector<ByteString> strs(nsegs);
std::vector<float> kernings(nsegs);
size_t iSegment = 0;
float fInitKerning = 0;
for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
if (str.IsEmpty())
continue;
strs[iSegment] = str;
@@ -1556,7 +1556,7 @@
case CPDF_StreamParser::EndOfData:
return;
case CPDF_StreamParser::Keyword: {
- CFX_ByteStringC strc = m_pSyntax->GetWord();
+ ByteStringView strc = m_pSyntax->GetWord();
int len = strc.GetLength();
if (len == 1) {
switch (strc[0]) {
@@ -1631,14 +1631,14 @@
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), abbr);
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindValueAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr), abbr);
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index a027129..c30c6b7 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -50,12 +50,12 @@
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
bool IsColored() const { return m_bColored; }
const float* GetType3Data() const { return m_Type3Data; }
- CPDF_Font* FindFont(const CFX_ByteString& name);
+ CPDF_Font* FindFont(const ByteString& name);
- static CFX_ByteStringC FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
- static CFX_ByteStringC FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
+ static ByteStringView FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr);
+ static ByteStringView FindValueAbbreviationForTesting(
+ const ByteStringView& abbr);
private:
struct ContentParam {
@@ -84,17 +84,17 @@
using OpCodes = std::map<uint32_t, void (CPDF_StreamContentParser::*)()>;
static OpCodes InitializeOpCodes();
- void AddNameParam(const CFX_ByteStringC& str);
- void AddNumberParam(const CFX_ByteStringC& str);
+ void AddNameParam(const ByteStringView& str);
+ void AddNumberParam(const ByteStringView& str);
void AddObjectParam(std::unique_ptr<CPDF_Object> pObj);
int GetNextParamPos();
void ClearAllParams();
CPDF_Object* GetObject(uint32_t index);
- CFX_ByteString GetString(uint32_t index);
+ ByteString GetString(uint32_t index);
float GetNumber(uint32_t index);
int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); }
- void OnOperator(const CFX_ByteStringC& op);
- void AddTextObject(CFX_ByteString* pText,
+ void OnOperator(const ByteStringView& op);
+ void AddTextObject(ByteString* pText,
float fInitKerning,
float* pKerning,
int count);
@@ -113,10 +113,9 @@
bool bColor,
bool bText,
bool bGraph);
- CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
- CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading);
- CPDF_Object* FindResourceObj(const CFX_ByteString& type,
- const CFX_ByteString& name);
+ CPDF_ColorSpace* FindColorSpace(const ByteString& name);
+ CPDF_Pattern* FindPattern(const ByteString& name, bool bShading);
+ CPDF_Object* FindResourceObj(const ByteString& type, const ByteString& name);
// Takes ownership of |pImageObj|, returns unowned pointer to it.
CPDF_ImageObject* AddImageObject(std::unique_ptr<CPDF_ImageObject> pImageObj);
@@ -217,7 +216,7 @@
float m_PathCurrentX;
float m_PathCurrentY;
uint8_t m_PathClipType;
- CFX_ByteString m_LastImageName;
+ ByteString m_LastImageName;
CFX_RetainPtr<CPDF_Image> m_pLastImage;
bool m_bColored;
float m_Type3Data[6];
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
index 6b43935..0f4fc1e 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
@@ -6,39 +6,39 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(cpdf_streamcontentparser, PDF_FindKeyAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"),
+ EXPECT_EQ(ByteStringView("BitsPerComponent"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("BPC")));
- EXPECT_EQ(CFX_ByteStringC("Width"),
+ ByteStringView("BPC")));
+ EXPECT_EQ(ByteStringView("Width"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("W")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("W")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("WW")));
+ ByteStringView("WW")));
}
TEST(cpdf_streamcontentparser, PDF_FindValueAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("DeviceGray"),
+ EXPECT_EQ(ByteStringView("DeviceGray"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("G")));
- EXPECT_EQ(CFX_ByteStringC("DCTDecode"),
+ ByteStringView("G")));
+ EXPECT_EQ(ByteStringView("DCTDecode"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("DCT")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("DCT")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("II")));
+ ByteStringView("II")));
}
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index f745331..46cbfeb 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -64,7 +64,7 @@
uint32_t limit,
int width,
int height,
- const CFX_ByteString& decoder,
+ const ByteString& decoder,
CPDF_Dictionary* pParam,
uint8_t** dest_buf,
uint32_t* dest_size) {
@@ -104,10 +104,9 @@
CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize)
: m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(nullptr) {}
-CPDF_StreamParser::CPDF_StreamParser(
- const uint8_t* pData,
- uint32_t dwSize,
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData,
+ uint32_t dwSize,
+ const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(pPool) {}
CPDF_StreamParser::~CPDF_StreamParser() {}
@@ -122,7 +121,7 @@
if (PDFCharIsWhitespace(m_pBuf[m_Pos]))
m_Pos++;
- CFX_ByteString Decoder;
+ ByteString Decoder;
CPDF_Dictionary* pParam = nullptr;
CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter");
if (pFilter) {
@@ -312,18 +311,18 @@
if (bIsNumber) {
m_WordBuffer[m_WordSize] = 0;
return pdfium::MakeUnique<CPDF_Number>(
- CFX_ByteStringC(m_WordBuffer, m_WordSize));
+ ByteStringView(m_WordBuffer, m_WordSize));
}
int first_char = m_WordBuffer[0];
if (first_char == '/') {
- CFX_ByteString name =
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
+ ByteString name =
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1));
return pdfium::MakeUnique<CPDF_Name>(m_pPool, name);
}
if (first_char == '(') {
- CFX_ByteString str = ReadString();
+ ByteString str = ReadString();
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
@@ -340,8 +339,8 @@
if (!m_WordSize || m_WordBuffer[0] != '/')
return nullptr;
- CFX_ByteString key =
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
+ ByteString key =
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1));
std::unique_ptr<CPDF_Object> pObj =
ReadNextObject(true, bInArray, dwRecursionLevel + 1);
if (!pObj)
@@ -464,9 +463,9 @@
}
}
-CFX_ByteString CPDF_StreamParser::ReadString() {
+ByteString CPDF_StreamParser::ReadString() {
if (!PositionIsInBounds())
- return CFX_ByteString();
+ return ByteString();
uint8_t ch = m_pBuf[m_Pos++];
std::ostringstream buf;
@@ -478,9 +477,9 @@
case 0:
if (ch == ')') {
if (parlevel == 0) {
- return CFX_ByteString(buf.str().c_str(),
- std::min(static_cast<FX_STRSIZE>(buf.tellp()),
- kMaxStringLength));
+ return ByteString(buf.str().c_str(),
+ std::min(static_cast<FX_STRSIZE>(buf.tellp()),
+ kMaxStringLength));
}
parlevel--;
buf << ')';
@@ -555,14 +554,14 @@
if (PositionIsInBounds())
++m_Pos;
- return CFX_ByteString(
+ return ByteString(
buf.str().c_str(),
std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
-CFX_ByteString CPDF_StreamParser::ReadHexString() {
+ByteString CPDF_StreamParser::ReadHexString() {
if (!PositionIsInBounds())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
bool bFirst = true;
@@ -588,7 +587,7 @@
if (!bFirst)
buf << static_cast<char>(code);
- return CFX_ByteString(
+ return ByteString(
buf.str().c_str(),
std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
diff --git a/core/fpdfapi/page/cpdf_streamparser.h b/core/fpdfapi/page/cpdf_streamparser.h
index fdc418c..32001a8 100644
--- a/core/fpdfapi/page/cpdf_streamparser.h
+++ b/core/fpdfapi/page/cpdf_streamparser.h
@@ -24,12 +24,12 @@
CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
CPDF_StreamParser(const uint8_t* pData,
uint32_t dwSize,
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_StreamParser();
SyntaxType ParseNextElement();
- CFX_ByteStringC GetWord() const {
- return CFX_ByteStringC(m_WordBuffer, m_WordSize);
+ ByteStringView GetWord() const {
+ return ByteStringView(m_WordBuffer, m_WordSize);
}
uint32_t GetPos() const { return m_Pos; }
void SetPos(uint32_t pos) { m_Pos = pos; }
@@ -46,8 +46,8 @@
friend class cpdf_streamparser_ReadHexString_Test;
void GetNextWord(bool& bIsNumber);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
bool PositionIsInBounds() const;
const uint8_t* m_pBuf;
@@ -56,7 +56,7 @@
uint8_t m_WordBuffer[256];
uint32_t m_WordSize;
std::unique_ptr<CPDF_Object> m_pLastObj;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index a4d714f..4baf61d 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -136,7 +136,7 @@
pTextMatrix[3], m_Pos.x, m_Pos.y);
}
-void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
+void CPDF_TextObject::SetSegments(const ByteString* pStrs,
const float* pKerning,
int nsegs) {
m_CharCodes.clear();
@@ -162,7 +162,7 @@
}
}
-void CPDF_TextObject::SetText(const CFX_ByteString& str) {
+void CPDF_TextObject::SetText(const ByteString& str) {
SetSegments(&str, nullptr, 1);
RecalcPositionData();
SetDirty(true);
diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h
index e08b728..5cffbd1 100644
--- a/core/fpdfapi/page/cpdf_textobject.h
+++ b/core/fpdfapi/page/cpdf_textobject.h
@@ -47,7 +47,7 @@
CPDF_Font* GetFont() const;
float GetFontSize() const;
- void SetText(const CFX_ByteString& text);
+ void SetText(const ByteString& text);
void SetPosition(float x, float y);
void RecalcPositionData();
@@ -58,9 +58,7 @@
friend class CPDF_TextRenderer;
friend class CPDF_PageContentGenerator;
- void SetSegments(const CFX_ByteString* pStrs,
- const float* pKerning,
- int nSegs);
+ void SetSegments(const ByteString* pStrs, const float* pKerning, int nSegs);
CFX_PointF CalcPositionData(float horz_scale);
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 41827db..1f84f56 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -52,7 +52,7 @@
parser.InitParser(m_pFile, 0);
while (1) {
bool bNumber;
- CFX_ByteString word = parser.GetNextWord(&bNumber);
+ ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
uint32_t objnum = FXSYS_atoui(word.c_str());
if (!objnum)
@@ -89,9 +89,9 @@
}
}
-CFX_ByteString CFDF_Document::WriteToString() const {
+ByteString CFDF_Document::WriteToString() const {
if (!m_pRootDict)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
buf << "%FDF-1.2\r\n";
@@ -102,5 +102,5 @@
buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
<< " 0 R>>\r\n%%EOF\r\n";
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index d58f93c..a24415b 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -27,7 +27,7 @@
CFDF_Document();
~CFDF_Document() override;
- CFX_ByteString WriteToString() const;
+ ByteString WriteToString() const;
CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); }
protected:
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index a0957b6..f4907ff 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -20,7 +20,7 @@
CPDF_Array::CPDF_Array() {}
-CPDF_Array::CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Array::CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Array::~CPDF_Array() {
@@ -100,15 +100,15 @@
return m_Objects[i]->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(size_t i) const {
+ByteString CPDF_Array::GetStringAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_ByteString();
+ return ByteString();
return m_Objects[i]->GetString();
}
-CFX_WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
+WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_WideString();
+ return WideString();
return m_Objects[i]->GetUnicodeText();
}
diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h
index d1be233..3b18025 100644
--- a/core/fpdfapi/parser/cpdf_array.h
+++ b/core/fpdfapi/parser/cpdf_array.h
@@ -24,7 +24,7 @@
std::vector<std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Array();
- explicit CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Array() override;
// CPDF_Object:
@@ -39,8 +39,8 @@
size_t GetCount() const { return m_Objects.size(); }
CPDF_Object* GetObjectAt(size_t index) const;
CPDF_Object* GetDirectObjectAt(size_t index) const;
- CFX_ByteString GetStringAt(size_t index) const;
- CFX_WideString GetUnicodeTextAt(size_t index) const;
+ ByteString GetStringAt(size_t index) const;
+ WideString GetUnicodeTextAt(size_t index) const;
int GetIntegerAt(size_t index) const;
float GetNumberAt(size_t index) const;
CPDF_Dictionary* GetDictAt(size_t index) const;
@@ -112,7 +112,7 @@
std::set<const CPDF_Object*>* pVisited) const override;
std::vector<std::unique_ptr<CPDF_Object>> m_Objects;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
inline CPDF_Array* ToArray(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_boolean.cpp b/core/fpdfapi/parser/cpdf_boolean.cpp
index 2633c87..a1dc450 100644
--- a/core/fpdfapi/parser/cpdf_boolean.cpp
+++ b/core/fpdfapi/parser/cpdf_boolean.cpp
@@ -22,7 +22,7 @@
return pdfium::MakeUnique<CPDF_Boolean>(m_bValue);
}
-CFX_ByteString CPDF_Boolean::GetString() const {
+ByteString CPDF_Boolean::GetString() const {
return m_bValue ? "true" : "false";
}
@@ -30,7 +30,7 @@
return m_bValue;
}
-void CPDF_Boolean::SetString(const CFX_ByteString& str) {
+void CPDF_Boolean::SetString(const ByteString& str) {
m_bValue = (str == "true");
}
@@ -48,5 +48,5 @@
bool CPDF_Boolean::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_boolean.h b/core/fpdfapi/parser/cpdf_boolean.h
index 2dd1486..c0a69d8 100644
--- a/core/fpdfapi/parser/cpdf_boolean.h
+++ b/core/fpdfapi/parser/cpdf_boolean.h
@@ -22,9 +22,9 @@
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsBoolean() const override;
CPDF_Boolean* AsBoolean() override;
const CPDF_Boolean* AsBoolean() const override;
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 74428ba..cae95f2 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -230,14 +230,14 @@
return true;
}
-CFX_ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str) {
+ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
+ const ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
DecryptStream(context, str.raw_str(), str.GetLength(), dest_buf);
DecryptFinish(context, dest_buf);
- return CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
+ return ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
}
void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index adf0c6c..252f41c 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -28,9 +28,7 @@
CPDF_SecurityHandler* pSecurityHandler);
uint32_t DecryptGetSize(uint32_t src_size);
void* DecryptStart(uint32_t objnum, uint32_t gennum);
- CFX_ByteString Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str);
+ ByteString Decrypt(uint32_t objnum, uint32_t gennum, const ByteString& str);
bool DecryptStream(void* context,
const uint8_t* src_buf,
uint32_t src_size,
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index b10029d..994d082 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -473,7 +473,7 @@
if (!pObj->IsDictionary())
continue;
- CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
+ ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.push_back(std::move(pObj));
continue;
@@ -661,7 +661,7 @@
m_syntaxParser.SetPos(pos);
bool bIsNumber;
- CFX_ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
+ ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
if (!bIsNumber)
return nullptr;
@@ -723,7 +723,7 @@
m_syntaxParser.SetPos(m_syntaxParser.m_HeaderOffset + 9);
bool bNumber;
- CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber)
return false;
@@ -761,7 +761,7 @@
m_syntaxParser.GetNextWord(nullptr);
bool bNumber;
- CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
@@ -781,7 +781,7 @@
m_Pos = dwOffset;
}
-bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
+bool CPDF_DataAvail::GetNextToken(ByteString* token) {
uint8_t ch;
if (!GetNextChar(ch))
return false;
@@ -814,7 +814,7 @@
if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
m_Pos--;
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
if (index < sizeof(buffer))
@@ -837,7 +837,7 @@
else
m_Pos--;
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -854,7 +854,7 @@
}
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -885,7 +885,7 @@
}
bool CPDF_DataAvail::CheckCrossRefItem() {
- CFX_ByteString token;
+ ByteString token;
while (1) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
if (!GetNextToken(&token)) {
@@ -904,7 +904,7 @@
bool CPDF_DataAvail::CheckCrossRef() {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
- CFX_ByteString token;
+ ByteString token;
if (!GetNextToken(&token)) {
if (!GetValidator()->has_read_problems())
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -1046,7 +1046,7 @@
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- const CFX_ByteString type = pDict->GetStringFor("Type");
+ const ByteString type = pDict->GetStringFor("Type");
if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
return true;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index e2a4a20..850ceea 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -145,7 +145,7 @@
bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- bool GetNextToken(CFX_ByteString* token);
+ bool GetNextToken(ByteString* token);
bool GetNextChar(uint8_t& ch);
std::unique_ptr<CPDF_Object> ParseIndirectObjectAt(
FX_FILESIZE pos,
@@ -200,7 +200,7 @@
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
uint32_t m_bufferSize;
- CFX_ByteString m_WordBuf;
+ ByteString m_WordBuf;
uint8_t m_bufferData[512];
std::vector<uint32_t> m_XRefStreamList;
std::vector<uint32_t> m_PageObjList;
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 4c03587..570c57e 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -22,9 +22,9 @@
#include "third_party/base/stl_util.h"
CPDF_Dictionary::CPDF_Dictionary()
- : CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_Dictionary(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Dictionary::~CPDF_Dictionary() {
@@ -78,58 +78,56 @@
return std::move(pCopy);
}
-CPDF_Object* CPDF_Dictionary::GetObjectFor(const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetObjectFor(const ByteString& key) const {
auto it = m_Map.find(key);
return it != m_Map.end() ? it->second.get() : nullptr;
}
-CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(
- const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetDirect() : nullptr;
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString();
+ return p ? p->GetString() : ByteString();
}
-CFX_WideString CPDF_Dictionary::GetUnicodeTextFor(
- const CFX_ByteString& key) const {
+WideString CPDF_Dictionary::GetUnicodeTextFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
- return p ? p->GetUnicodeText() : CFX_WideString();
+ return p ? p->GetUnicodeText() : WideString();
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& def) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key,
+ const ByteString& def) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString(def);
+ return p ? p->GetString() : ByteString(def);
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : 0;
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key, int def) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : def;
}
-float CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
+float CPDF_Dictionary::GetNumberFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetNumber() : 0;
}
-bool CPDF_Dictionary::GetBooleanFor(const CFX_ByteString& key,
+bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
bool bDefault) const {
CPDF_Object* p = GetObjectFor(key);
return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
+CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) const {
CPDF_Object* p = GetDirectObjectFor(key);
if (!p)
return nullptr;
@@ -140,15 +138,15 @@
return nullptr;
}
-CPDF_Array* CPDF_Dictionary::GetArrayFor(const CFX_ByteString& key) const {
+CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const {
return ToArray(GetDirectObjectFor(key));
}
-CPDF_Stream* CPDF_Dictionary::GetStreamFor(const CFX_ByteString& key) const {
+CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) const {
return ToStream(GetDirectObjectFor(key));
}
-CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
+CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const {
CFX_FloatRect rect;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -156,7 +154,7 @@
return rect;
}
-CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
+CFX_Matrix CPDF_Dictionary::GetMatrixFor(const ByteString& key) const {
CFX_Matrix matrix;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -164,7 +162,7 @@
return matrix;
}
-bool CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const {
+bool CPDF_Dictionary::KeyExist(const ByteString& key) const {
return pdfium::ContainsKey(m_Map, key);
}
@@ -175,7 +173,7 @@
return pType && pType->GetString() == "Sig";
}
-CPDF_Object* CPDF_Dictionary::SetFor(const CFX_ByteString& key,
+CPDF_Object* CPDF_Dictionary::SetFor(const ByteString& key,
std::unique_ptr<CPDF_Object> pObj) {
if (!pObj) {
m_Map.erase(key);
@@ -188,7 +186,7 @@
}
void CPDF_Dictionary::ConvertToIndirectObjectFor(
- const CFX_ByteString& key,
+ const ByteString& key,
CPDF_IndirectObjectHolder* pHolder) {
auto it = m_Map.find(key);
if (it == m_Map.end() || it->second->IsReference())
@@ -198,8 +196,7 @@
it->second = pdfium::MakeUnique<CPDF_Reference>(pHolder, pObj->GetObjNum());
}
-std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
- const CFX_ByteString& key) {
+std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(const ByteString& key) {
std::unique_ptr<CPDF_Object> result;
auto it = m_Map.find(key);
if (it != m_Map.end()) {
@@ -209,8 +206,8 @@
return result;
}
-void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
- const CFX_ByteString& newkey) {
+void CPDF_Dictionary::ReplaceKey(const ByteString& oldkey,
+ const ByteString& newkey) {
auto old_it = m_Map.find(oldkey);
if (old_it == m_Map.end())
return;
@@ -223,7 +220,7 @@
m_Map.erase(old_it);
}
-void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetRectFor(const ByteString& key,
const CFX_FloatRect& rect) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(rect.left);
@@ -232,7 +229,7 @@
pArray->AddNew<CPDF_Number>(rect.top);
}
-void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetMatrixFor(const ByteString& key,
const CFX_Matrix& matrix) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(matrix.a);
@@ -243,7 +240,7 @@
pArray->AddNew<CPDF_Number>(matrix.f);
}
-CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) {
+ByteString CPDF_Dictionary::MaybeIntern(const ByteString& str) {
return m_pPool ? m_pPool->Intern(str) : str;
}
@@ -252,10 +249,10 @@
return false;
for (const auto& it : *this) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!archive->WriteString("/") ||
- !archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index 31a09d9..93c00c8 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -24,10 +24,10 @@
class CPDF_Dictionary : public CPDF_Object {
public:
using const_iterator =
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Dictionary();
- explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Dictionary() override;
// CPDF_Object:
@@ -40,76 +40,73 @@
bool WriteTo(IFX_ArchiveStream* archive) const override;
size_t GetCount() const { return m_Map.size(); }
- CPDF_Object* GetObjectFor(const CFX_ByteString& key) const;
- CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& default_str) const;
- CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key, int default_int) const;
- bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const;
- float GetNumberFor(const CFX_ByteString& key) const;
- CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const;
- CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const;
- CPDF_Array* GetArrayFor(const CFX_ByteString& key) const;
- CFX_FloatRect GetRectFor(const CFX_ByteString& key) const;
- CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
- float GetFloatFor(const CFX_ByteString& key) const {
- return GetNumberFor(key);
- }
+ CPDF_Object* GetObjectFor(const ByteString& key) const;
+ CPDF_Object* GetDirectObjectFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key,
+ const ByteString& default_str) const;
+ WideString GetUnicodeTextFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key, int default_int) const;
+ bool GetBooleanFor(const ByteString& key, bool bDefault = false) const;
+ float GetNumberFor(const ByteString& key) const;
+ CPDF_Dictionary* GetDictFor(const ByteString& key) const;
+ CPDF_Stream* GetStreamFor(const ByteString& key) const;
+ CPDF_Array* GetArrayFor(const ByteString& key) const;
+ CFX_FloatRect GetRectFor(const ByteString& key) const;
+ CFX_Matrix GetMatrixFor(const ByteString& key) const;
+ float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); }
- bool KeyExist(const CFX_ByteString& key) const;
+ bool KeyExist(const ByteString& key) const;
bool IsSignatureDict() const;
// Set* functions invalidate iterators for the element with the key |key|.
// Takes ownership of |pObj|, returns an unowned pointer to it.
- CPDF_Object* SetFor(const CFX_ByteString& key,
- std::unique_ptr<CPDF_Object> pObj);
+ CPDF_Object* SetFor(const ByteString& key, std::unique_ptr<CPDF_Object> pObj);
// Creates a new object owned by the dictionary and returns an unowned
// pointer to it.
template <typename T, typename... Args>
typename std::enable_if<!CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(
SetFor(key, pdfium::MakeUnique<T>(std::forward<Args>(args)...)));
}
template <typename T, typename... Args>
typename std::enable_if<CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(SetFor(
key, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...)));
}
// Convenience functions to convert native objects to array form.
- void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect);
- void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix);
+ void SetRectFor(const ByteString& key, const CFX_FloatRect& rect);
+ void SetMatrixFor(const ByteString& key, const CFX_Matrix& matrix);
- void ConvertToIndirectObjectFor(const CFX_ByteString& key,
+ void ConvertToIndirectObjectFor(const ByteString& key,
CPDF_IndirectObjectHolder* pHolder);
// Invalidates iterators for the element with the key |key|.
- std::unique_ptr<CPDF_Object> RemoveFor(const CFX_ByteString& key);
+ std::unique_ptr<CPDF_Object> RemoveFor(const ByteString& key);
// Invalidates iterators for the element with the key |oldkey|.
- void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey);
+ void ReplaceKey(const ByteString& oldkey, const ByteString& newkey);
const_iterator begin() const { return m_Map.begin(); }
const_iterator end() const { return m_Map.end(); }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; }
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const { return m_pPool; }
protected:
- CFX_ByteString MaybeIntern(const CFX_ByteString& str);
+ ByteString MaybeIntern(const ByteString& str);
std::unique_ptr<CPDF_Object> CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* visited) const override;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>> m_Map;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>> m_Map;
};
inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 4715517..f47551f 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -217,8 +217,8 @@
InsertWidthArrayImpl(widths, size, pWidthArray);
}
-CFX_ByteString FPDF_GetPSNameFromTT(HDC hDC) {
- CFX_ByteString result;
+ByteString FPDF_GetPSNameFromTT(HDC hDC) {
+ ByteString result;
DWORD size = ::GetFontData(hDC, 'eman', 0, nullptr, 0);
if (size != GDI_ERROR) {
LPBYTE buffer = FX_Alloc(BYTE, size);
@@ -299,7 +299,7 @@
void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
bool bold,
bool italic,
- CFX_ByteString basefont,
+ ByteString basefont,
std::unique_ptr<CPDF_Array> pWidths) {
if (bold && italic)
basefont += ",BoldItalic";
@@ -316,7 +316,7 @@
std::unique_ptr<CPDF_Dictionary> CalculateFontDesc(
CPDF_Document* pDoc,
- CFX_ByteString basefont,
+ ByteString basefont,
int flags,
int italicangle,
int ascend,
@@ -769,7 +769,7 @@
CPDF_Font* CPDF_Document::AddStandardFont(const char* font,
CPDF_FontEncoding* pEncoding) {
- CFX_ByteString name(font);
+ ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
return nullptr;
return GetPageData()->GetStandardFont(name, pEncoding);
@@ -793,7 +793,7 @@
const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
- CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
+ ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
pArray->AddNew<CPDF_Name>(name.IsEmpty() ? ".notdef" : name);
}
pBaseDict->SetNewFor<CPDF_Reference>("Encoding", this,
@@ -805,11 +805,11 @@
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
- CFX_ByteString cmap;
- CFX_ByteString ordering;
+ ByteString cmap;
+ ByteString ordering;
int supplement = 0;
CPDF_Array* pWidthArray = pFontDict->SetNewFor<CPDF_Array>("W");
switch (charset) {
@@ -875,7 +875,7 @@
bool bCJK = charset == FX_CHARSET_ChineseTraditional ||
charset == FX_CHARSET_ChineseSimplified ||
charset == FX_CHARSET_Hangul || charset == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont = pFont->GetFamilyName();
+ ByteString basefont = pFont->GetFamilyName();
basefont.Replace(" ", "");
int flags =
CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(),
@@ -958,12 +958,12 @@
bool bTranslateName) {
LOGFONTA lfa;
memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
- CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
+ ByteString face = ByteString::FromUnicode(pLogFont->lfFaceName);
if (face.GetLength() >= LF_FACESIZE)
return nullptr;
strncpy(lfa.lfFaceName, face.c_str(),
- (face.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
+ (face.GetLength() + 1) * sizeof(ByteString::CharType));
return AddWindowsFont(&lfa, bVert, bTranslateName);
}
@@ -996,7 +996,7 @@
pLogFont->lfCharSet == FX_CHARSET_ChineseSimplified ||
pLogFont->lfCharSet == FX_CHARSET_Hangul ||
pLogFont->lfCharSet == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont;
+ ByteString basefont;
if (bTranslateName && bCJK)
basefont = FPDF_GetPSNameFromTT(hDC);
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index cc50763..ff80fa8 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -122,7 +122,7 @@
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert);
bool InsertDeletePDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
index 434470a..2a57411 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
@@ -23,7 +23,7 @@
CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder()
: m_LastObjNum(0),
- m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {}
+ m_pByteStringPool(pdfium::MakeUnique<ByteStringPool>()) {}
CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
m_pByteStringPool.DeleteObject(); // Make weak.
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
index b82377e..ab99dd5 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
@@ -58,7 +58,7 @@
uint32_t GetLastObjNum() const { return m_LastObjNum; }
void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const {
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const {
return m_pByteStringPool;
}
@@ -72,7 +72,7 @@
uint32_t m_LastObjNum;
std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs;
std::vector<std::unique_ptr<CPDF_Object>> m_OrphanObjs;
- CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
+ CFX_WeakPtr<ByteStringPool> m_pByteStringPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index ae33bc7..0dd9890 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -10,8 +10,7 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-CPDF_Name::CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str)
+CPDF_Name::CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str)
: m_Name(str) {
if (pPool)
m_Name = pPool->Intern(m_Name);
@@ -27,11 +26,11 @@
return pdfium::MakeUnique<CPDF_Name>(nullptr, m_Name);
}
-CFX_ByteString CPDF_Name::GetString() const {
+ByteString CPDF_Name::GetString() const {
return m_Name;
}
-void CPDF_Name::SetString(const CFX_ByteString& str) {
+void CPDF_Name::SetString(const ByteString& str) {
m_Name = str;
}
@@ -47,11 +46,11 @@
return this;
}
-CFX_WideString CPDF_Name::GetUnicodeText() const {
+WideString CPDF_Name::GetUnicodeText() const {
return PDF_DecodeText(m_Name);
}
bool CPDF_Name::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString("/") &&
- archive->WriteString(PDF_NameEncode(GetString()).AsStringC());
+ archive->WriteString(PDF_NameEncode(GetString()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_name.h b/core/fpdfapi/parser/cpdf_name.h
index 616f35f..72a72a3 100644
--- a/core/fpdfapi/parser/cpdf_name.h
+++ b/core/fpdfapi/parser/cpdf_name.h
@@ -15,22 +15,22 @@
class CPDF_Name : public CPDF_Object {
public:
- CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_ByteString& str);
+ CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str);
~CPDF_Name() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsName() const override;
CPDF_Name* AsName() override;
const CPDF_Name* AsName() const override;
bool WriteTo(IFX_ArchiveStream* archive) const override;
protected:
- CFX_ByteString m_Name;
+ ByteString m_Name;
};
inline CPDF_Name* ToName(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_number.cpp b/core/fpdfapi/parser/cpdf_number.cpp
index 9afe30a..dac1f40 100644
--- a/core/fpdfapi/parser/cpdf_number.cpp
+++ b/core/fpdfapi/parser/cpdf_number.cpp
@@ -14,7 +14,7 @@
CPDF_Number::CPDF_Number(float value) : m_bInteger(false), m_Float(value) {}
-CPDF_Number::CPDF_Number(const CFX_ByteStringC& str)
+CPDF_Number::CPDF_Number(const ByteStringView& str)
: m_bInteger(FX_atonum(str, &m_Integer)) {}
CPDF_Number::~CPDF_Number() {}
@@ -48,16 +48,16 @@
return this;
}
-void CPDF_Number::SetString(const CFX_ByteString& str) {
- m_bInteger = FX_atonum(str.AsStringC(), &m_Integer);
+void CPDF_Number::SetString(const ByteString& str) {
+ m_bInteger = FX_atonum(str.AsStringView(), &m_Integer);
}
-CFX_ByteString CPDF_Number::GetString() const {
- return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer)
- : CFX_ByteString::FormatFloat(m_Float);
+ByteString CPDF_Number::GetString() const {
+ return m_bInteger ? ByteString::FormatInteger(m_Integer)
+ : ByteString::FormatFloat(m_Float);
}
bool CPDF_Number::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_number.h b/core/fpdfapi/parser/cpdf_number.h
index 57f8227..6611773 100644
--- a/core/fpdfapi/parser/cpdf_number.h
+++ b/core/fpdfapi/parser/cpdf_number.h
@@ -18,16 +18,16 @@
CPDF_Number();
explicit CPDF_Number(int value);
explicit CPDF_Number(float value);
- explicit CPDF_Number(const CFX_ByteStringC& str);
+ explicit CPDF_Number(const ByteStringView& str);
~CPDF_Number() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsNumber() const override;
CPDF_Number* AsNumber() override;
const CPDF_Number* AsNumber() const override;
diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp
index b35c6e5..67632a0 100644
--- a/core/fpdfapi/parser/cpdf_object.cpp
+++ b/core/fpdfapi/parser/cpdf_object.cpp
@@ -39,12 +39,12 @@
return Clone();
}
-CFX_ByteString CPDF_Object::GetString() const {
- return CFX_ByteString();
+ByteString CPDF_Object::GetString() const {
+ return ByteString();
}
-CFX_WideString CPDF_Object::GetUnicodeText() const {
- return CFX_WideString();
+WideString CPDF_Object::GetUnicodeText() const {
+ return WideString();
}
float CPDF_Object::GetNumber() const {
@@ -59,7 +59,7 @@
return nullptr;
}
-void CPDF_Object::SetString(const CFX_ByteString& str) {
+void CPDF_Object::SetString(const ByteString& str) {
NOTREACHED();
}
diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h
index a07ba67..4d4279f 100644
--- a/core/fpdfapi/parser/cpdf_object.h
+++ b/core/fpdfapi/parser/cpdf_object.h
@@ -55,13 +55,13 @@
virtual std::unique_ptr<CPDF_Object> CloneDirectObject() const;
virtual CPDF_Object* GetDirect() const;
- virtual CFX_ByteString GetString() const;
- virtual CFX_WideString GetUnicodeText() const;
+ virtual ByteString GetString() const;
+ virtual WideString GetUnicodeText() const;
virtual float GetNumber() const;
virtual int GetInteger() const;
virtual CPDF_Dictionary* GetDict() const;
- virtual void SetString(const CFX_ByteString& str);
+ virtual void SetString(const ByteString& str);
virtual bool IsArray() const;
virtual bool IsBoolean() const;
diff --git a/core/fpdfapi/parser/cpdf_object_walker.cpp b/core/fpdfapi/parser/cpdf_object_walker.cpp
index c6e0f00..cb59a05 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.cpp
+++ b/core/fpdfapi/parser/cpdf_object_walker.cpp
@@ -57,11 +57,11 @@
dict_iterator_ = object()->GetDict()->begin();
}
- const CFX_ByteString& dict_key() const { return dict_key_; }
+ const ByteString& dict_key() const { return dict_key_; }
private:
CPDF_Dictionary::const_iterator dict_iterator_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
};
class ArrayIterator : public CPDF_ObjectWalker::SubobjectIterator {
@@ -149,11 +149,11 @@
parent_object_ = it->object();
dict_key_ = parent_object_->IsDictionary()
? static_cast<DictionaryIterator*>(it)->dict_key()
- : CFX_ByteString();
+ : ByteString();
current_depth_ = stack_.size();
}
}
- dict_key_ = CFX_ByteString();
+ dict_key_ = ByteString();
current_depth_ = 0;
return nullptr;
}
diff --git a/core/fpdfapi/parser/cpdf_object_walker.h b/core/fpdfapi/parser/cpdf_object_walker.h
index 5590440..8cad3c3 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.h
+++ b/core/fpdfapi/parser/cpdf_object_walker.h
@@ -41,7 +41,7 @@
size_t current_depth() const { return current_depth_; }
const CPDF_Object* GetParent() const { return parent_object_; }
- const CFX_ByteString& dictionary_key() const { return dict_key_; }
+ const ByteString& dictionary_key() const { return dict_key_; }
private:
static std::unique_ptr<SubobjectIterator> MakeIterator(
@@ -50,7 +50,7 @@
const CPDF_Object* next_object_;
const CPDF_Object* parent_object_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
size_t current_depth_;
std::stack<std::unique_ptr<SubobjectIterator>> stack_;
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a9cad02..b0a8126 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -239,7 +239,7 @@
m_pSyntax->GetKeyword();
bool bNumber;
- CFX_ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
if (!bNumber)
return FORMAT_ERROR;
@@ -314,7 +314,7 @@
}
if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
+ ByteString filter = m_pEncryptDict->GetStringFor("Filter");
if (filter != "Standard")
return HANDLER_ERROR;
@@ -364,7 +364,7 @@
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
m_pSyntax->SetPos(it.second.pos);
bool is_num = false;
- CFX_ByteString num_str = m_pSyntax->GetNextWord(&is_num);
+ ByteString num_str = m_pSyntax->GetNextWord(&is_num);
m_pSyntax->SetPos(SavedPos);
if (!is_num || num_str.IsEmpty() ||
FXSYS_atoui(num_str.c_str()) != it.first) {
@@ -593,7 +593,7 @@
while (1) {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (word.IsEmpty()) {
return false;
}
@@ -884,7 +884,7 @@
m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) {
auto it = pTrailer->begin();
while (it != pTrailer->end()) {
- const CFX_ByteString& key = it->first;
+ const ByteString& key = it->first;
CPDF_Object* pElement = it->second.get();
++it;
uint32_t dwObjNum =
@@ -903,11 +903,10 @@
: std::move(pObj)));
FX_FILESIZE dwSavePos = m_pSyntax->GetPos();
- CFX_ByteString strWord = m_pSyntax->GetKeyword();
+ ByteString strWord = m_pSyntax->GetKeyword();
if (!strWord.Compare("startxref")) {
bool bNumber;
- CFX_ByteString bsOffset =
- m_pSyntax->GetNextWord(&bNumber);
+ ByteString bsOffset = m_pSyntax->GetNextWord(&bNumber);
if (bNumber)
m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str());
}
@@ -1316,7 +1315,7 @@
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
return false;
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index b4d0bee..20bd6be 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -63,7 +63,7 @@
CPDF_Document* pDocument);
void SetPassword(const char* password) { m_Password = password; }
- CFX_ByteString GetPassword() { return m_Password; }
+ ByteString GetPassword() { return m_Password; }
CPDF_Dictionary* GetTrailer() const;
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
@@ -199,7 +199,7 @@
CFX_UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
FX_FILESIZE m_LastXRefOffset;
std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
- CFX_ByteString m_Password;
+ ByteString m_Password;
std::unique_ptr<TrailerData> m_TrailerData;
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
uint32_t m_dwLinearizedFirstPageXRefStartObjNum;
diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp
index ce4c308..2ca0bdd 100644
--- a/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/core/fpdfapi/parser/cpdf_reference.cpp
@@ -20,9 +20,9 @@
return REFERENCE;
}
-CFX_ByteString CPDF_Reference::GetString() const {
+ByteString CPDF_Reference::GetString() const {
CPDF_Object* obj = SafeGetDirect();
- return obj ? obj->GetString() : CFX_ByteString();
+ return obj ? obj->GetString() : ByteString();
}
float CPDF_Reference::GetNumber() const {
diff --git a/core/fpdfapi/parser/cpdf_reference.h b/core/fpdfapi/parser/cpdf_reference.h
index ab16030..f564ab5 100644
--- a/core/fpdfapi/parser/cpdf_reference.h
+++ b/core/fpdfapi/parser/cpdf_reference.h
@@ -24,7 +24,7 @@
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Object* GetDirect() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
CPDF_Dictionary* GetDict() const override;
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 03b90ab..b838e9c 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -42,12 +42,12 @@
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetStringFor("O");
+ ByteString okey = pEncrypt->GetStringFor("O");
CRYPT_MD5Update(&md5, (uint8_t*)okey.c_str(), okey.GetLength());
uint32_t perm = pEncrypt->GetIntegerFor("P");
CRYPT_MD5Update(&md5, (uint8_t*)&perm, 4);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
@@ -97,7 +97,7 @@
}
bool CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
- CFX_ByteString password = m_pParser->GetPassword();
+ ByteString password = m_pParser->GetPassword();
if (!password.IsEmpty() &&
CheckPassword(password.raw_str(), password.GetLength(), true,
m_EncryptKey, key_len)) {
@@ -113,7 +113,7 @@
}
static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
- const CFX_ByteString& name,
+ const ByteString& name,
int& cipher,
int& keylen) {
int Version = pEncryptDict->GetIntegerFor("V");
@@ -144,7 +144,7 @@
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetStringFor("CFM");
+ ByteString cipher_name = pDefFilter->GetStringFor("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
@@ -164,10 +164,10 @@
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
if (m_Version < 4)
- return LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
+ return LoadCryptInfo(pEncryptDict, ByteString(), m_Cipher, m_KeyLen);
- CFX_ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
- CFX_ByteString strf_name = pEncryptDict->GetStringFor("StrF");
+ ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
+ ByteString strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
return false;
@@ -183,8 +183,8 @@
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
- CFX_ByteString strf_name;
- CFX_ByteString stmf_name;
+ ByteString strf_name;
+ ByteString stmf_name;
if (m_Version >= 4) {
stmf_name = pEncryptDict->GetStringFor("StmF");
strf_name = pEncryptDict->GetStringFor("StrF");
@@ -310,11 +310,11 @@
if (!m_pEncryptDict)
return false;
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
if (okey.GetLength() < 48)
return false;
- CFX_ByteString ukey = m_pEncryptDict->GetStringFor("U");
+ ByteString ukey = m_pEncryptDict->GetStringFor("U");
if (ukey.GetLength() < 48)
return false;
@@ -351,9 +351,9 @@
CRYPT_SHA256Finish(&sha, digest);
}
- CFX_ByteString ekey = m_pEncryptDict
- ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
- : CFX_ByteString();
+ ByteString ekey = m_pEncryptDict
+ ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
+ : ByteString();
if (ekey.GetLength() < 32)
return false;
@@ -366,7 +366,7 @@
CRYPT_AESDecrypt(&aes, key, ekey.raw_str(), 32);
CRYPT_AESSetKey(&aes, 16, key, 32, false);
CRYPT_AESSetIV(&aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetStringFor("Perms");
+ ByteString perms = m_pEncryptDict->GetStringFor("Perms");
if (perms.IsEmpty())
return false;
@@ -415,8 +415,8 @@
int32_t key_len) {
CalcEncryptKey(m_pEncryptDict.Get(), password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
- CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
+ ByteString ukey =
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : ByteString();
if (ukey.GetLength() < 16) {
return false;
}
@@ -443,7 +443,7 @@
CRYPT_MD5Update(&md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(&md5, ukeybuf);
@@ -452,10 +452,10 @@
return memcmp(ukey.c_str(), ukeybuf, 16) == 0;
}
-CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len) {
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
uint8_t passcode[32];
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
@@ -496,13 +496,13 @@
while (len && defpasscode[len - 1] == okeybuf[len - 1]) {
len--;
}
- return CFX_ByteString(okeybuf, len);
+ return ByteString(okeybuf, len);
}
bool CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
uint32_t pass_size,
uint8_t* key,
int32_t key_len) {
- CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
+ ByteString user_pass = GetUserPassword(password, pass_size, key_len);
if (CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), false, key,
key_len)) {
return true;
@@ -575,8 +575,7 @@
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
- pEncryptDict->SetNewFor<CPDF_String>("O", CFX_ByteString(passcode, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("O", ByteString(passcode, 32), false);
}
CalcEncryptKey(m_pEncryptDict.Get(), (uint8_t*)user_pass, user_size,
m_EncryptKey, key_len, false, pIdArray);
@@ -584,14 +583,13 @@
uint8_t tempbuf[32];
memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(tempbuf, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(tempbuf, 32), false);
} else {
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, defpasscode, 32);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
uint8_t digest[32];
@@ -605,8 +603,7 @@
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
CRYPT_MD5Generate(digest, 16, digest + 16);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(digest, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(digest, 32), false);
}
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -640,7 +637,7 @@
uint8_t digest[20];
CRYPT_SHA1Finish(&sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetStringFor("U");
+ ByteString ukey = pEncryptDict->GetStringFor("U");
CRYPT_sha2_context sha2;
uint8_t digest1[48];
if (m_Revision >= 6) {
@@ -657,7 +654,7 @@
}
memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "O" : "U",
- CFX_ByteString(digest1, 48), false);
+ ByteString(digest1, 48), false);
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
bOwner ? ukey.raw_str() : nullptr, digest1);
@@ -678,7 +675,7 @@
CRYPT_AESSetIV(&aes, iv);
CRYPT_AESEncrypt(&aes, digest1, key, 32);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "OE" : "UE",
- CFX_ByteString(digest1, 32), false);
+ ByteString(digest1, 32), false);
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
@@ -709,6 +706,5 @@
uint8_t buf1[16];
CRYPT_AESEncrypt(&aes, buf1, buf, 16);
- pEncryptDict->SetNewFor<CPDF_String>("Perms", CFX_ByteString(buf1, 16),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("Perms", ByteString(buf1, 16), false);
}
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index 27f7f7c..eb7d13f 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -46,9 +46,9 @@
uint32_t user_size,
uint32_t type = PDF_ENCRYPT_CONTENT);
- CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len);
+ ByteString GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len);
bool CheckPassword(const uint8_t* password,
uint32_t pass_size,
bool bOwner,
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.cpp b/core/fpdfapi/parser/cpdf_simple_parser.cpp
index 650c216..d800796 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser.cpp
@@ -11,7 +11,7 @@
CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize)
: m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {}
-CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str)
+CPDF_SimpleParser::CPDF_SimpleParser(const ByteStringView& str)
: m_pData(str.raw_str()), m_dwSize(str.GetLength()), m_dwCurPos(0) {}
void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
@@ -91,7 +91,7 @@
}
}
-CFX_ByteStringC CPDF_SimpleParser::GetWord() {
+ByteStringView CPDF_SimpleParser::GetWord() {
const uint8_t* pStart;
uint32_t dwSize;
ParseWord(pStart, dwSize);
@@ -102,8 +102,8 @@
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
if (dwSize == 1 && pStart[0] == '(') {
int level = 1;
@@ -130,13 +130,13 @@
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
- return CFX_ByteStringC(pStart, dwSize);
+ return ByteStringView(pStart, dwSize);
}
-bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
+bool CPDF_SimpleParser::FindTagParamFromStart(const ByteStringView& token,
int nParams) {
nParams++;
uint32_t* pBuf = FX_Alloc(uint32_t, nParams);
@@ -152,7 +152,7 @@
if (buf_count > nParams) {
buf_count = nParams;
}
- CFX_ByteStringC word = GetWord();
+ ByteStringView word = GetWord();
if (word.IsEmpty()) {
FX_Free(pBuf);
return false;
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.h b/core/fpdfapi/parser/cpdf_simple_parser.h
index 0ff6985..72cf700 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.h
+++ b/core/fpdfapi/parser/cpdf_simple_parser.h
@@ -13,13 +13,13 @@
class CPDF_SimpleParser {
public:
CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize);
- explicit CPDF_SimpleParser(const CFX_ByteStringC& str);
+ explicit CPDF_SimpleParser(const ByteStringView& str);
- CFX_ByteStringC GetWord();
+ ByteStringView GetWord();
// Find the token and its |nParams| parameters from the start of data,
// and move the current position to the start of those parameters.
- bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
+ bool FindTagParamFromStart(const ByteStringView& token, int nParams);
// For testing only.
uint32_t GetCurPos() const { return m_dwCurPos; }
diff --git a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
index bdb532d..a2f4338 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
@@ -50,7 +50,7 @@
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const pdfium::StrFuncTestData& data = test_data[i];
CPDF_SimpleParser parser(data.input, data.input_size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected),
data.expected_size),
std::string(word.unterminated_c_str(), word.GetLength()))
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index fadaec1..c00096d 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -145,7 +145,7 @@
return m_pDict && m_pDict->KeyExist("Filter");
}
-CFX_WideString CPDF_Stream::GetUnicodeText() const {
+WideString CPDF_Stream::GetUnicodeText() const {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
pAcc->LoadAllData(false);
return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize());
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 3c3b674..be70e05 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -30,7 +30,7 @@
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Dictionary* GetDict() const override;
- CFX_WideString GetUnicodeText() const override;
+ WideString GetUnicodeText() const override;
bool IsStream() const override;
CPDF_Stream* AsStream() override;
const CPDF_Stream* AsStream() const override;
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index bc03cb0..2161dd1 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -34,7 +34,7 @@
const uint8_t* GetData() const;
uint32_t GetSize() const;
- const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; }
+ const ByteString& GetImageDecoder() const { return m_ImageDecoder; }
const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
@@ -45,7 +45,7 @@
uint8_t* m_pData;
uint32_t m_dwSize;
bool m_bNewBuf;
- CFX_ByteString m_ImageDecoder;
+ ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
CFX_UnownedPtr<const CPDF_Stream> const m_pStream;
uint8_t* m_pSrcData;
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 6ce6bf3..1539861 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -14,16 +14,16 @@
CPDF_String::CPDF_String() : m_bHex(false) {}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex)
: m_String(str), m_bHex(bHex) {
if (pPool)
m_String = pPool->Intern(m_String);
}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_WideString& str)
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const WideString& str)
: m_String(PDF_EncodeText(str)), m_bHex(false) {
if (pPool)
m_String = pPool->Intern(m_String);
@@ -42,11 +42,11 @@
return std::move(pRet);
}
-CFX_ByteString CPDF_String::GetString() const {
+ByteString CPDF_String::GetString() const {
return m_String;
}
-void CPDF_String::SetString(const CFX_ByteString& str) {
+void CPDF_String::SetString(const ByteString& str) {
m_String = str;
}
@@ -62,11 +62,11 @@
return this;
}
-CFX_WideString CPDF_String::GetUnicodeText() const {
+WideString CPDF_String::GetUnicodeText() const {
return PDF_DecodeText(m_String);
}
bool CPDF_String::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(
- PDF_EncodeString(GetString(), IsHex()).AsStringC());
+ PDF_EncodeString(GetString(), IsHex()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index ccd6f53..9fd3e6a 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -18,18 +18,18 @@
class CPDF_String : public CPDF_Object {
public:
CPDF_String();
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex);
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_WideString& str);
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool, const WideString& str);
~CPDF_String() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsString() const override;
CPDF_String* AsString() override;
const CPDF_String* AsString() const override;
@@ -38,7 +38,7 @@
bool IsHex() const { return m_bHex; }
protected:
- CFX_ByteString m_String;
+ ByteString m_String;
bool m_bHex;
};
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 779bf81..4412105 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -41,10 +41,9 @@
int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0;
CPDF_SyntaxParser::CPDF_SyntaxParser()
- : CPDF_SyntaxParser(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_SyntaxParser(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_SyntaxParser::CPDF_SyntaxParser(
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_SyntaxParser::CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_MetadataObjnum(0),
m_pFileAccess(nullptr),
m_pFileBuf(nullptr),
@@ -187,10 +186,10 @@
}
}
-CFX_ByteString CPDF_SyntaxParser::ReadString() {
+ByteString CPDF_SyntaxParser::ReadString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
int32_t parlevel = 0;
@@ -201,7 +200,7 @@
case ReadStatus::Normal:
if (ch == ')') {
if (parlevel == 0)
- return CFX_ByteString(buf);
+ return ByteString(buf);
parlevel--;
} else if (ch == '(') {
parlevel++;
@@ -270,13 +269,13 @@
}
GetNextChar(ch);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
+ByteString CPDF_SyntaxParser::ReadHexString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
bool bFirst = true;
@@ -302,7 +301,7 @@
if (!bFirst)
buf << static_cast<char>(code);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
void CPDF_SyntaxParser::ToNextLine() {
@@ -344,20 +343,20 @@
m_Pos--;
}
-CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
GetNextWordInternal(bIsNumber);
return GetValidator()->has_read_problems()
- ? CFX_ByteString()
- : CFX_ByteString((const char*)m_WordBuffer, m_WordSize);
+ ? ByteString()
+ : ByteString((const char*)m_WordBuffer, m_WordSize);
}
-CFX_ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
const CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
return GetNextWord(bIsNumber);
}
-CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
+ByteString CPDF_SyntaxParser::GetKeyword() {
return GetNextWord(nullptr);
}
@@ -386,15 +385,15 @@
FX_FILESIZE SavedObjPos = m_Pos;
bool bIsNumber;
- CFX_ByteString word = GetNextWord(&bIsNumber);
+ ByteString word = GetNextWord(&bIsNumber);
if (word.GetLength() == 0)
return nullptr;
if (bIsNumber) {
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(&bIsNumber);
+ ByteString nextword = GetNextWord(&bIsNumber);
if (bIsNumber) {
- CFX_ByteString nextword2 = GetNextWord(nullptr);
+ ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
uint32_t refnum = FXSYS_atoui(word.c_str());
if (refnum == CPDF_Object::kInvalidObjNum)
@@ -403,7 +402,7 @@
}
}
m_Pos = SavedPos;
- return pdfium::MakeUnique<CPDF_Number>(word.AsStringC());
+ return pdfium::MakeUnique<CPDF_Number>(word.AsStringView());
}
if (word == "true" || word == "false")
@@ -413,13 +412,13 @@
return pdfium::MakeUnique<CPDF_Null>();
if (word == "(") {
- CFX_ByteString str = ReadString();
+ ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
- CFX_ByteString str = ReadHexString();
+ ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
@@ -437,14 +436,14 @@
if (word[0] == '/') {
return pdfium::MakeUnique<CPDF_Name>(
m_pPool,
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
FX_FILESIZE dwSignValuePos = 0;
std::unique_ptr<CPDF_Dictionary> pDict =
pdfium::MakeUnique<CPDF_Dictionary>(m_pPool);
while (1) {
- CFX_ByteString key = GetNextWord(nullptr);
+ ByteString key = GetNextWord(nullptr);
if (key.IsEmpty())
return nullptr;
@@ -477,7 +476,7 @@
}
if (!key.IsEmpty()) {
- CFX_ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
+ ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
pDict->SetFor(keyNoSlash, std::move(pObj));
}
}
@@ -492,7 +491,7 @@
}
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(nullptr);
+ ByteString nextword = GetNextWord(nullptr);
if (nextword != "stream") {
m_Pos = SavedPos;
return std::move(pDict);
@@ -526,7 +525,7 @@
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
const FX_FILESIZE saved_pos = GetPos();
bool is_number = false;
- CFX_ByteString word = GetNextWord(&is_number);
+ ByteString word = GetNextWord(&is_number);
if (!is_number || word.IsEmpty()) {
SetPos(saved_pos);
return nullptr;
@@ -588,8 +587,8 @@
ToNextLine();
FX_FILESIZE streamStartPos = m_Pos;
- const CFX_ByteStringC kEndStreamStr("endstream");
- const CFX_ByteStringC kEndObjStr("endobj");
+ const ByteStringView kEndStreamStr("endstream");
+ const ByteStringView kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
objnum == m_MetadataObjnum ? nullptr : m_pCryptoHandler.Get();
@@ -757,7 +756,7 @@
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword) {
const uint32_t taglen = tag.GetLength();
@@ -783,7 +782,7 @@
return true;
}
-bool CPDF_SyntaxParser::BackwardsSearchToWord(const CFX_ByteStringC& tag,
+bool CPDF_SyntaxParser::BackwardsSearchToWord(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
if (taglen == 0)
@@ -817,7 +816,7 @@
}
}
-FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag,
+FX_FILESIZE CPDF_SyntaxParser::FindTag(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
int32_t match = 0;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 179058e..4e28c2f 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -26,7 +26,7 @@
enum class ParseType { kStrict, kLoose };
CPDF_SyntaxParser();
- explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_SyntaxParser();
void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
@@ -56,16 +56,16 @@
bool bDecrypt,
ParseType parse_type);
- CFX_ByteString GetKeyword();
+ ByteString GetKeyword();
void ToNextLine();
void ToNextWord();
- bool BackwardsSearchToWord(const CFX_ByteStringC& word, FX_FILESIZE limit);
- FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
+ bool BackwardsSearchToWord(const ByteStringView& word, FX_FILESIZE limit);
+ FX_FILESIZE FindTag(const ByteStringView& tag, FX_FILESIZE limit);
void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
bool ReadBlock(uint8_t* pBuf, uint32_t size);
bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
- CFX_ByteString GetNextWord(bool* bIsNumber);
- CFX_ByteString PeekNextWord(bool* bIsNumber);
+ ByteString GetNextWord(bool* bIsNumber);
+ ByteString PeekNextWord(bool* bIsNumber);
CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
@@ -88,11 +88,11 @@
void GetNextWordInternal(bool* bIsNumber);
bool IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
std::unique_ptr<CPDF_Stream> ReadStream(
std::unique_ptr<CPDF_Dictionary> pDict,
@@ -122,7 +122,7 @@
CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
uint32_t m_WordSize;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 77024f2..0180aaf 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -328,7 +328,7 @@
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms) {
CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
@@ -337,7 +337,7 @@
CPDF_Object* pParams =
pDict ? pDict->GetDirectObjectFor("DecodeParms") : nullptr;
- std::vector<std::pair<CFX_ByteString, CPDF_Object*>> DecoderArray;
+ std::vector<std::pair<ByteString, CPDF_Object*>> DecoderArray;
if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
CPDF_Array* pParamsArray = ToArray(pParams);
for (size_t i = 0; i < pDecoders->GetCount(); ++i) {
@@ -354,7 +354,7 @@
int nSize = pdfium::CollectionSize<int>(DecoderArray);
for (int i = 0; i < nSize; ++i) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
- CFX_ByteString decoder = DecoderArray[i].first;
+ ByteString decoder = DecoderArray[i].first;
CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
uint8_t* new_buf = nullptr;
uint32_t new_size = 0xFFFFFFFF;
@@ -415,8 +415,8 @@
return true;
}
-CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
- CFX_WideString result;
+WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
+ WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) ||
(src_data[0] == 0xff && src_data[1] == 0xfe))) {
bool bBE = src_data[0] == 0xfe;
@@ -455,16 +455,16 @@
return result;
}
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr) {
+WideString PDF_DecodeText(const ByteString& bstr) {
return PDF_DecodeText(reinterpret_cast<const uint8_t*>(bstr.c_str()),
bstr.GetLength());
}
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
+ByteString PDF_EncodeText(const wchar_t* pString, int len) {
if (len == -1)
len = FXSYS_wcslen(pString);
- CFX_ByteString result;
+ ByteString result;
char* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; ++i) {
@@ -502,11 +502,11 @@
return result;
}
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str) {
+ByteString PDF_EncodeText(const WideString& str) {
return PDF_EncodeText(str.c_str(), str.GetLength());
}
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
+ByteString PDF_EncodeString(const ByteString& src, bool bHex) {
std::ostringstream result;
int srclen = src.GetLength();
if (bHex) {
@@ -518,7 +518,7 @@
result << buf[1];
}
result << '>';
- return CFX_ByteString(result);
+ return ByteString(result);
}
result << '(';
for (int i = 0; i < srclen; ++i) {
@@ -536,7 +536,7 @@
result << static_cast<char>(ch);
}
result << ')';
- return CFX_ByteString(result);
+ return ByteString(result);
}
bool FlateEncode(const uint8_t* src_buf,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 23ca0a0..6650b68 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -17,14 +17,14 @@
// Indexed by 8-bit char code, contains unicode code points.
extern const uint16_t PDFDocEncoding[256];
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig);
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex);
-CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len);
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
+ByteString PDF_NameDecode(const ByteStringView& orig);
+ByteString PDF_NameDecode(const ByteString& orig);
+ByteString PDF_NameEncode(const ByteString& orig);
+ByteString PDF_EncodeString(const ByteString& src, bool bHex);
+WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
+WideString PDF_DecodeText(const ByteString& bstr);
+ByteString PDF_EncodeText(const wchar_t* pString, int len);
+ByteString PDF_EncodeText(const WideString& str);
bool FlateEncode(const uint8_t* src_buf,
uint32_t src_size,
@@ -90,7 +90,7 @@
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index c8e0c7a..ae30959 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -99,7 +99,7 @@
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const auto& test_case = test_data[i];
- CFX_ByteString output = PDF_EncodeText(test_case.input);
+ ByteString output = PDF_EncodeText(test_case.input);
ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
<< i;
const char* str_ptr = output.c_str();
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index c6487f5..8280452 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -84,17 +84,17 @@
return kInvalidHeaderOffset;
}
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key) {
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key) {
CPDF_Number* pObj = ToNumber(pDict->GetObjectFor(key));
return pObj ? pObj->GetInteger() : 0;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
+ByteString PDF_NameDecode(const ByteStringView& bstr) {
if (!bstr.Contains('#'))
- return CFX_ByteString(bstr);
+ return ByteString(bstr);
int size = bstr.GetLength();
- CFX_ByteString result;
+ ByteString result;
char* pDestStart = result.GetBuffer(size);
char* pDest = pDestStart;
for (int i = 0; i < size; i++) {
@@ -110,11 +110,11 @@
return result;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) {
- return orig.Contains("#") ? PDF_NameDecode(orig.AsStringC()) : orig;
+ByteString PDF_NameDecode(const ByteString& orig) {
+ return orig.Contains("#") ? PDF_NameDecode(orig.AsStringView()) : orig;
}
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
+ByteString PDF_NameEncode(const ByteString& orig) {
uint8_t* src_buf = (uint8_t*)orig.c_str();
int src_len = orig.GetLength();
int dest_len = 0;
@@ -131,7 +131,7 @@
if (dest_len == src_len)
return orig;
- CFX_ByteString res;
+ ByteString res;
char* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
@@ -167,7 +167,7 @@
buf << PDF_EncodeString(pObj->GetString(), pObj->AsString()->IsHex());
break;
case CPDF_Object::NAME: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
buf << "/" << PDF_NameEncode(str);
break;
}
@@ -193,7 +193,7 @@
const CPDF_Dictionary* p = pObj->AsDictionary();
buf << "<<";
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
buf << "/" << PDF_NameEncode(key);
if (pValue && !pValue->IsInline()) {
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 94ee1fc..5f85551 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -41,7 +41,7 @@
// |kInvalidHeaderOffset|.
int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key);
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key);
std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj);
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index f5882d9..f286474 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -37,7 +37,7 @@
FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++];
if (pCIDFont)
charpos.m_bFontStyle = true;
- CFX_WideString unicode = pFont->UnicodeFromCharCode(CharCode);
+ WideString unicode = pFont->UnicodeFromCharCode(CharCode);
charpos.m_Unicode = !unicode.IsEmpty() ? unicode[0] : CharCode;
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
uint32_t GlyphID = charpos.m_GlyphIndex;
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 08bde6e..86a01c5 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -317,7 +317,7 @@
int CPDF_DIBSource::ContinueLoadDIBSource(IFX_PauseIndicator* pPause) {
FXCODEC_STATUS ret;
if (m_Status == 1) {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder == "JPXDecode") {
return 0;
}
@@ -397,7 +397,7 @@
if (!m_bImageMask) {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
- CFX_ByteString filter;
+ ByteString filter;
if (pFilter->IsName()) {
filter = pFilter->GetString();
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
@@ -432,7 +432,7 @@
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
- CFX_ByteString cs = pCSObj->GetString();
+ ByteString cs = pCSObj->GetString();
if (cs == "DeviceGray")
m_nComponents = 1;
else if (cs == "DeviceRGB")
@@ -500,7 +500,7 @@
}
int CPDF_DIBSource::CreateDecoder() {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder.IsEmpty())
return 1;
@@ -841,7 +841,7 @@
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
if (pFilter->IsName()) {
- CFX_ByteString filter = pFilter->GetString();
+ ByteString filter = pFilter->GetString();
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
@@ -853,7 +853,7 @@
m_bpc = 8;
}
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
- CFX_ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
+ ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index fafa18e..75a381c 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -556,7 +556,7 @@
return;
if (pFilters->IsName()) {
- CFX_ByteString bsDecodeType = pFilters->GetString();
+ ByteString bsDecodeType = pFilters->GetString();
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode")
m_Flags |= FXRENDER_IMAGE_LOSSY;
return;
@@ -567,7 +567,7 @@
return;
for (size_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString bsDecodeType = pArray->GetStringAt(i);
+ ByteString bsDecodeType = pArray->GetStringAt(i);
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
break;
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 83e6147..283d994 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -76,7 +76,7 @@
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h
index 31c44d9..ac8c8c5 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/core/fpdfapi/render/cpdf_textrenderer.h
@@ -28,7 +28,7 @@
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* matrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions);
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index f113e7a..b87b5ef 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -92,7 +92,7 @@
keygen.Generate(
4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000),
FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000));
- CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
CPDF_Type3Glyphs* pSizeCache;
auto it = m_SizeMap.find(FaceGlyphsKey);
if (it == m_SizeMap.end()) {
diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h
index 36a1d6f..ab748ba 100644
--- a/core/fpdfapi/render/cpdf_type3cache.h
+++ b/core/fpdfapi/render/cpdf_type3cache.h
@@ -39,7 +39,7 @@
float retinaScaleY);
CFX_UnownedPtr<CPDF_Type3Font> const m_pFont;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
+ std::map<ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 4d9e630..9d28bc1 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -33,7 +33,7 @@
if (!m_pDict)
return CPDF_Dest();
- CFX_ByteString type = m_pDict->GetStringFor("S");
+ ByteString type = m_pDict->GetStringFor("S");
if (type != "GoTo" && type != "GoToR")
return CPDF_Dest();
@@ -54,7 +54,7 @@
if (!m_pDict)
return Unknown;
- CFX_ByteString csType = m_pDict->GetStringFor("S");
+ ByteString csType = m_pDict->GetStringFor("S");
if (csType.IsEmpty())
return Unknown;
@@ -65,11 +65,11 @@
return Unknown;
}
-CFX_WideString CPDF_Action::GetFilePath() const {
- CFX_ByteString type = m_pDict->GetStringFor("S");
+WideString CPDF_Action::GetFilePath() const {
+ ByteString type = m_pDict->GetStringFor("S");
if (type != "GoToR" && type != "Launch" && type != "SubmitForm" &&
type != "ImportData") {
- return CFX_WideString();
+ return WideString();
}
CPDF_Object* pFile = m_pDict->GetDirectObjectFor("F");
@@ -79,14 +79,14 @@
if (type == "Launch") {
CPDF_Dictionary* pWinDict = m_pDict->GetDictFor("Win");
if (pWinDict) {
- return CFX_WideString::FromLocal(pWinDict->GetStringFor("F").AsStringC());
+ return WideString::FromLocal(pWinDict->GetStringFor("F").AsStringView());
}
}
- return CFX_WideString();
+ return WideString();
}
-CFX_ByteString CPDF_Action::GetURI(const CPDF_Document* pDoc) const {
- CFX_ByteString csURI;
+ByteString CPDF_Action::GetURI(const CPDF_Document* pDoc) const {
+ ByteString csURI;
if (!m_pDict)
return csURI;
if (m_pDict->GetStringFor("S") != "URI")
@@ -103,8 +103,8 @@
return csURI;
}
-CFX_WideString CPDF_Action::GetJavaScript() const {
- CFX_WideString csJS;
+WideString CPDF_Action::GetJavaScript() const {
+ WideString csJS;
if (!m_pDict)
return csJS;
diff --git a/core/fpdfdoc/cpdf_action.h b/core/fpdfdoc/cpdf_action.h
index be4d461..b405f22 100644
--- a/core/fpdfdoc/cpdf_action.h
+++ b/core/fpdfdoc/cpdf_action.h
@@ -45,12 +45,12 @@
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
ActionType GetType() const;
CPDF_Dest GetDest(CPDF_Document* pDoc) const;
- CFX_WideString GetFilePath() const;
- CFX_ByteString GetURI(const CPDF_Document* pDoc) const;
+ WideString GetFilePath() const;
+ ByteString GetURI(const CPDF_Document* pDoc) const;
bool GetHideStatus() const { return m_pDict->GetBooleanFor("H", true); }
- CFX_ByteString GetNamedAction() const { return m_pDict->GetStringFor("N"); }
+ ByteString GetNamedAction() const { return m_pDict->GetStringFor("N"); }
uint32_t GetFlags() const { return m_pDict->GetIntegerFor("Flags"); }
- CFX_WideString GetJavaScript() const;
+ WideString GetJavaScript() const;
size_t GetSubActionsCount() const;
CPDF_Action GetSubAction(size_t iIndex) const;
diff --git a/core/fpdfdoc/cpdf_actionfields.cpp b/core/fpdfdoc/cpdf_actionfields.cpp
index f3c3f5e..cee256d 100644
--- a/core/fpdfdoc/cpdf_actionfields.cpp
+++ b/core/fpdfdoc/cpdf_actionfields.cpp
@@ -23,7 +23,7 @@
if (!pDict)
return 0;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
@@ -50,7 +50,7 @@
if (!pDict)
return fields;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
@@ -80,7 +80,7 @@
if (!pDict)
return nullptr;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index ea15436..1a85380 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -179,12 +179,12 @@
return pStream;
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
- CFX_ByteString as = pAnnotDict->GetStringFor("AS");
+ ByteString as = pAnnotDict->GetStringFor("AS");
if (as.IsEmpty()) {
- CFX_ByteString value = pAnnotDict->GetStringFor("V");
+ ByteString value = pAnnotDict->GetStringFor("V");
if (value.IsEmpty()) {
CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
- value = pParentDict ? pParentDict->GetStringFor("V") : CFX_ByteString();
+ value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
as = "Off";
@@ -241,7 +241,7 @@
// Static.
CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype(
- const CFX_ByteString& sSubtype) {
+ const ByteString& sSubtype) {
if (sSubtype == "Text")
return CPDF_Annot::Subtype::TEXT;
if (sSubtype == "Link")
@@ -300,7 +300,7 @@
}
// Static.
-CFX_ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
+ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
if (nSubtype == CPDF_Annot::Subtype::TEXT)
return "Text";
if (nSubtype == CPDF_Annot::Subtype::LINK)
@@ -456,7 +456,7 @@
width = 1;
}
} else {
- CFX_ByteString style = pBS->GetStringFor("S");
+ ByteString style = pBS->GetStringFor("S");
pDashArray = pBS->GetArrayFor("D");
style_char = style[1];
width = pBS->GetNumberFor("W");
diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h
index 4ca1941..cf1b304 100644
--- a/core/fpdfdoc/cpdf_annot.h
+++ b/core/fpdfdoc/cpdf_annot.h
@@ -69,9 +69,8 @@
};
static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict);
- static CPDF_Annot::Subtype StringToAnnotSubtype(
- const CFX_ByteString& sSubtype);
- static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
+ static CPDF_Annot::Subtype StringToAnnotSubtype(const ByteString& sSubtype);
+ static ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
static CFX_FloatRect RectFromQuadPoints(CPDF_Dictionary* pAnnotDict);
// The second constructor does not take ownership of the dictionary.
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index df3b631..87e5ba7 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -35,7 +35,7 @@
// TODO(jaepark): We shouldn't strip BOM for some strings and not for others.
// See pdfium:593.
- CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
+ WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
if (sContents.IsEmpty())
return nullptr;
@@ -92,7 +92,7 @@
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
continue;
- const CFX_ByteString subtype = pDict->GetStringFor("Subtype");
+ const ByteString subtype = pDict->GetStringFor("Subtype");
if (subtype == "Popup") {
// Skip creating Popup annotations in the PDF document since PDFium
// provides its own Popup annotations.
diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp
index ee205e0..0fc9c20 100644
--- a/core/fpdfdoc/cpdf_apsettings.cpp
+++ b/core/fpdfdoc/cpdf_apsettings.cpp
@@ -18,7 +18,7 @@
CPDF_ApSettings::~CPDF_ApSettings() {}
-bool CPDF_ApSettings::HasMKEntry(const CFX_ByteString& csEntry) const {
+bool CPDF_ApSettings::HasMKEntry(const ByteString& csEntry) const {
return m_pDict && m_pDict->KeyExist(csEntry);
}
@@ -27,7 +27,7 @@
}
FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
iColorType = COLORTYPE_TRANSPARENT;
if (!m_pDict)
return 0;
@@ -65,7 +65,7 @@
}
float CPDF_ApSettings::GetOriginalColor(int index,
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
if (!m_pDict)
return 0;
@@ -75,7 +75,7 @@
void CPDF_ApSettings::GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
iColorType = COLORTYPE_TRANSPARENT;
for (int i = 0; i < 4; i++)
fc[i] = 0;
@@ -105,12 +105,11 @@
}
}
-CFX_WideString CPDF_ApSettings::GetCaption(
- const CFX_ByteString& csEntry) const {
- return m_pDict ? m_pDict->GetUnicodeTextFor(csEntry) : CFX_WideString();
+WideString CPDF_ApSettings::GetCaption(const ByteString& csEntry) const {
+ return m_pDict ? m_pDict->GetUnicodeTextFor(csEntry) : WideString();
}
-CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteString& csEntry) const {
+CPDF_Stream* CPDF_ApSettings::GetIcon(const ByteString& csEntry) const {
return m_pDict ? m_pDict->GetStreamFor(csEntry) : nullptr;
}
diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h
index 2f8f9e4..a2a1f91 100644
--- a/core/fpdfdoc/cpdf_apsettings.h
+++ b/core/fpdfdoc/cpdf_apsettings.h
@@ -23,7 +23,7 @@
CPDF_ApSettings(const CPDF_ApSettings& that);
~CPDF_ApSettings();
- bool HasMKEntry(const CFX_ByteString& csEntry) const;
+ bool HasMKEntry(const ByteString& csEntry) const;
int GetRotation() const;
FX_ARGB GetBorderColor(int& iColorType) const {
@@ -50,9 +50,9 @@
GetOriginalColor(iColorType, fc, "BG");
}
- CFX_WideString GetNormalCaption() const { return GetCaption("CA"); }
- CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); }
- CFX_WideString GetDownCaption() const { return GetCaption("AC"); }
+ WideString GetNormalCaption() const { return GetCaption("CA"); }
+ WideString GetRolloverCaption() const { return GetCaption("RC"); }
+ WideString GetDownCaption() const { return GetCaption("AC"); }
CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); }
CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); }
CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); }
@@ -62,14 +62,14 @@
private:
friend class CPDF_FormControl;
- FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const;
- float GetOriginalColor(int index, const CFX_ByteString& csEntry) const;
+ FX_ARGB GetColor(int& iColorType, const ByteString& csEntry) const;
+ float GetOriginalColor(int index, const ByteString& csEntry) const;
void GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) const;
+ const ByteString& csEntry) const;
- CFX_WideString GetCaption(const CFX_ByteString& csEntry) const;
- CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const;
+ WideString GetCaption(const ByteString& csEntry) const;
+ CPDF_Stream* GetIcon(const ByteString& csEntry) const;
CFX_UnownedPtr<CPDF_Dictionary> const m_pDict;
};
diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp
index e84001f..884c3cb 100644
--- a/core/fpdfdoc/cpdf_bookmark.cpp
+++ b/core/fpdfdoc/cpdf_bookmark.cpp
@@ -40,25 +40,25 @@
return m_pDict ? m_pDict->GetIntegerFor("F") : 0;
}
-CFX_WideString CPDF_Bookmark::GetTitle() const {
+WideString CPDF_Bookmark::GetTitle() const {
if (!m_pDict)
- return CFX_WideString();
+ return WideString();
CPDF_String* pString = ToString(m_pDict->GetDirectObjectFor("Title"));
if (!pString)
- return CFX_WideString();
+ return WideString();
- CFX_WideString title = pString->GetUnicodeText();
+ WideString title = pString->GetUnicodeText();
int len = title.GetLength();
if (!len)
- return CFX_WideString();
+ return WideString();
std::vector<wchar_t> buf(len);
for (int i = 0; i < len; i++) {
wchar_t w = title[i];
buf[i] = w > 0x20 ? w : 0x20;
}
- return CFX_WideString(buf.data(), len);
+ return WideString(buf.data(), len);
}
CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
diff --git a/core/fpdfdoc/cpdf_bookmark.h b/core/fpdfdoc/cpdf_bookmark.h
index b9a1ac6..88f47a9 100644
--- a/core/fpdfdoc/cpdf_bookmark.h
+++ b/core/fpdfdoc/cpdf_bookmark.h
@@ -25,7 +25,7 @@
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
uint32_t GetColorRef() const;
uint32_t GetFontStyle() const;
- CFX_WideString GetTitle() const;
+ WideString GetTitle() const;
CPDF_Dest GetDest(CPDF_Document* pDocument) const;
CPDF_Action GetAction() const;
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index 28213aa..bd7ea1b 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -16,16 +16,16 @@
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
return syntax.FindTagParamFromStart("Tf", 2);
}
-CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
- CFX_ByteString csFont;
+ByteString CPDF_DefaultAppearance::GetFontString() {
+ ByteString csFont;
if (m_csDA.IsEmpty())
return csFont;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tf", 2)) {
csFont += syntax.GetWord();
csFont += " ";
@@ -36,15 +36,15 @@
return csFont;
}
-CFX_ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) {
+ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) {
*fFontSize = 0.0f;
if (m_csDA.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString csFontNameTag;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ ByteString csFontNameTag;
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tf", 2)) {
- csFontNameTag = CFX_ByteString(syntax.GetWord());
+ csFontNameTag = ByteString(syntax.GetWord());
csFontNameTag.Delete(0, 1);
*fFontSize = FX_atof(syntax.GetWord());
}
@@ -55,7 +55,7 @@
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
return true;
@@ -68,13 +68,12 @@
(nOperation == PaintOperation::STROKE ? "K" : "k"), 4);
}
-CFX_ByteString CPDF_DefaultAppearance::GetColorString(
- PaintOperation nOperation) {
- CFX_ByteString csColor;
+ByteString CPDF_DefaultAppearance::GetColorString(PaintOperation nOperation) {
+ ByteString csColor;
if (m_csDA.IsEmpty())
return csColor;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
csColor += syntax.GetWord();
@@ -118,7 +117,7 @@
if (m_csDA.IsEmpty())
return;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
@@ -151,7 +150,7 @@
if (m_csDA.IsEmpty())
return;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
@@ -187,16 +186,16 @@
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
return syntax.FindTagParamFromStart("Tm", 6);
}
-CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
- CFX_ByteString csTM;
+ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
+ ByteString csTM;
if (m_csDA.IsEmpty())
return csTM;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tm", 6)) {
for (int i = 0; i < 6; i++) {
csTM += syntax.GetWord();
@@ -211,7 +210,7 @@
if (m_csDA.IsEmpty())
return CFX_Matrix();
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (!syntax.FindTagParamFromStart("Tm", 6))
return CFX_Matrix();
diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h
index 3be06e2..33d4bfd 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/core/fpdfdoc/cpdf_defaultappearance.h
@@ -19,21 +19,20 @@
class CPDF_DefaultAppearance {
public:
CPDF_DefaultAppearance() {}
- explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {}
+ explicit CPDF_DefaultAppearance(const ByteString& csDA) : m_csDA(csDA) {}
CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) {
m_csDA = cDA.GetStr();
}
- CFX_ByteString GetStr() const { return m_csDA; }
+ ByteString GetStr() const { return m_csDA; }
bool HasFont();
- CFX_ByteString GetFontString();
- CFX_ByteString GetFont(float* fFontSize);
+ ByteString GetFontString();
+ ByteString GetFont(float* fFontSize);
bool HasColor(PaintOperation nOperation = PaintOperation::FILL);
- CFX_ByteString GetColorString(
- PaintOperation nOperation = PaintOperation::FILL);
+ ByteString GetColorString(PaintOperation nOperation = PaintOperation::FILL);
void GetColor(int& iColorType,
float fc[4],
PaintOperation nOperation = PaintOperation::FILL);
@@ -42,11 +41,11 @@
PaintOperation nOperation = PaintOperation::FILL);
bool HasTextMatrix();
- CFX_ByteString GetTextMatrixString();
+ ByteString GetTextMatrixString();
CFX_Matrix GetTextMatrix();
private:
- CFX_ByteString m_csDA;
+ ByteString m_csDA;
};
#endif // CORE_FPDFDOC_CPDF_DEFAULTAPPEARANCE_H_
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index 3e1988d..ebe3834 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -65,7 +65,7 @@
if (!pObj)
return 0;
- CFX_ByteString mode = pObj->GetString();
+ ByteString mode = pObj->GetString();
for (int i = 0; g_sZoomModes[i]; ++i) {
if (mode == g_sZoomModes[i])
return i + 1;
@@ -126,6 +126,6 @@
return pArray ? pArray->GetNumberAt(2 + index) : 0;
}
-CFX_ByteString CPDF_Dest::GetRemoteName() {
- return m_pObj ? m_pObj->GetString() : CFX_ByteString();
+ByteString CPDF_Dest::GetRemoteName() {
+ return m_pObj ? m_pObj->GetString() : ByteString();
}
diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
index f029d4c..23964d7 100644
--- a/core/fpdfdoc/cpdf_dest.h
+++ b/core/fpdfdoc/cpdf_dest.h
@@ -22,7 +22,7 @@
~CPDF_Dest();
CPDF_Object* GetObject() const { return m_pObj.Get(); }
- CFX_ByteString GetRemoteName();
+ ByteString GetRemoteName();
int GetPageIndex(CPDF_Document* pDoc);
uint32_t GetPageObjNum();
int GetZoomMode();
diff --git a/core/fpdfdoc/cpdf_docjsactions.cpp b/core/fpdfdoc/cpdf_docjsactions.cpp
index 669ed70..974ca33 100644
--- a/core/fpdfdoc/cpdf_docjsactions.cpp
+++ b/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -18,9 +18,8 @@
return name_tree.GetCount();
}
-CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
- int index,
- CFX_WideString* csName) const {
+CPDF_Action CPDF_DocJSActions::GetJSActionAndName(int index,
+ WideString* csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValueAndName(index, csName);
@@ -28,7 +27,7 @@
: CPDF_Action();
}
-CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_WideString& csName) const {
+CPDF_Action CPDF_DocJSActions::GetJSAction(const WideString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
@@ -36,7 +35,7 @@
: CPDF_Action();
}
-int CPDF_DocJSActions::FindJSAction(const CFX_WideString& csName) const {
+int CPDF_DocJSActions::FindJSAction(const WideString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
return name_tree.GetIndex(csName);
diff --git a/core/fpdfdoc/cpdf_docjsactions.h b/core/fpdfdoc/cpdf_docjsactions.h
index 73c0a1e..c2652d7 100644
--- a/core/fpdfdoc/cpdf_docjsactions.h
+++ b/core/fpdfdoc/cpdf_docjsactions.h
@@ -19,9 +19,9 @@
~CPDF_DocJSActions();
int CountJSActions() const;
- CPDF_Action GetJSActionAndName(int index, CFX_WideString* csName) const;
- CPDF_Action GetJSAction(const CFX_WideString& csName) const;
- int FindJSAction(const CFX_WideString& csName) const;
+ CPDF_Action GetJSActionAndName(int index, WideString* csName) const;
+ CPDF_Action GetJSAction(const WideString& csName) const;
+ int FindJSAction(const WideString& csName) const;
CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
private:
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index e34f54e..803c414 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -20,8 +20,8 @@
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-CFX_WideString ChangeSlashToPlatform(const wchar_t* str) {
- CFX_WideString result;
+WideString ChangeSlashToPlatform(const wchar_t* str) {
+ WideString result;
while (*str) {
if (*str == '/') {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -37,8 +37,8 @@
return result;
}
-CFX_WideString ChangeSlashToPDF(const wchar_t* str) {
- CFX_WideString result;
+WideString ChangeSlashToPDF(const wchar_t* str) {
+ WideString result;
while (*str) {
if (*str == '\\' || *str == ':')
result += L'/';
@@ -59,12 +59,12 @@
CPDF_FileSpec::~CPDF_FileSpec() {}
-CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideString& filepath) {
+WideString CPDF_FileSpec::DecodeFileName(const WideString& filepath) {
if (filepath.GetLength() <= 1)
- return CFX_WideString();
+ return WideString();
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac"))
+ if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
return ChangeSlashToPlatform(filepath.c_str() + 1);
return ChangeSlashToPlatform(filepath.c_str());
#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -74,28 +74,28 @@
if (filepath[1] == L'/')
return ChangeSlashToPlatform(filepath.c_str() + 1);
if (filepath[2] == L'/') {
- CFX_WideString result;
+ WideString result;
result += filepath[1];
result += L':';
result += ChangeSlashToPlatform(filepath.c_str() + 2);
return result;
}
- CFX_WideString result;
+ WideString result;
result += L'\\';
result += ChangeSlashToPlatform(filepath.c_str());
return result;
#else
- return CFX_WideString(filepath);
+ return WideString(filepath);
#endif
}
-CFX_WideString CPDF_FileSpec::GetFileName() const {
- CFX_WideString csFileName;
+WideString CPDF_FileSpec::GetFileName() const {
+ WideString csFileName;
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
csFileName = pDict->GetUnicodeTextFor("UF");
if (csFileName.IsEmpty()) {
csFileName =
- CFX_WideString::FromLocal(pDict->GetStringFor("F").AsStringC());
+ WideString::FromLocal(pDict->GetStringFor("F").AsStringView());
}
if (pDict->GetStringFor("FS") == "URL")
return csFileName;
@@ -105,13 +105,13 @@
for (const auto* key : keys) {
if (pDict->KeyExist(key)) {
csFileName =
- CFX_WideString::FromLocal(pDict->GetStringFor(key).AsStringC());
+ WideString::FromLocal(pDict->GetStringFor(key).AsStringView());
break;
}
}
}
} else if (m_pObj->IsString()) {
- csFileName = CFX_WideString::FromLocal(m_pObj->GetString().AsStringC());
+ csFileName = WideString::FromLocal(m_pObj->GetString().AsStringView());
}
return DecodeFileName(csFileName);
}
@@ -131,7 +131,7 @@
constexpr const char* keys[] = {"UF", "F", "DOS", "Mac", "Unix"};
size_t end = pDict->GetStringFor("FS") == "URL" ? 2 : FX_ArraySize(keys);
for (size_t i = 0; i < end; ++i) {
- const CFX_ByteString& key = keys[i];
+ const ByteString& key = keys[i];
if (!pDict->GetUnicodeTextFor(key).IsEmpty()) {
CPDF_Stream* pStream = pFiles->GetStreamFor(key);
if (pStream)
@@ -153,13 +153,13 @@
return pDict->GetDictFor("Params");
}
-CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideString& filepath) {
+WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) {
if (filepath.GetLength() <= 1)
- return CFX_WideString();
+ return WideString();
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
if (filepath[1] == L':') {
- CFX_WideString result(L'/');
+ WideString result(L'/');
result += filepath[0];
if (filepath[2] != L'\\')
result += L'/';
@@ -178,17 +178,16 @@
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
#else
- return CFX_WideString(filepath);
+ return WideString(filepath);
#endif
}
-void CPDF_FileSpec::SetFileName(const CFX_WideString& wsFileName) {
- CFX_WideString wsStr = EncodeFileName(wsFileName);
+void CPDF_FileSpec::SetFileName(const WideString& wsFileName) {
+ WideString wsStr = EncodeFileName(wsFileName);
if (m_pObj->IsString()) {
- m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr));
+ m_pObj->SetString(ByteString::FromUnicode(wsStr));
} else if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- pDict->SetNewFor<CPDF_String>("F", CFX_ByteString::FromUnicode(wsStr),
- false);
+ pDict->SetNewFor<CPDF_String>("F", ByteString::FromUnicode(wsStr), false);
pDict->SetNewFor<CPDF_String>("UF", PDF_EncodeText(wsStr), false);
}
}
diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
index 8640b2e..2cbbc15 100644
--- a/core/fpdfdoc/cpdf_filespec.h
+++ b/core/fpdfdoc/cpdf_filespec.h
@@ -22,18 +22,18 @@
~CPDF_FileSpec();
// Convert a platform dependent file name into pdf format.
- static CFX_WideString EncodeFileName(const CFX_WideString& filepath);
+ static WideString EncodeFileName(const WideString& filepath);
// Convert a pdf file name into platform dependent format.
- static CFX_WideString DecodeFileName(const CFX_WideString& filepath);
+ static WideString DecodeFileName(const WideString& filepath);
CPDF_Object* GetObj() const { return m_pObj.Get(); }
- CFX_WideString GetFileName() const;
+ WideString GetFileName() const;
CPDF_Stream* GetFileStream() const;
CPDF_Dictionary* GetParamsDict() const;
// Set this file spec to refer to a file name (not a url).
- void SetFileName(const CFX_WideString& wsFileName);
+ void SetFileName(const WideString& wsFileName);
private:
CFX_UnownedPtr<CPDF_Object> const m_pObj;
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 555d196..62302fe 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -34,10 +34,10 @@
CPDF_FormControl::~CPDF_FormControl() {}
-CFX_ByteString CPDF_FormControl::GetOnStateName() const {
+ByteString CPDF_FormControl::GetOnStateName() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn;
+ ByteString csOn;
CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
if (!pAP)
return csOn;
@@ -50,19 +50,19 @@
if (it.first != "Off")
return it.first;
}
- return CFX_ByteString();
+ return ByteString();
}
-void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
+void CPDF_FormControl::SetOnStateName(const ByteString& csOn) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csValue = csOn;
+ ByteString csValue = csOn;
if (csValue.IsEmpty())
csValue = "Yes";
else if (csValue == "Off")
csValue = "Yes";
- CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
+ ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
if (csAS != "Off")
m_pWidgetDict->SetNewFor<CPDF_Name>("AS", csValue);
@@ -82,7 +82,7 @@
auto subdict_it = pSubDict->begin();
while (subdict_it != pSubDict->end()) {
- const CFX_ByteString& csKey2 = subdict_it->first;
+ const ByteString& csKey2 = subdict_it->first;
CPDF_Object* pObj2 = subdict_it->second.get();
++subdict_it;
if (!pObj2)
@@ -95,10 +95,10 @@
}
}
-CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
+ByteString CPDF_FormControl::GetCheckedAPState() {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"))) {
@@ -111,10 +111,10 @@
return csOn;
}
-CFX_WideString CPDF_FormControl::GetExportValue() const {
+WideString CPDF_FormControl::GetExportValue() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
if (CPDF_Array* pArray =
@@ -131,8 +131,8 @@
bool CPDF_FormControl::IsChecked() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
- CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS");
+ ByteString csOn = GetOnStateName();
+ ByteString csAS = m_pWidgetDict->GetStringFor("AS");
return csAS == csOn;
}
@@ -143,17 +143,17 @@
if (!pDV)
return false;
- CFX_ByteString csDV = pDV->GetString();
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csDV = pDV->GetString();
+ ByteString csOn = GetOnStateName();
return (csDV == csOn);
}
void CPDF_FormControl::CheckControl(bool bChecked) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
- CFX_ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
- CFX_ByteString csAS = "Off";
+ ByteString csOn = GetOnStateName();
+ ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
+ ByteString csAS = "Off";
if (bChecked)
csAS = csOn;
if (csOldAS == csAS)
@@ -192,7 +192,7 @@
if (!m_pWidgetDict)
return Invert;
- CFX_ByteString csH = m_pWidgetDict->GetStringFor("H", "I");
+ ByteString csH = m_pWidgetDict->GetStringFor("H", "I");
for (size_t i = 0; i < FX_ArraySize(g_sHighlightingMode); ++i) {
if (csH == g_sHighlightingMode[i])
return static_cast<HighlightingMode>(i);
@@ -205,7 +205,7 @@
: nullptr);
}
-bool CPDF_FormControl::HasMKEntry(const CFX_ByteString& csEntry) const {
+bool CPDF_FormControl::HasMKEntry(const ByteString& csEntry) const {
return GetMK().HasMKEntry(csEntry);
}
@@ -213,27 +213,25 @@
return GetMK().GetRotation();
}
-FX_ARGB CPDF_FormControl::GetColor(int& iColorType,
- const CFX_ByteString& csEntry) {
+FX_ARGB CPDF_FormControl::GetColor(int& iColorType, const ByteString& csEntry) {
return GetMK().GetColor(iColorType, csEntry);
}
-float CPDF_FormControl::GetOriginalColor(int index,
- const CFX_ByteString& csEntry) {
+float CPDF_FormControl::GetOriginalColor(int index, const ByteString& csEntry) {
return GetMK().GetOriginalColor(index, csEntry);
}
void CPDF_FormControl::GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) {
+ const ByteString& csEntry) {
GetMK().GetOriginalColor(iColorType, fc, csEntry);
}
-CFX_WideString CPDF_FormControl::GetCaption(const CFX_ByteString& csEntry) {
+WideString CPDF_FormControl::GetCaption(const ByteString& csEntry) {
return GetMK().GetCaption(csEntry);
}
-CPDF_Stream* CPDF_FormControl::GetIcon(const CFX_ByteString& csEntry) {
+CPDF_Stream* CPDF_FormControl::GetIcon(const ByteString& csEntry) {
return GetMK().GetIcon(csEntry);
}
@@ -284,7 +282,7 @@
CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
float fFontSize;
CPDF_DefaultAppearance cDA = GetDefaultAppearance();
- CFX_ByteString csFontNameTag = cDA.GetFont(&fFontSize);
+ ByteString csFontNameTag = cDA.GetFont(&fFontSize);
if (csFontNameTag.IsEmpty())
return nullptr;
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index eb63b5b..4f686f4 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -61,14 +61,14 @@
CPDF_Annot::AppearanceMode mode,
const CPDF_RenderOptions* pOptions = nullptr);
- CFX_ByteString GetCheckedAPState();
- CFX_WideString GetExportValue() const;
+ ByteString GetCheckedAPState();
+ WideString GetExportValue() const;
bool IsChecked() const;
bool IsDefaultChecked() const;
HighlightingMode GetHighlightingMode();
- bool HasMKEntry(const CFX_ByteString& csEntry) const;
+ bool HasMKEntry(const ByteString& csEntry) const;
int GetRotation();
FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); }
@@ -93,9 +93,9 @@
GetOriginalColor(iColorType, fc, "BG");
}
- CFX_WideString GetNormalCaption() { return GetCaption("CA"); }
- CFX_WideString GetRolloverCaption() { return GetCaption("RC"); }
- CFX_WideString GetDownCaption() { return GetCaption("AC"); }
+ WideString GetNormalCaption() { return GetCaption("CA"); }
+ WideString GetRolloverCaption() { return GetCaption("RC"); }
+ WideString GetDownCaption() { return GetCaption("AC"); }
CPDF_Stream* GetNormalIcon() { return GetIcon("I"); }
CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); }
@@ -114,17 +114,17 @@
friend class CPDF_InterForm;
friend class CPDF_FormField;
- CFX_ByteString GetOnStateName() const;
- void SetOnStateName(const CFX_ByteString& csOn);
+ ByteString GetOnStateName() const;
+ void SetOnStateName(const ByteString& csOn);
void CheckControl(bool bChecked);
- FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry);
- float GetOriginalColor(int index, const CFX_ByteString& csEntry);
+ FX_ARGB GetColor(int& iColorType, const ByteString& csEntry);
+ float GetOriginalColor(int index, const ByteString& csEntry);
void GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry);
+ const ByteString& csEntry);
- CFX_WideString GetCaption(const CFX_ByteString& csEntry);
- CPDF_Stream* GetIcon(const CFX_ByteString& csEntry);
+ WideString GetCaption(const ByteString& csEntry);
+ CPDF_Stream* GetIcon(const ByteString& csEntry);
CPDF_ApSettings GetMK() const;
CPDF_FormField* const m_pField;
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index acb46a5..fec1945 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -65,13 +65,13 @@
return FPDF_GetFieldAttr(pParent, name, nLevel + 1);
}
-CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
- CFX_WideString full_name;
+WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
+ WideString full_name;
std::set<CPDF_Dictionary*> visited;
CPDF_Dictionary* pLevel = pFieldDict;
while (pLevel) {
visited.insert(pLevel);
- CFX_WideString short_name = pLevel->GetUnicodeTextFor("T");
+ WideString short_name = pLevel->GetUnicodeTextFor("T");
if (!short_name.IsEmpty()) {
if (full_name.IsEmpty())
full_name = short_name;
@@ -98,7 +98,7 @@
void CPDF_FormField::SyncFieldFlags() {
CPDF_Object* ft_attr = FPDF_GetFieldAttr(m_pDict.Get(), "FT");
- CFX_ByteString type_name = ft_attr ? ft_attr->GetString() : CFX_ByteString();
+ ByteString type_name = ft_attr ? ft_attr->GetString() : ByteString();
CPDF_Object* ff_attr = FPDF_GetFieldAttr(m_pDict.Get(), "Ff");
uint32_t flags = ff_attr ? ff_attr->GetInteger() : 0;
m_Flags = 0;
@@ -154,7 +154,7 @@
}
}
-CFX_WideString CPDF_FormField::GetFullName() const {
+WideString CPDF_FormField::GetFullName() const {
return FPDF_GetFullName(m_pDict.Get());
}
@@ -180,7 +180,7 @@
}
case CPDF_FormField::ComboBox:
case CPDF_FormField::ListBox: {
- CFX_WideString csValue;
+ WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0)
@@ -199,12 +199,12 @@
case CPDF_FormField::File:
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
- CFX_WideString csDValue;
+ WideString csDValue;
if (pDV)
csDValue = pDV->GetUnicodeText();
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict.Get(), "V");
- CFX_WideString csValue;
+ WideString csValue;
if (pV)
csValue = pV->GetUnicodeText();
@@ -272,12 +272,12 @@
return CPDF_AAction(pObj ? pObj->GetDict() : nullptr);
}
-CFX_WideString CPDF_FormField::GetAlternateName() const {
+WideString CPDF_FormField::GetAlternateName() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TU");
return pObj ? pObj->GetUnicodeText() : L"";
}
-CFX_WideString CPDF_FormField::GetMappingName() const {
+WideString CPDF_FormField::GetMappingName() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TM");
return pObj ? pObj->GetUnicodeText() : L"";
}
@@ -287,17 +287,17 @@
return pObj ? pObj->GetInteger() : 0;
}
-CFX_ByteString CPDF_FormField::GetDefaultStyle() const {
+ByteString CPDF_FormField::GetDefaultStyle() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "DS");
return pObj ? pObj->GetString() : "";
}
-CFX_WideString CPDF_FormField::GetRichTextString() const {
+WideString CPDF_FormField::GetRichTextString() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "RV");
return pObj ? pObj->GetUnicodeText() : L"";
}
-CFX_WideString CPDF_FormField::GetValue(bool bDefault) const {
+WideString CPDF_FormField::GetValue(bool bDefault) const {
if (GetType() == CheckBox || GetType() == RadioButton)
return GetCheckValue(bDefault);
@@ -310,7 +310,7 @@
pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
}
if (!pValue)
- return CFX_WideString();
+ return WideString();
}
switch (pValue->GetType()) {
@@ -325,18 +325,18 @@
default:
break;
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CPDF_FormField::GetValue() const {
+WideString CPDF_FormField::GetValue() const {
return GetValue(false);
}
-CFX_WideString CPDF_FormField::GetDefaultValue() const {
+WideString CPDF_FormField::GetDefaultValue() const {
return GetValue(true);
}
-bool CPDF_FormField::SetValue(const CFX_WideString& value,
+bool CPDF_FormField::SetValue(const WideString& value,
bool bDefault,
bool bNotify) {
switch (m_Type) {
@@ -349,14 +349,14 @@
case RichText:
case Text:
case ComboBox: {
- CFX_WideString csValue = value;
+ WideString csValue = value;
if (bNotify && !NotifyBeforeValueChange(csValue))
return false;
- CFX_ByteString key(bDefault ? "DV" : "V");
+ ByteString key(bDefault ? "DV" : "V");
int iIndex = FindOptionValue(csValue);
if (iIndex < 0) {
- CFX_ByteString bsEncodeText = PDF_EncodeText(csValue);
+ ByteString bsEncodeText = PDF_EncodeText(csValue);
m_pDict->SetNewFor<CPDF_String>(key, bsEncodeText, false);
if (m_Type == RichText && !bDefault)
m_pDict->SetNewFor<CPDF_String>("RV", bsEncodeText, false);
@@ -397,7 +397,7 @@
return true;
}
-bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bNotify) {
+bool CPDF_FormField::SetValue(const WideString& value, bool bNotify) {
return SetValue(value, false, bNotify);
}
@@ -440,7 +440,7 @@
if (pValue->IsNumber())
return pValue->GetInteger();
- CFX_WideString sel_value;
+ WideString sel_value;
if (pValue->IsString()) {
if (index != 0)
return -1;
@@ -451,12 +451,11 @@
return -1;
CPDF_Object* elementValue = pArray->GetDirectObjectAt(index);
- sel_value =
- elementValue ? elementValue->GetUnicodeText() : CFX_WideString();
+ sel_value = elementValue ? elementValue->GetUnicodeText() : WideString();
}
if (index < CountSelectedOptions()) {
int iOptIndex = GetSelectedOptionIndex(index);
- CFX_WideString csOpt = GetOptionValue(iOptIndex);
+ WideString csOpt = GetOptionValue(iOptIndex);
if (csOpt == sel_value)
return iOptIndex;
}
@@ -469,7 +468,7 @@
bool CPDF_FormField::ClearSelection(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -491,7 +490,7 @@
if (IsOptionSelected(index))
return true;
- CFX_WideString opt_value = GetOptionValue(index);
+ WideString opt_value = GetOptionValue(index);
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "V");
if (!pValue) {
pValue = FPDF_GetFieldAttr(m_pDict.Get(), "I");
@@ -532,7 +531,7 @@
if (index < 0 || index >= CountOptions())
return false;
- CFX_WideString opt_value = GetOptionValue(index);
+ WideString opt_value = GetOptionValue(index);
if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value))
return false;
@@ -598,7 +597,7 @@
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
if (!pValue)
return -1;
- CFX_WideString csDV = pValue->GetUnicodeText();
+ WideString csDV = pValue->GetUnicodeText();
if (csDV.IsEmpty())
return -1;
for (int i = 0; i < CountOptions(); i++) {
@@ -613,30 +612,30 @@
return pArray ? pArray->GetCount() : 0;
}
-CFX_WideString CPDF_FormField::GetOptionText(int index, int sub_index) const {
+WideString CPDF_FormField::GetOptionText(int index, int sub_index) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "Opt"));
if (!pArray)
- return CFX_WideString();
+ return WideString();
CPDF_Object* pOption = pArray->GetDirectObjectAt(index);
if (!pOption)
- return CFX_WideString();
+ return WideString();
if (CPDF_Array* pOptionArray = pOption->AsArray())
pOption = pOptionArray->GetDirectObjectAt(sub_index);
CPDF_String* pString = ToString(pOption);
- return pString ? pString->GetUnicodeText() : CFX_WideString();
+ return pString ? pString->GetUnicodeText() : WideString();
}
-CFX_WideString CPDF_FormField::GetOptionLabel(int index) const {
+WideString CPDF_FormField::GetOptionLabel(int index) const {
return GetOptionText(index, 1);
}
-CFX_WideString CPDF_FormField::GetOptionValue(int index) const {
+WideString CPDF_FormField::GetOptionValue(int index) const {
return GetOptionText(index, 0);
}
-int CPDF_FormField::FindOption(CFX_WideString csOptLabel) const {
+int CPDF_FormField::FindOption(WideString csOptLabel) const {
for (int i = 0; i < CountOptions(); i++) {
if (GetOptionValue(i) == csOptLabel)
return i;
@@ -644,7 +643,7 @@
return -1;
}
-int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue) const {
+int CPDF_FormField::FindOptionValue(const WideString& csOptValue) const {
for (int i = 0; i < CountOptions(); i++) {
if (GetOptionValue(i) == csOptValue)
return i;
@@ -653,7 +652,7 @@
}
#ifdef PDF_ENABLE_XFA
-int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
+int CPDF_FormField::InsertOption(WideString csOptLabel,
int index,
bool bNotify) {
if (csOptLabel.IsEmpty())
@@ -662,7 +661,7 @@
if (bNotify && !NotifyListOrComboBoxBeforeChange(csOptLabel))
return -1;
- CFX_ByteString csStr = PDF_EncodeText(csOptLabel);
+ ByteString csStr = PDF_EncodeText(csOptLabel);
CPDF_Array* pOpt = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "Opt"));
if (!pOpt)
pOpt = m_pDict->SetNewFor<CPDF_Array>("Opt");
@@ -682,7 +681,7 @@
bool CPDF_FormField::ClearOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -713,14 +712,14 @@
if (!bChecked && pControl->IsChecked() == bChecked)
return false;
- CFX_WideString csWExport = pControl->GetExportValue();
- CFX_ByteString csBExport = PDF_EncodeText(csWExport);
+ WideString csWExport = pControl->GetExportValue();
+ ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
bool bUnison = IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
- CFX_WideString csEValue = pCtrl->GetExportValue();
+ WideString csEValue = pCtrl->GetExportValue();
if (csEValue == csWExport) {
if (pCtrl->GetOnStateName() == pControl->GetOnStateName())
pCtrl->CheckControl(bChecked);
@@ -742,7 +741,7 @@
if (bChecked) {
m_pDict->SetNewFor<CPDF_Name>("V", csBExport);
} else {
- CFX_ByteString csV;
+ ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict.Get(), "V");
if (pV)
csV = pV->GetString();
@@ -750,7 +749,7 @@
m_pDict->SetNewFor<CPDF_Name>("V", "Off");
}
} else if (bChecked) {
- CFX_ByteString csIndex;
+ ByteString csIndex;
csIndex.Format("%d", iControlIndex);
m_pDict->SetNewFor<CPDF_Name>("V", csIndex);
}
@@ -759,9 +758,9 @@
return true;
}
-CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
+WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
- CFX_WideString csExport = L"Off";
+ WideString csExport = L"Off";
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
@@ -775,14 +774,14 @@
return csExport;
}
-bool CPDF_FormField::SetCheckValue(const CFX_WideString& value,
+bool CPDF_FormField::SetCheckValue(const WideString& value,
bool bDefault,
bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
- CFX_WideString csExport = pControl->GetExportValue();
+ WideString csExport = pControl->GetExportValue();
bool val = csExport == value;
if (!bDefault)
CheckControl(GetControlIndex(pControl), val);
@@ -844,7 +843,7 @@
return true;
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue = GetOptionLabel(iOptIndex);
+ WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
}
@@ -858,7 +857,7 @@
continue;
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue = GetOptionLabel(iOptIndex);
+ WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
}
@@ -882,7 +881,7 @@
bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -902,7 +901,7 @@
if (!pFormDict)
return;
- CFX_ByteString DA;
+ ByteString DA;
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "DA"))
DA = pObj->GetString();
@@ -920,9 +919,9 @@
if (!pFont)
return;
- CPDF_SimpleParser syntax(DA.AsStringC());
+ CPDF_SimpleParser syntax(DA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString font_name(syntax.GetWord());
+ ByteString font_name(syntax.GetWord());
CPDF_Dictionary* pFontDict = pFont->GetDictFor(font_name);
if (!pFontDict)
return;
@@ -931,7 +930,7 @@
m_FontSize = FX_atof(syntax.GetWord());
}
-bool CPDF_FormField::NotifyBeforeSelectionChange(const CFX_WideString& value) {
+bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {
if (!m_pForm->m_pFormNotify)
return true;
return m_pForm->m_pFormNotify->BeforeSelectionChange(this, value) >= 0;
@@ -943,7 +942,7 @@
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
-bool CPDF_FormField::NotifyBeforeValueChange(const CFX_WideString& value) {
+bool CPDF_FormField::NotifyBeforeValueChange(const WideString& value) {
if (!m_pForm->m_pFormNotify)
return true;
return m_pForm->m_pFormNotify->BeforeValueChange(this, value) >= 0;
@@ -955,8 +954,7 @@
m_pForm->m_pFormNotify->AfterValueChange(this);
}
-bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(
- const CFX_WideString& value) {
+bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(const WideString& value) {
switch (GetType()) {
case ListBox:
return NotifyBeforeSelectionChange(value);
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 417f9d1..6b4b725 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -40,7 +40,7 @@
CPDF_Object* FPDF_GetFieldAttr(const CPDF_Dictionary* pFieldDict,
const char* name,
int nLevel = 0);
-CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict);
+WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict);
class CPDF_FormField {
public:
@@ -60,7 +60,7 @@
CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
~CPDF_FormField();
- CFX_WideString GetFullName() const;
+ WideString GetFullName() const;
Type GetType() const { return m_Type; }
uint32_t GetFlags() const { return m_Flags; }
@@ -82,16 +82,16 @@
int GetFieldType() const;
CPDF_AAction GetAdditionalAction() const;
- CFX_WideString GetAlternateName() const;
- CFX_WideString GetMappingName() const;
+ WideString GetAlternateName() const;
+ WideString GetMappingName() const;
uint32_t GetFieldFlags() const;
- CFX_ByteString GetDefaultStyle() const;
- CFX_WideString GetRichTextString() const;
+ ByteString GetDefaultStyle() const;
+ WideString GetRichTextString() const;
- CFX_WideString GetValue() const;
- CFX_WideString GetDefaultValue() const;
- bool SetValue(const CFX_WideString& value, bool bNotify = false);
+ WideString GetValue() const;
+ WideString GetDefaultValue() const;
+ bool SetValue(const WideString& value, bool bNotify = false);
int GetMaxLen() const;
int CountSelectedItems() const;
@@ -106,11 +106,11 @@
int GetDefaultSelectedItem() const;
int CountOptions() const;
- CFX_WideString GetOptionLabel(int index) const;
- CFX_WideString GetOptionValue(int index) const;
+ WideString GetOptionLabel(int index) const;
+ WideString GetOptionValue(int index) const;
- int FindOption(CFX_WideString csOptLabel) const;
- int FindOptionValue(const CFX_WideString& csOptValue) const;
+ int FindOption(WideString csOptLabel) const;
+ int FindOptionValue(const WideString& csOptValue) const;
bool CheckControl(int iControlIndex, bool bChecked, bool bNotify = false);
@@ -127,9 +127,7 @@
#ifdef PDF_ENABLE_XFA
bool ClearOptions(bool bNotify = false);
- int InsertOption(CFX_WideString csOptLabel,
- int index = -1,
- bool bNotify = false);
+ int InsertOption(WideString csOptLabel, int index = -1, bool bNotify = false);
#endif // PDF_ENABLE_XFA
float GetFontSize() const { return m_FontSize; }
@@ -138,7 +136,7 @@
const CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
const CPDF_InterForm* GetForm() const { return m_pForm.Get(); }
- CFX_WideString GetCheckValue(bool bDefault) const;
+ WideString GetCheckValue(bool bDefault) const;
void AddFormControl(CPDF_FormControl* pFormControl) {
m_ControlList.emplace_back(pFormControl);
@@ -149,23 +147,23 @@
}
private:
- CFX_WideString GetValue(bool bDefault) const;
- bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify);
+ WideString GetValue(bool bDefault) const;
+ bool SetValue(const WideString& value, bool bDefault, bool bNotify);
void SyncFieldFlags();
int FindListSel(CPDF_String* str);
- CFX_WideString GetOptionText(int index, int sub_index) const;
+ WideString GetOptionText(int index, int sub_index) const;
void LoadDA();
- bool SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify);
+ bool SetCheckValue(const WideString& value, bool bDefault, bool bNotify);
- bool NotifyBeforeSelectionChange(const CFX_WideString& value);
+ bool NotifyBeforeSelectionChange(const WideString& value);
void NotifyAfterSelectionChange();
- bool NotifyBeforeValueChange(const CFX_WideString& value);
+ bool NotifyBeforeValueChange(const WideString& value);
void NotifyAfterValueChange();
- bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value);
+ bool NotifyListOrComboBoxBeforeChange(const WideString& value);
void NotifyListOrComboBoxAfterChange();
CPDF_FormField::Type m_Type;
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index 4aeda84..af5d15d 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -10,7 +10,7 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(cpdf_formfield, FPDF_GetFullName) {
- CFX_WideString name = FPDF_GetFullName(nullptr);
+ WideString name = FPDF_GetFullName(nullptr);
EXPECT_TRUE(name.IsEmpty());
CPDF_IndirectObjectHolder obj_holder;
diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp
index a28f3bc..20ed963 100644
--- a/core/fpdfdoc/cpdf_iconfit.cpp
+++ b/core/fpdfdoc/cpdf_iconfit.cpp
@@ -20,7 +20,7 @@
if (!m_pDict)
return Always;
- CFX_ByteString csSW = m_pDict->GetStringFor("SW", "A");
+ ByteString csSW = m_pDict->GetStringFor("SW", "A");
if (csSW == "B")
return Bigger;
if (csSW == "S")
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 7e73f7e..3bbb50b 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -40,24 +40,24 @@
{"UHC", 949},
};
-CFX_WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
- const CFX_ByteString& bsEncoding) {
- const CFX_ByteString csBValue = pFieldDict.GetStringFor("V");
+WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
+ const ByteString& bsEncoding) {
+ const ByteString csBValue = pFieldDict.GetStringFor("V");
for (const auto& encoding : g_fieldEncoding) {
if (bsEncoding == encoding.m_name)
- return CFX_WideString::FromCodePage(csBValue.AsStringC(),
- encoding.m_codePage);
+ return WideString::FromCodePage(csBValue.AsStringView(),
+ encoding.m_codePage);
}
- CFX_ByteString csTemp = csBValue.Left(2);
+ ByteString csTemp = csBValue.Left(2);
if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF")
return PDF_DecodeText(csBValue);
- return CFX_WideString::FromLocal(csBValue.AsStringC());
+ return WideString::FromLocal(csBValue.AsStringView());
}
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag);
+ ByteString* csNameTag);
void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
if (!pDocument)
@@ -69,17 +69,16 @@
pFormDict->GetObjNum());
}
- CFX_ByteString csDA;
+ ByteString csDA;
if (!pFormDict->KeyExist("DR")) {
- CFX_ByteString csBaseName;
+ ByteString csBaseName;
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica");
if (pFont)
AddFont(pFormDict, pDocument, pFont, &csBaseName);
if (charSet != FX_CHARSET_ANSI) {
- CFX_ByteString csFontName =
- CPDF_InterForm::GetNativeFont(charSet, nullptr);
+ ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!pFont || csFontName != "Helvetica") {
pFont = CPDF_InterForm::AddNativeFont(pDocument);
if (pFont) {
@@ -101,8 +100,8 @@
CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
- const CFX_ByteString& csNameTag) {
- CFX_ByteString csAlias = PDF_NameDecode(csNameTag);
+ const ByteString& csNameTag) {
+ ByteString csAlias = PDF_NameDecode(csNameTag);
if (!pFormDict || csAlias.IsEmpty())
return nullptr;
@@ -126,7 +125,7 @@
CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
return nullptr;
@@ -139,7 +138,7 @@
return nullptr;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -166,7 +165,7 @@
bool FindFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict || !pFont)
return false;
@@ -179,7 +178,7 @@
return false;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
CPDF_Dictionary* pElement = ToDictionary(it.second->GetDirect());
@@ -197,9 +196,9 @@
bool FindFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString csFontName,
+ ByteString csFontName,
CPDF_Font*& pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
return false;
@@ -215,7 +214,7 @@
csFontName.Remove(' ');
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -228,7 +227,7 @@
if (!pFont)
continue;
- CFX_ByteString csBaseFont;
+ ByteString csBaseFont;
csBaseFont = pFont->GetBaseFont();
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
@@ -242,13 +241,13 @@
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFont)
return;
if (!pFormDict)
InitDict(pFormDict, pDocument);
- CFX_ByteString csTag;
+ ByteString csTag;
if (FindFont(pFormDict, pFont, &csTag)) {
*csNameTag = csTag;
return;
@@ -277,17 +276,17 @@
CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
InitDict(pFormDict, pDocument);
- CFX_ByteString csTemp;
+ ByteString csTemp;
CPDF_Font* pFont = GetNativeFont(pFormDict, pDocument, charSet, &csTemp);
if (pFont) {
*csNameTag = csTemp;
return pFont;
}
- CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
+ ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!csFontName.IsEmpty() &&
FindFont(pFormDict, pDocument, csFontName, pFont, csNameTag)) {
return pFont;
@@ -301,7 +300,7 @@
class CFieldNameExtractor {
public:
- explicit CFieldNameExtractor(const CFX_WideString& full_name)
+ explicit CFieldNameExtractor(const WideString& full_name)
: m_FullName(full_name) {
m_pCur = m_FullName.c_str();
m_pEnd = m_pCur + m_FullName.GetLength();
@@ -318,7 +317,7 @@
}
protected:
- CFX_WideString m_FullName;
+ WideString m_FullName;
const wchar_t* m_pCur;
const wchar_t* m_pEnd;
};
@@ -371,7 +370,7 @@
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) {
+int CompareFieldName(const WideString& name1, const WideString& name2) {
const wchar_t* ptr1 = name1.c_str();
const wchar_t* ptr2 = name2.c_str();
if (name1.GetLength() == name2.GetLength())
@@ -394,7 +393,7 @@
class Node {
public:
Node() : m_pField(nullptr), m_level(0) {}
- Node(const CFX_WideString& short_name, int level)
+ Node(const WideString& short_name, int level)
: m_ShortName(short_name), m_level(level) {}
~Node() {}
@@ -420,7 +419,7 @@
CPDF_FormField* GetField() const { return m_pField.get(); }
- const CFX_WideString& GetShortName() const { return m_ShortName; }
+ const WideString& GetShortName() const { return m_ShortName; }
int GetLevel() const { return m_level; }
@@ -451,7 +450,7 @@
}
std::vector<std::unique_ptr<Node>> m_Children;
- CFX_WideString m_ShortName;
+ WideString m_ShortName;
std::unique_ptr<CPDF_FormField> m_pField;
const int m_level;
};
@@ -459,14 +458,14 @@
CFieldTree();
~CFieldTree();
- bool SetField(const CFX_WideString& full_name,
+ bool SetField(const WideString& full_name,
std::unique_ptr<CPDF_FormField> pField);
- CPDF_FormField* GetField(const CFX_WideString& full_name);
+ CPDF_FormField* GetField(const WideString& full_name);
- Node* FindNode(const CFX_WideString& full_name);
- Node* AddChild(Node* pParent, const CFX_WideString& short_name);
+ Node* FindNode(const WideString& full_name);
+ Node* AddChild(Node* pParent, const WideString& short_name);
- Node* Lookup(Node* pParent, const CFX_WideString& short_name);
+ Node* Lookup(Node* pParent, const WideString& short_name);
Node m_Root;
};
@@ -476,7 +475,7 @@
CFieldTree::~CFieldTree() {}
CFieldTree::Node* CFieldTree::AddChild(Node* pParent,
- const CFX_WideString& short_name) {
+ const WideString& short_name) {
if (!pParent)
return nullptr;
@@ -491,7 +490,7 @@
}
CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
- const CFX_WideString& short_name) {
+ const WideString& short_name) {
if (!pParent)
return nullptr;
@@ -503,7 +502,7 @@
return nullptr;
}
-bool CFieldTree::SetField(const CFX_WideString& full_name,
+bool CFieldTree::SetField(const WideString& full_name,
std::unique_ptr<CPDF_FormField> pField) {
if (full_name.IsEmpty())
return false;
@@ -516,7 +515,7 @@
Node* pLast = nullptr;
while (nLength > 0) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
if (!pNode)
pNode = AddChild(pLast, name);
@@ -532,7 +531,7 @@
return true;
}
-CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) {
+CPDF_FormField* CFieldTree::GetField(const WideString& full_name) {
if (full_name.IsEmpty())
return nullptr;
@@ -544,14 +543,14 @@
Node* pLast = nullptr;
while (nLength > 0 && pNode) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
name_extractor.GetNext(pName, nLength);
}
return pNode ? pNode->GetField() : nullptr;
}
-CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
+CFieldTree::Node* CFieldTree::FindNode(const WideString& full_name) {
if (full_name.IsEmpty())
return nullptr;
@@ -563,7 +562,7 @@
Node* pLast = nullptr;
while (nLength > 0 && pNode) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
name_extractor.GetNext(pName, nLength);
}
@@ -572,7 +571,7 @@
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
return AddNativeFont(pFormDict, pDocument, charSet, csNameTag);
}
@@ -671,13 +670,13 @@
s_bUpdateAP = bUpdateAP;
}
-CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
+ByteString CPDF_InterForm::GenerateNewResourceName(
const CPDF_Dictionary* pResDict,
const char* csType,
int iMinLen,
const char* csPrefix) {
- CFX_ByteString csStr = csPrefix;
- CFX_ByteString csBType = csType;
+ ByteString csStr = csPrefix;
+ ByteString csBType = csType;
if (csStr.IsEmpty()) {
if (csBType == "ExtGState")
csStr = "GS";
@@ -688,7 +687,7 @@
else
csStr = "Res";
}
- CFX_ByteString csTmp = csStr;
+ ByteString csTmp = csStr;
int iCount = csStr.GetLength();
int m = 0;
if (iMinLen > 0) {
@@ -710,9 +709,9 @@
return csTmp;
int num = 0;
- CFX_ByteString bsNum;
+ ByteString bsNum;
while (true) {
- CFX_ByteString csKey = csTmp + bsNum;
+ ByteString csKey = csTmp + bsNum;
if (!pDict->KeyExist(csKey))
return csKey;
if (m < iCount)
@@ -726,7 +725,7 @@
}
CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument,
- CFX_ByteString csFontName) {
+ ByteString csFontName) {
if (!pDocument || csFontName.IsEmpty())
return nullptr;
@@ -737,8 +736,8 @@
return pDocument->AddStandardFont(csFontName.c_str(), &encoding);
}
-CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
- CFX_ByteString csFontName;
+ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
+ ByteString csFontName;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf = {};
if (charSet == FX_CHARSET_ANSI) {
@@ -786,7 +785,7 @@
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf;
- CFX_ByteString csFontName = GetNativeFont(charSet, &lf);
+ ByteString csFontName = GetNativeFont(charSet, &lf);
if (!csFontName.IsEmpty()) {
if (csFontName == "Helvetica")
return AddStandardFont(pDocument, csFontName);
@@ -801,7 +800,7 @@
}
bool CPDF_InterForm::ValidateFieldName(
- CFX_WideString& csNewFieldName,
+ WideString& csNewFieldName,
int iType,
const CPDF_FormField* pExcludedField,
const CPDF_FormControl* pExcludedControl) const {
@@ -810,7 +809,7 @@
int iPos = 0;
int iLength = csNewFieldName.GetLength();
- CFX_WideString csSub;
+ WideString csSub;
while (true) {
while (iPos < iLength &&
(csNewFieldName[iPos] == L'.' || csNewFieldName[iPos] == L' ')) {
@@ -835,7 +834,7 @@
if (!pExcludedControl || pField->CountControls() < 2)
continue;
}
- CFX_WideString csFullName = pField->GetFullName();
+ WideString csFullName = pField->GetFullName();
int iRet = CompareFieldName(csSub, csFullName);
if (iRet == 1) {
if (pField->GetFieldType() != iType)
@@ -858,7 +857,7 @@
return true;
}
-size_t CPDF_InterForm::CountFields(const CFX_WideString& csFieldName) const {
+size_t CPDF_InterForm::CountFields(const WideString& csFieldName) const {
if (csFieldName.IsEmpty())
return m_pFieldTree->m_Root.CountFields();
@@ -866,9 +865,8 @@
return pNode ? pNode->CountFields() : 0;
}
-CPDF_FormField* CPDF_InterForm::GetField(
- uint32_t index,
- const CFX_WideString& csFieldName) const {
+CPDF_FormField* CPDF_InterForm::GetField(uint32_t index,
+ const WideString& csFieldName) const {
if (csFieldName.IsEmpty())
return m_pFieldTree->m_Root.GetFieldAtIndex(index);
@@ -881,7 +879,7 @@
if (!pFieldDict)
return nullptr;
- CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
+ WideString csWName = FPDF_GetFullName(pFieldDict);
return m_pFieldTree->GetField(csWName);
}
@@ -960,7 +958,7 @@
return -1;
}
-CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) const {
+CPDF_Font* CPDF_InterForm::GetFormFont(ByteString csNameTag) const {
return GetFont(m_pFormDict.Get(), m_pDocument.Get(), csNameTag);
}
@@ -1070,7 +1068,7 @@
}
CPDF_Dictionary* pDict = pFieldDict;
- CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
+ WideString csWName = FPDF_GetFullName(pFieldDict);
if (csWName.IsEmpty())
return;
@@ -1177,7 +1175,7 @@
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
bool bSimpleFileSpec) const {
std::vector<CPDF_FormField*> fields;
size_t nCount = m_pFieldTree->m_Root.CountFields();
@@ -1187,7 +1185,7 @@
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const {
@@ -1198,9 +1196,9 @@
CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictFor("FDF");
if (!pdf_path.IsEmpty()) {
if (bSimpleFileSpec) {
- CFX_WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path);
+ WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path);
pMainDict->SetNewFor<CPDF_String>(
- "F", CFX_ByteString::FromUnicode(wsFilePath), false);
+ "F", ByteString::FromUnicode(wsFilePath), false);
pMainDict->SetNewFor<CPDF_String>("UF", PDF_EncodeText(wsFilePath),
false);
} else {
@@ -1230,14 +1228,14 @@
continue;
}
- CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
+ WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
auto pFieldDict =
pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool());
pFieldDict->SetNewFor<CPDF_String>("T", fullname);
if (pField->GetType() == CPDF_FormField::CheckBox ||
pField->GetType() == CPDF_FormField::RadioButton) {
- CFX_WideString csExport = pField->GetCheckValue(false);
- CFX_ByteString csBExport = PDF_EncodeText(csExport);
+ WideString csExport = pField->GetCheckValue(false);
+ ByteString csBExport = PDF_EncodeText(csExport);
CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt");
if (pOpt)
pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false);
@@ -1255,10 +1253,10 @@
}
void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
- const CFX_WideString& parent_name,
+ const WideString& parent_name,
bool bNotify,
int nLevel) {
- CFX_WideString name;
+ WideString name;
if (!parent_name.IsEmpty())
name = parent_name + L".";
@@ -1281,7 +1279,7 @@
if (!pField)
return;
- CFX_WideString csWValue = GetFieldValue(*pFieldDict, m_bsEncoding);
+ WideString csWValue = GetFieldValue(*pFieldDict, m_bsEncoding);
int iType = pField->GetFieldType();
if (bNotify && m_pFormNotify) {
if (iType == FIELDTYPE_LISTBOX) {
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index 9dc0532..d3796e5 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -30,7 +30,7 @@
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString* csNameTag);
+ ByteString* csNameTag);
class CPDF_InterForm {
public:
@@ -39,20 +39,19 @@
static void SetUpdateAP(bool bUpdateAP);
static bool IsUpdateAPEnabled();
- static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
- const char* csType,
- int iMinLen,
- const char* csPrefix);
+ static ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
+ const char* csType,
+ int iMinLen,
+ const char* csPrefix);
static CPDF_Font* AddStandardFont(CPDF_Document* pDocument,
- CFX_ByteString csFontName);
- static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont);
+ ByteString csFontName);
+ static ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont);
static uint8_t GetNativeCharSet();
static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument);
static CPDF_Font* AddNativeFont(CPDF_Document* pDocument);
- size_t CountFields(const CFX_WideString& csFieldName) const;
- CPDF_FormField* GetField(uint32_t index,
- const CFX_WideString& csFieldName) const;
+ size_t CountFields(const WideString& csFieldName) const;
+ CPDF_FormField* GetField(uint32_t index, const WideString& csFieldName) const;
CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage,
@@ -65,18 +64,18 @@
CPDF_FormField* GetFieldInCalculationOrder(int index);
int FindFieldInCalculationOrder(const CPDF_FormField* pField);
- CPDF_Font* GetFormFont(CFX_ByteString csNameTag) const;
+ CPDF_Font* GetFormFont(ByteString csNameTag) const;
CPDF_DefaultAppearance GetDefaultAppearance() const;
int GetFormAlignment() const;
bool CheckRequiredFields(const std::vector<CPDF_FormField*>* fields,
bool bIncludeOrExclude) const;
- std::unique_ptr<CFDF_Document> ExportToFDF(const CFX_WideString& pdf_path,
+ std::unique_ptr<CFDF_Document> ExportToFDF(const WideString& pdf_path,
bool bSimpleFileSpec) const;
std::unique_ptr<CFDF_Document> ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const;
@@ -99,10 +98,10 @@
CPDF_FormControl* AddControl(CPDF_FormField* pField,
CPDF_Dictionary* pWidgetDict);
void FDF_ImportField(CPDF_Dictionary* pField,
- const CFX_WideString& parent_name,
+ const WideString& parent_name,
bool bNotify = false,
int nLevel = 0);
- bool ValidateFieldName(CFX_WideString& csNewFieldName,
+ bool ValidateFieldName(WideString& csNewFieldName,
int iType,
const CPDF_FormField* pExcludedField,
const CPDF_FormControl* pExcludedControl) const;
@@ -114,7 +113,7 @@
std::map<const CPDF_Dictionary*, std::unique_ptr<CPDF_FormControl>>
m_ControlMap;
std::unique_ptr<CFieldTree> m_pFieldTree;
- CFX_ByteString m_bsEncoding;
+ ByteString m_bsEncoding;
CFX_UnownedPtr<IPDF_FormNotify> m_pFormNotify;
};
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index d225d3f..bdbf8b4 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -19,11 +19,10 @@
const int nMaxRecursion = 32;
-std::pair<CFX_WideString, CFX_WideString> GetNodeLimitsMaybeSwap(
- CPDF_Array* pLimits) {
+std::pair<WideString, WideString> GetNodeLimitsMaybeSwap(CPDF_Array* pLimits) {
ASSERT(pLimits);
- CFX_WideString csLeft = pLimits->GetUnicodeTextAt(0);
- CFX_WideString csRight = pLimits->GetUnicodeTextAt(1);
+ WideString csLeft = pLimits->GetUnicodeTextAt(0);
+ WideString csRight = pLimits->GetUnicodeTextAt(1);
// If the lower limit is greater than the upper limit, swap them.
if (csLeft.Compare(csRight) > 0) {
pLimits->SetNewAt<CPDF_String>(0, csRight);
@@ -71,14 +70,14 @@
// if needed, and any ancestors that are now empty will be removed.
bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
const CPDF_Array* pFind,
- const CFX_WideString& csName,
+ const WideString& csName,
int nLevel) {
if (nLevel > nMaxRecursion)
return false;
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
- CFX_WideString csLeft;
- CFX_WideString csRight;
+ WideString csLeft;
+ WideString csRight;
if (pLimits)
std::tie(csLeft, csRight) = GetNodeLimitsMaybeSwap(pLimits);
@@ -93,10 +92,10 @@
// Since |csName| defines |pNode|'s limits, we need to loop through the
// names to find the new lower and upper limits.
- CFX_WideString csNewLeft = csRight;
- CFX_WideString csNewRight = csLeft;
+ WideString csNewLeft = csRight;
+ WideString csNewRight = csLeft;
for (size_t i = 0; i < pNames->GetCount() / 2; ++i) {
- CFX_WideString wsName = pNames->GetUnicodeTextAt(i * 2);
+ WideString wsName = pNames->GetUnicodeTextAt(i * 2);
if (wsName.Compare(csNewLeft) < 0)
csNewLeft = wsName;
if (wsName.Compare(csNewRight) > 0)
@@ -131,8 +130,8 @@
// Since |csName| defines |pNode|'s limits, we need to loop through the
// kids to find the new lower and upper limits.
- CFX_WideString csNewLeft = csRight;
- CFX_WideString csNewRight = csLeft;
+ WideString csNewLeft = csRight;
+ WideString csNewRight = csLeft;
for (size_t j = 0; j < pKids->GetCount(); ++j) {
CPDF_Array* pKidLimits = pKids->GetDictAt(j)->GetArrayFor("Limits");
ASSERT(pKidLimits);
@@ -155,7 +154,7 @@
// will be the leaf array that |csName| should be added to, and |pFindIndex|
// will be the index that it should be added at.
CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
- const CFX_WideString& csName,
+ const WideString& csName,
size_t& nIndex,
int nLevel,
CPDF_Array** ppFind,
@@ -166,8 +165,8 @@
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pLimits) {
- CFX_WideString csLeft;
- CFX_WideString csRight;
+ WideString csLeft;
+ WideString csRight;
std::tie(csLeft, csRight) = GetNodeLimitsMaybeSwap(pLimits);
// Skip this node if the name to look for is smaller than its lower limit.
if (csName.Compare(csLeft) < 0)
@@ -189,7 +188,7 @@
if (pNames) {
size_t dwCount = pNames->GetCount() / 2;
for (size_t i = 0; i < dwCount; i++) {
- CFX_WideString csValue = pNames->GetUnicodeTextAt(i * 2);
+ WideString csValue = pNames->GetUnicodeTextAt(i * 2);
int32_t iCompare = csValue.Compare(csName);
if (iCompare > 0)
break;
@@ -233,7 +232,7 @@
size_t nIndex,
size_t& nCurIndex,
int nLevel,
- CFX_WideString* csName,
+ WideString* csName,
CPDF_Array** ppFind,
int* pFindIndex) {
if (nLevel > nMaxRecursion)
@@ -300,7 +299,7 @@
CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
CPDF_NameTree::CPDF_NameTree(const CPDF_Document* pDoc,
- const CFX_ByteString& category)
+ const ByteString& category)
: m_pRoot(nullptr) {
const CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
@@ -319,7 +318,7 @@
return m_pRoot ? ::CountNames(m_pRoot.Get()) : 0;
}
-int CPDF_NameTree::GetIndex(const CFX_WideString& csName) const {
+int CPDF_NameTree::GetIndex(const WideString& csName) const {
if (!m_pRoot)
return -1;
@@ -330,7 +329,7 @@
}
bool CPDF_NameTree::AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
- const CFX_WideString& name) {
+ const WideString& name) {
if (!m_pRoot)
return false;
@@ -347,7 +346,7 @@
// |name| and |pObj|.
if (!pFind) {
size_t nCurIndex = 0;
- CFX_WideString csName;
+ WideString csName;
SearchNameNode(m_pRoot.Get(), 0, nCurIndex, 0, &csName, &pFind, nullptr);
}
ASSERT(pFind);
@@ -381,7 +380,7 @@
return false;
size_t nCurIndex = 0;
- CFX_WideString csName;
+ WideString csName;
CPDF_Array* pFind = nullptr;
int nFindIndex = -1;
// Fail if the tree does not contain |nIndex|.
@@ -400,7 +399,7 @@
}
CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
- CFX_WideString* csName) const {
+ WideString* csName) const {
csName->clear();
if (!m_pRoot)
return nullptr;
@@ -410,7 +409,7 @@
nullptr);
}
-CPDF_Object* CPDF_NameTree::LookupValue(const CFX_WideString& csName) const {
+CPDF_Object* CPDF_NameTree::LookupValue(const WideString& csName) const {
if (!m_pRoot)
return nullptr;
@@ -419,7 +418,7 @@
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
- const CFX_WideString& sName) {
+ const WideString& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictFor("Dests");
diff --git a/core/fpdfdoc/cpdf_nametree.h b/core/fpdfdoc/cpdf_nametree.h
index 4dc43fc..add62f1 100644
--- a/core/fpdfdoc/cpdf_nametree.h
+++ b/core/fpdfdoc/cpdf_nametree.h
@@ -20,18 +20,18 @@
class CPDF_NameTree {
public:
explicit CPDF_NameTree(CPDF_Dictionary* pRoot);
- CPDF_NameTree(const CPDF_Document* pDoc, const CFX_ByteString& category);
+ CPDF_NameTree(const CPDF_Document* pDoc, const ByteString& category);
~CPDF_NameTree();
bool AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
- const CFX_WideString& name);
+ const WideString& name);
bool DeleteValueAndName(int nIndex);
- CPDF_Object* LookupValueAndName(int nIndex, CFX_WideString* csName) const;
- CPDF_Object* LookupValue(const CFX_WideString& csName) const;
- CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_WideString& sName);
+ CPDF_Object* LookupValueAndName(int nIndex, WideString* csName) const;
+ CPDF_Object* LookupValue(const WideString& csName) const;
+ CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const WideString& sName);
- int GetIndex(const CFX_WideString& csName) const;
+ int GetIndex(const WideString& csName) const;
size_t GetCount() const;
CPDF_Dictionary* GetRoot() const { return m_pRoot.Get(); }
diff --git a/core/fpdfdoc/cpdf_nametree_unittest.cpp b/core/fpdfdoc/cpdf_nametree_unittest.cpp
index e6e188a..38c3140 100644
--- a/core/fpdfdoc/cpdf_nametree_unittest.cpp
+++ b/core/fpdfdoc/cpdf_nametree_unittest.cpp
@@ -84,17 +84,17 @@
constexpr char kData[] = "\xFE\xFF\x00\x31";
for (size_t i = 0; i < sizeof(kData); ++i)
buf.put(kData[i]);
- pNames->AddNew<CPDF_String>(CFX_ByteString(buf), true);
+ pNames->AddNew<CPDF_String>(ByteString(buf), true);
pNames->AddNew<CPDF_Number>(100);
// Check that the key is as expected.
CPDF_NameTree nameTree(pRootDict.get());
- CFX_WideString storedName;
+ WideString storedName;
nameTree.LookupValueAndName(0, &storedName);
EXPECT_STREQ(L"1", storedName.c_str());
// Check that the correct value object can be obtained by looking up "1".
- CFX_WideString matchName = L"1";
+ WideString matchName = L"1";
CPDF_Object* pObj = nameTree.LookupValue(matchName);
ASSERT_TRUE(pObj->IsNumber());
EXPECT_EQ(100, pObj->AsNumber()->GetInteger());
@@ -232,7 +232,7 @@
// Delete the name "9.txt", and check that its node gets deleted and its
// parent node's limits get updated.
- CFX_WideString csName;
+ WideString csName;
ASSERT_TRUE(nameTree.LookupValue(L"9.txt"));
EXPECT_EQ(999, nameTree.LookupValue(L"9.txt")->GetInteger());
EXPECT_TRUE(nameTree.LookupValueAndName(4, &csName));
diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp
index 7e746e0..069292c 100644
--- a/core/fpdfdoc/cpdf_occontext.cpp
+++ b/core/fpdfdoc/cpdf_occontext.cpp
@@ -24,13 +24,13 @@
}
bool HasIntent(const CPDF_Dictionary* pDict,
- const CFX_ByteStringC& csElement,
- const CFX_ByteStringC& csDef) {
+ const ByteStringView& csElement,
+ const ByteStringView& csDef) {
CPDF_Object* pIntent = pDict->GetDirectObjectFor("Intent");
if (!pIntent)
return csElement == csDef;
- CFX_ByteString bsIntent;
+ ByteString bsIntent;
if (CPDF_Array* pArray = pIntent->AsArray()) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
bsIntent = pArray->GetStringAt(i);
@@ -70,8 +70,8 @@
return pConfig;
}
-CFX_ByteString GetUsageTypeString(CPDF_OCContext::UsageType eType) {
- CFX_ByteString csState;
+ByteString GetUsageTypeString(CPDF_OCContext::UsageType eType) {
+ ByteString csState;
switch (eType) {
case CPDF_OCContext::Design:
csState = "Design";
@@ -99,7 +99,7 @@
CPDF_OCContext::~CPDF_OCContext() {}
bool CPDF_OCContext::LoadOCGStateFromConfig(
- const CFX_ByteString& csConfig,
+ const ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const {
CPDF_Dictionary* pConfig = GetConfig(m_pDocument.Get(), pOCGDict);
if (!pConfig)
@@ -120,7 +120,7 @@
if (!pArray)
return bState;
- CFX_ByteString csFind = csConfig + "State";
+ ByteString csFind = csConfig + "State";
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage)
@@ -149,12 +149,12 @@
if (!HasIntent(pOCGDict, "View", "View"))
return true;
- CFX_ByteString csState = GetUsageTypeString(m_eUsageType);
+ ByteString csState = GetUsageTypeString(m_eUsageType);
CPDF_Dictionary* pUsage = pOCGDict->GetDictFor("Usage");
if (pUsage) {
CPDF_Dictionary* pState = pUsage->GetDictFor(csState);
if (pState) {
- CFX_ByteString csFind = csState + "State";
+ ByteString csFind = csState + "State";
if (pState->KeyExist(csFind))
return pState->GetStringFor(csFind) != "OFF";
}
@@ -196,7 +196,7 @@
if (nLevel > 32 || !pExpression)
return false;
- CFX_ByteString csOperator = pExpression->GetStringAt(0);
+ ByteString csOperator = pExpression->GetStringAt(0);
if (csOperator == "Not") {
CPDF_Object* pOCGObj = pExpression->GetDirectObjectAt(1);
if (!pOCGObj)
@@ -241,7 +241,7 @@
if (pVE)
return GetOCGVE(pVE, 0);
- CFX_ByteString csP = pOCMDDict->GetStringFor("P", "AnyOn");
+ ByteString csP = pOCMDDict->GetStringFor("P", "AnyOn");
CPDF_Object* pOCGObj = pOCMDDict->GetDirectObjectFor("OCGs");
if (!pOCGObj)
return true;
@@ -279,7 +279,7 @@
if (!pOCGDict)
return true;
- CFX_ByteString csType = pOCGDict->GetStringFor("Type", "OCG");
+ ByteString csType = pOCGDict->GetStringFor("Type", "OCG");
if (csType == "OCG")
return GetOCGVisible(pOCGDict);
return LoadOCMDState(pOCGDict);
diff --git a/core/fpdfdoc/cpdf_occontext.h b/core/fpdfdoc/cpdf_occontext.h
index ea8eea2..3c93ef1 100644
--- a/core/fpdfdoc/cpdf_occontext.h
+++ b/core/fpdfdoc/cpdf_occontext.h
@@ -31,7 +31,7 @@
CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType);
~CPDF_OCContext() override;
- bool LoadOCGStateFromConfig(const CFX_ByteString& csConfig,
+ bool LoadOCGStateFromConfig(const ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const;
bool LoadOCGState(const CPDF_Dictionary* pOCGDict) const;
bool GetOCGVisible(const CPDF_Dictionary* pOCGDict);
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index 7b5e66e..5efb18e 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -13,16 +13,15 @@
namespace {
-CFX_WideString MakeRoman(int num) {
+WideString MakeRoman(int num) {
const int kArabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
- const CFX_WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c",
- L"xc", L"l", L"xl", L"x", L"ix",
- L"v", L"iv", L"i"};
+ const WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c", L"xc", L"l",
+ L"xl", L"x", L"ix", L"v", L"iv", L"i"};
const int kMaxNum = 1000000;
num %= kMaxNum;
int i = 0;
- CFX_WideString wsRomanNumber;
+ WideString wsRomanNumber;
while (num > 0) {
while (num >= kArabic[i]) {
num = num - kArabic[i];
@@ -33,11 +32,11 @@
return wsRomanNumber;
}
-CFX_WideString MakeLetters(int num) {
+WideString MakeLetters(int num) {
if (num == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wsLetters;
+ WideString wsLetters;
const int nMaxCount = 1000;
const int nLetterCount = 26;
--num;
@@ -50,8 +49,8 @@
return wsLetters;
}
-CFX_WideString GetLabelNumPortion(int num, const CFX_ByteString& bsStyle) {
- CFX_WideString wsNumPortion;
+WideString GetLabelNumPortion(int num, const ByteString& bsStyle) {
+ WideString wsNumPortion;
if (bsStyle.IsEmpty())
return wsNumPortion;
if (bsStyle == "D") {
@@ -77,7 +76,7 @@
CPDF_PageLabel::~CPDF_PageLabel() {}
-bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
+bool CPDF_PageLabel::GetLabel(int nPage, WideString* wsLabel) const {
if (!m_pDocument)
return false;
@@ -108,10 +107,9 @@
if (pLabel->KeyExist("P"))
*wsLabel += pLabel->GetUnicodeTextFor("P");
- CFX_ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
+ ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
int nLabelNum = nPage - n + pLabel->GetIntegerFor("St", 1);
- CFX_WideString wsNumPortion =
- GetLabelNumPortion(nLabelNum, bsNumberingStyle);
+ WideString wsNumPortion = GetLabelNumPortion(nLabelNum, bsNumberingStyle);
*wsLabel += wsNumPortion;
return true;
}
@@ -120,7 +118,7 @@
return true;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const ByteStringView& bsLabel) const {
if (!m_pDocument)
return -1;
@@ -130,19 +128,19 @@
int nPages = m_pDocument->GetPageCount();
for (int i = 0; i < nPages; i++) {
- CFX_WideString str;
+ WideString str;
if (!GetLabel(i, &str))
continue;
if (PDF_EncodeText(str).Compare(bsLabel))
return i;
}
- int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate.
+ int nPage = FXSYS_atoi(ByteString(bsLabel).c_str()); // NUL terminate.
return nPage > 0 && nPage <= nPages ? nPage : -1;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const WideStringView& wsLabel) const {
// TODO(tsepez): check usage of c_str() below.
return GetPageByLabel(
- PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringC());
+ PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringView());
}
diff --git a/core/fpdfdoc/cpdf_pagelabel.h b/core/fpdfdoc/cpdf_pagelabel.h
index 66324f8..1b21ca8 100644
--- a/core/fpdfdoc/cpdf_pagelabel.h
+++ b/core/fpdfdoc/cpdf_pagelabel.h
@@ -16,9 +16,9 @@
explicit CPDF_PageLabel(CPDF_Document* pDocument);
~CPDF_PageLabel();
- bool GetLabel(int nPage, CFX_WideString* wsLabel) const;
- int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const;
- int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const;
+ bool GetLabel(int nPage, WideString* wsLabel) const;
+ int32_t GetPageByLabel(const ByteStringView& bsLabel) const;
+ int32_t GetPageByLabel(const WideStringView& wsLabel) const;
private:
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfdoc/cpdf_structelement.cpp b/core/fpdfdoc/cpdf_structelement.cpp
index c5f2b6b..0b0b542 100644
--- a/core/fpdfdoc/cpdf_structelement.cpp
+++ b/core/fpdfdoc/cpdf_structelement.cpp
@@ -36,7 +36,7 @@
m_Type(pDict->GetStringFor("S")),
m_Title(pDict->GetStringFor("T")) {
if (pTree->GetRoleMap()) {
- CFX_ByteString mapped = pTree->GetRoleMap()->GetStringFor(m_Type);
+ ByteString mapped = pTree->GetRoleMap()->GetStringFor(m_Type);
if (!mapped.IsEmpty())
m_Type = mapped;
}
@@ -102,7 +102,7 @@
if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Pg")))
PageObjNum = pRef->GetRefObjNum();
- CFX_ByteString type = pKidDict->GetStringFor("Type");
+ ByteString type = pKidDict->GetStringFor("Type");
if ((type == "MCR" || type == "OBJR") && m_pTree->GetPage() &&
m_pTree->GetPage()->GetObjNum() != PageObjNum) {
return;
diff --git a/core/fpdfdoc/cpdf_structelement.h b/core/fpdfdoc/cpdf_structelement.h
index 8fe73e5..b54487e 100644
--- a/core/fpdfdoc/cpdf_structelement.h
+++ b/core/fpdfdoc/cpdf_structelement.h
@@ -39,8 +39,8 @@
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- const CFX_ByteString& GetType() const { return m_Type; }
- const CFX_ByteString& GetTitle() const { return m_Title; }
+ const ByteString& GetType() const { return m_Type; }
+ const ByteString& GetTitle() const { return m_Title; }
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
int CountKids() const;
@@ -59,8 +59,8 @@
CFX_UnownedPtr<CPDF_StructTree> const m_pTree;
CFX_UnownedPtr<CPDF_StructElement> const m_pParent;
CFX_UnownedPtr<CPDF_Dictionary> const m_pDict;
- CFX_ByteString m_Type;
- CFX_ByteString m_Title;
+ ByteString m_Type;
+ ByteString m_Title;
std::vector<CPDF_StructKid> m_Kids;
};
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 877f8ca..d3de612 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -354,7 +354,7 @@
CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
const wchar_t* text) {
- CFX_WideString swText = text;
+ WideString swText = text;
CPVT_WordPlace wp = place;
for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
CPVT_WordPlace oldwp = wp;
@@ -412,7 +412,7 @@
return ClearLeftWord(AdjustLineHeader(place, true));
}
-void CPDF_VariableText::SetText(const CFX_WideString& swText) {
+void CPDF_VariableText::SetText(const WideString& swText) {
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
CPVT_WordPlace wp(0, 0, -1);
CPVT_SectionInfo secinfo;
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index a226350..704408c 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -106,7 +106,7 @@
void RearrangeAll();
void RearrangePart(const CPVT_WordRange& PlaceRange);
void ResetAll();
- void SetText(const CFX_WideString& text);
+ void SetText(const WideString& text);
CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
uint16_t word,
int32_t charset,
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index e25316b..e7fb141 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -34,13 +34,13 @@
return pDict ? pDict->GetArrayFor("PrintPageRange") : nullptr;
}
-CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
+ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringFor("Duplex") : CFX_ByteString("None");
+ return pDict ? pDict->GetStringFor("Duplex") : ByteString("None");
}
-bool CPDF_ViewerPreferences::GenericName(const CFX_ByteString& bsKey,
- CFX_ByteString* bsVal) const {
+bool CPDF_ViewerPreferences::GenericName(const ByteString& bsKey,
+ ByteString* bsVal) const {
ASSERT(bsVal);
CPDF_Dictionary* pDict = GetViewerPreferences();
if (!pDict)
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.h b/core/fpdfdoc/cpdf_viewerpreferences.h
index 46428a2..bbe5d1a 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.h
+++ b/core/fpdfdoc/cpdf_viewerpreferences.h
@@ -24,12 +24,12 @@
bool PrintScaling() const;
int32_t NumCopies() const;
CPDF_Array* PrintPageRange() const;
- CFX_ByteString Duplex() const;
+ ByteString Duplex() const;
// Gets the entry for |bsKey|. If the entry exists and it is of type name,
// then this method writes the value into |bsVal| and returns true. Otherwise
// returns false and |bsVal| is untouched. |bsVal| must not be NULL.
- bool GenericName(const CFX_ByteString& bsKey, CFX_ByteString* bsVal) const;
+ bool GenericName(const ByteString& bsKey, ByteString* bsVal) const;
private:
CPDF_Dictionary* GetViewerPreferences() const;
diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp
index 584a85a..914e416 100644
--- a/core/fpdfdoc/cpvt_color.cpp
+++ b/core/fpdfdoc/cpvt_color.cpp
@@ -9,8 +9,8 @@
#include "core/fpdfapi/parser/cpdf_simple_parser.h"
// Static.
-CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) {
- CPDF_SimpleParser syntax(str.AsStringC());
+CPVT_Color CPVT_Color::ParseColor(const ByteString& str) {
+ CPDF_SimpleParser syntax(str.AsStringView());
if (syntax.FindTagParamFromStart("g", 1))
return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord()));
diff --git a/core/fpdfdoc/cpvt_color.h b/core/fpdfdoc/cpvt_color.h
index 2db3b83..a7e925b 100644
--- a/core/fpdfdoc/cpvt_color.h
+++ b/core/fpdfdoc/cpvt_color.h
@@ -31,7 +31,7 @@
float fColor3;
float fColor4;
- static CPVT_Color ParseColor(const CFX_ByteString& str);
+ static CPVT_Color ParseColor(const ByteString& str);
static CPVT_Color ParseColor(const CPDF_Array& array);
};
diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp
index 0edabd1..aaf8661 100644
--- a/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/core/fpdfdoc/cpvt_fontmap.cpp
@@ -17,7 +17,7 @@
CPVT_FontMap::CPVT_FontMap(CPDF_Document* pDoc,
CPDF_Dictionary* pResDict,
CPDF_Font* pDefFont,
- const CFX_ByteString& sDefFontAlias)
+ const ByteString& sDefFontAlias)
: m_pDocument(pDoc),
m_pResDict(pResDict),
m_pDefFont(pDefFont),
@@ -27,7 +27,7 @@
CPDF_Font* CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
const CPDF_Dictionary* pResDict,
- CFX_ByteString* sSysFontAlias) {
+ ByteString* sSysFontAlias) {
if (!pDoc || !pResDict)
return nullptr;
@@ -59,7 +59,7 @@
}
}
-CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
+ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
switch (nFontIndex) {
case 0:
return m_sDefFontAlias;
@@ -70,7 +70,7 @@
}
return m_sSysFontAlias;
default:
- return CFX_ByteString();
+ return ByteString();
}
}
diff --git a/core/fpdfdoc/cpvt_fontmap.h b/core/fpdfdoc/cpvt_fontmap.h
index da69463..feca454 100644
--- a/core/fpdfdoc/cpvt_fontmap.h
+++ b/core/fpdfdoc/cpvt_fontmap.h
@@ -22,12 +22,12 @@
CPVT_FontMap(CPDF_Document* pDoc,
CPDF_Dictionary* pResDict,
CPDF_Font* pDefFont,
- const CFX_ByteString& sDefFontAlias);
+ const ByteString& sDefFontAlias);
~CPVT_FontMap() override;
// IPVT_FontMap:
CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
- CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
+ ByteString GetPDFFontAlias(int32_t nFontIndex) override;
int32_t GetWordFontIndex(uint16_t word,
int32_t charset,
int32_t nFontIndex) override;
@@ -36,15 +36,15 @@
static CPDF_Font* GetAnnotSysPDFFont(CPDF_Document* pDoc,
const CPDF_Dictionary* pResDict,
- CFX_ByteString* sSysFontAlias);
+ ByteString* sSysFontAlias);
private:
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> const m_pResDict;
CFX_UnownedPtr<CPDF_Font> const m_pDefFont;
CFX_UnownedPtr<CPDF_Font> m_pSysFont;
- const CFX_ByteString m_sDefFontAlias;
- CFX_ByteString m_sSysFontAlias;
+ const ByteString m_sDefFontAlias;
+ ByteString m_sSysFontAlias;
};
#endif // CORE_FPDFDOC_CPVT_FONTMAP_H_
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 132e771..634864c 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -42,7 +42,7 @@
if (!pFormDict)
return false;
- CFX_ByteString DA;
+ ByteString DA;
if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA"))
DA = pDAObj->GetString();
if (DA.IsEmpty())
@@ -50,9 +50,9 @@
if (DA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(DA.AsStringC());
+ CPDF_SimpleParser syntax(DA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString sFontName(syntax.GetWord());
+ ByteString sFontName(syntax.GetWord());
sFontName = PDF_NameDecode(sFontName);
if (sFontName.IsEmpty())
return false;
@@ -161,14 +161,13 @@
crBG = CPVT_Color::ParseColor(*pArray);
}
std::ostringstream sAppStream;
- CFX_ByteString sBG =
- CPVT_GenerateAP::GenerateColorAP(crBG, PaintOperation::FILL);
+ ByteString sBG = CPVT_GenerateAP::GenerateColorAP(crBG, PaintOperation::FILL);
if (sBG.GetLength() > 0) {
sAppStream << "q\n" << sBG << rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.Width() << " " << rcBBox.Height() << " re f\n"
<< "Q\n";
}
- CFX_ByteString sBorderStream = CPVT_GenerateAP::GenerateBorderAP(
+ ByteString sBorderStream = CPVT_GenerateAP::GenerateBorderAP(
rcBBox, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle,
dsBorder);
if (sBorderStream.GetLength() > 0)
@@ -208,10 +207,10 @@
}
switch (nWidgetType) {
case 0: {
- CFX_WideString swValue =
+ WideString swValue =
FPDF_GetFieldAttr(pAnnotDict, "V")
? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
- : CFX_WideString();
+ : WideString();
int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")
? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger()
: 0;
@@ -260,7 +259,7 @@
ptOffset =
CFX_PointF(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
}
- CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
+ ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, !bCharArray, subWord);
if (sBody.GetLength() > 0) {
sAppStream << "/Tx BMC\n"
@@ -279,10 +278,10 @@
}
} break;
case 1: {
- CFX_WideString swValue =
+ WideString swValue =
FPDF_GetFieldAttr(pAnnotDict, "V")
? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
- : CFX_WideString();
+ : WideString();
CPVT_FontMap map(
pDoc, pStreamDict ? pStreamDict->GetDictFor("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
@@ -307,8 +306,8 @@
CFX_FloatRect rcContent = vt.GetContentRect();
CFX_PointF ptOffset =
CFX_PointF(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
- CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, true, 0);
+ ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
+ ptOffset, true, 0);
if (sEdit.GetLength() > 0) {
sAppStream << "/Tx BMC\n"
<< "q\n";
@@ -320,7 +319,7 @@
<< sEdit << "ET\n"
<< "Q\nEMC\n";
}
- CFX_ByteString sButton = CPVT_GenerateAP::GenerateColorAP(
+ ByteString sButton = CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 220.0f / 255.0f, 220.0f / 255.0f,
220.0f / 255.0f),
PaintOperation::FILL);
@@ -329,7 +328,7 @@
sAppStream << rcButton.left << " " << rcButton.bottom << " "
<< rcButton.Width() << " " << rcButton.Height() << " re f\n";
sAppStream << "Q\n";
- CFX_ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP(
+ ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP(
rcButton, 2, CPVT_Color(CPVT_Color::kGray, 0),
CPVT_Color(CPVT_Color::kGray, 1),
CPVT_Color(CPVT_Color::kGray, 0.5), BorderStyle::BEVELED,
@@ -368,7 +367,7 @@
break;
if (CPDF_Object* pOpt = pOpts->GetDirectObjectAt(i)) {
- CFX_WideString swItem;
+ WideString swItem;
if (pOpt->IsString())
swItem = pOpt->GetUnicodeText();
else if (CPDF_Array* pArray = pOpt->AsArray())
@@ -461,9 +460,9 @@
return true;
}
-CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor,
- const CPVT_Color& crDefaultColor,
- PaintOperation nOperation) {
+ByteString GetColorStringWithDefault(CPDF_Array* pColor,
+ const CPVT_Color& crDefaultColor,
+ PaintOperation nOperation) {
if (pColor) {
CPVT_Color color = CPVT_Color::ParseColor(*pColor);
return CPVT_GenerateAP::GenerateColorAP(color, nOperation);
@@ -500,10 +499,10 @@
return nullptr;
}
-CFX_ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) {
+ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) {
CPDF_Array* pDashArray = GetDashArray(pAnnotDict);
if (!pDashArray || pDashArray->IsEmpty())
- return CFX_ByteString();
+ return ByteString();
// Support maximum of ten elements in the dash array.
size_t pDashArrayCount = std::min<size_t>(pDashArray->GetCount(), 10);
@@ -514,14 +513,14 @@
sDashStream << pDashArray->GetNumberAt(i) << " ";
sDashStream << "] 0 d\n";
- return CFX_ByteString(sDashStream);
+ return ByteString(sDashStream);
}
-CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
- const CPDF_Dictionary& pAnnotDict,
- CPDF_Font* pDefFont,
- const CFX_ByteString& sFontName) {
- CFX_WideString swValue(pAnnotDict.GetUnicodeTextFor("T"));
+ByteString GetPopupContentsString(CPDF_Document* pDoc,
+ const CPDF_Dictionary& pAnnotDict,
+ CPDF_Font* pDefFont,
+ const ByteString& sFontName) {
+ WideString swValue(pAnnotDict.GetUnicodeTextFor("T"));
swValue += L'\n';
swValue += pAnnotDict.GetUnicodeTextFor("Contents");
CPVT_FontMap map(pDoc, nullptr, pDefFont, sFontName);
@@ -538,11 +537,11 @@
vt.SetText(swValue);
vt.RearrangeAll();
CFX_PointF ptOffset(3.0f, -3.0f);
- CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, false, 0);
+ ByteString sContent = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
+ ptOffset, false, 0);
if (sContent.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
sAppStream << "BT\n"
@@ -550,12 +549,12 @@
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::FILL)
<< sContent << "ET\n"
<< "Q\n";
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
std::unique_ptr<CPDF_Dictionary> GenerateResourceFontDict(
CPDF_Document* pDoc,
- const CFX_ByteString& sFontDictName) {
+ const ByteString& sFontDictName) {
CPDF_Dictionary* pFontDict = pDoc->NewIndirect<CPDF_Dictionary>();
pFontDict->SetNewFor<CPDF_Name>("Type", "Font");
pFontDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
@@ -569,13 +568,13 @@
return pResourceFontDict;
}
-CFX_ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) {
+ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) {
if (bIsStrokeRect)
return bIsFillRect ? "b" : "s";
return bIsFillRect ? "f" : "n";
}
-CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
+ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
std::ostringstream sAppStream;
sAppStream << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 1, 1, 0), PaintOperation::FILL);
@@ -622,7 +621,7 @@
}
sAppStream << "B*\n";
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
} // namespace
@@ -635,7 +634,7 @@
if (!pFieldTypeObj)
return false;
- CFX_ByteString field_type = pFieldTypeObj->GetString();
+ ByteString field_type = pFieldTypeObj->GetString();
if (field_type == "Tx")
return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict);
@@ -684,7 +683,7 @@
bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
@@ -758,7 +757,7 @@
bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -796,7 +795,7 @@
return false;
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -840,7 +839,7 @@
bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
@@ -863,7 +862,7 @@
bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -890,7 +889,7 @@
bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs\n";
sAppStream << GenerateColorAP(CPVT_Color(CPVT_Color::kRGB, 1, 1, 0),
@@ -908,7 +907,7 @@
sAppStream << rect.left << " " << rect.bottom << " " << rect.Width() << " "
<< rect.Height() << " re b\n";
- CFX_ByteString sFontName = "FONT";
+ ByteString sFontName = "FONT";
auto pResourceFontDict = GenerateResourceFontDict(pDoc, sFontName);
CPDF_Font* pDefFont = pDoc->LoadFont(pResourceFontDict.get());
if (!pDefFont)
@@ -928,7 +927,7 @@
bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
@@ -976,7 +975,7 @@
bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -1025,7 +1024,7 @@
bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -1050,7 +1049,7 @@
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
+ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
CPDF_VariableText::Iterator* pIterator,
const CFX_PointF& ptOffset,
@@ -1070,7 +1069,7 @@
if (bContinuous) {
if (place.LineCmp(oldplace) != 0) {
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sEditStream << sLineStream.str();
sLineStream.str("");
sWords.str("");
@@ -1095,7 +1094,7 @@
if (pIterator->GetWord(word)) {
if (word.nFontIndex != nCurFontIndex) {
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
sLineStream << GetFontSetString(pFontMap, word.nFontIndex,
@@ -1126,24 +1125,23 @@
}
}
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sEditStream << sLineStream.str();
sWords.str("");
}
- return CFX_ByteString(sEditStream);
+ return ByteString(sEditStream);
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
- const CFX_FloatRect& rect,
- float fWidth,
- const CPVT_Color& color,
- const CPVT_Color& crLeftTop,
- const CPVT_Color& crRightBottom,
- BorderStyle nStyle,
- const CPVT_Dash& dash) {
+ByteString CPVT_GenerateAP::GenerateBorderAP(const CFX_FloatRect& rect,
+ float fWidth,
+ const CPVT_Color& color,
+ const CPVT_Color& crLeftTop,
+ const CPVT_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPVT_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
float fLeft = rect.left;
float fRight = rect.right;
float fTop = rect.top;
@@ -1238,12 +1236,12 @@
break;
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
- PaintOperation nOperation) {
+ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
+ PaintOperation nOperation) {
std::ostringstream sColorStream;
switch (color.nColorType) {
case CPVT_Color::kRGB:
@@ -1266,14 +1264,14 @@
case CPVT_Color::kTransparent:
break;
}
- return CFX_ByteString(sColorStream);
+ return ByteString(sColorStream);
}
// Static.
std::unique_ptr<CPDF_Dictionary> CPVT_GenerateAP::GenerateExtGStateDict(
const CPDF_Dictionary& pAnnotDict,
- const CFX_ByteString& sExtGSDictName,
- const CFX_ByteString& sBlendMode) {
+ const ByteString& sExtGSDictName,
+ const ByteString& sBlendMode) {
auto pGSDict =
pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool());
pGSDict->SetNewFor<CPDF_String>("Type", "ExtGState", false);
@@ -1334,11 +1332,11 @@
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord) {
- CFX_ByteString sWord;
+ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord) {
+ ByteString sWord;
if (SubWord > 0) {
sWord.Format("%c", SubWord);
return sWord;
@@ -1361,22 +1359,21 @@
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetWordRenderString(
- const CFX_ByteString& strWords) {
+ByteString CPVT_GenerateAP::GetWordRenderString(const ByteString& strWords) {
if (strWords.GetLength() > 0)
return PDF_EncodeString(strWords, false) + " Tj\n";
return "";
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize) {
+ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize) {
std::ostringstream sRet;
if (pFontMap) {
- CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
+ ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
if (sFontAlias.GetLength() > 0 && fFontSize > 0)
sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
}
- return CFX_ByteString(sRet);
+ return ByteString(sRet);
}
diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h
index cee96cd..2812b29 100644
--- a/core/fpdfdoc/cpvt_generateap.h
+++ b/core/fpdfdoc/cpvt_generateap.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFDOC_CPVT_GENERATEAP_H_
#define CORE_FPDFDOC_CPVT_GENERATEAP_H_
+#include <memory>
+
#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_variabletext.h"
#include "core/fpdfdoc/cpvt_color.h"
@@ -46,24 +48,24 @@
CPDF_Dictionary* pAnnotDict);
static bool GenerateUnderlineAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict);
- static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
- CPDF_VariableText::Iterator* pIterator,
- const CFX_PointF& ptOffset,
- bool bContinuous,
- uint16_t SubWord);
- static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
- float fWidth,
- const CPVT_Color& color,
- const CPVT_Color& crLeftTop,
- const CPVT_Color& crRightBottom,
- BorderStyle nStyle,
- const CPVT_Dash& dash);
- static CFX_ByteString GenerateColorAP(const CPVT_Color& color,
- PaintOperation nOperation);
+ static ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
+ CPDF_VariableText::Iterator* pIterator,
+ const CFX_PointF& ptOffset,
+ bool bContinuous,
+ uint16_t SubWord);
+ static ByteString GenerateBorderAP(const CFX_FloatRect& rect,
+ float fWidth,
+ const CPVT_Color& color,
+ const CPVT_Color& crLeftTop,
+ const CPVT_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPVT_Dash& dash);
+ static ByteString GenerateColorAP(const CPVT_Color& color,
+ PaintOperation nOperation);
static std::unique_ptr<CPDF_Dictionary> GenerateExtGStateDict(
const CPDF_Dictionary& pAnnotDict,
- const CFX_ByteString& sExtGSDictName,
- const CFX_ByteString& sBlendMode);
+ const ByteString& sExtGSDictName,
+ const ByteString& sBlendMode);
static std::unique_ptr<CPDF_Dictionary> GenerateResourceDict(
CPDF_Document* pDoc,
std::unique_ptr<CPDF_Dictionary> pExtGStateDict,
@@ -75,14 +77,14 @@
std::unique_ptr<CPDF_Dictionary> pResourceDict,
bool bIsTextMarkupAnnotation);
- static CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord);
- static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords);
- static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize);
+ static ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord);
+ static ByteString GetWordRenderString(const ByteString& strWords);
+ static ByteString GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize);
};
#endif // CORE_FPDFDOC_CPVT_GENERATEAP_H_
diff --git a/core/fpdfdoc/ipdf_formnotify.h b/core/fpdfdoc/ipdf_formnotify.h
index bf6127d..52e5cc9 100644
--- a/core/fpdfdoc/ipdf_formnotify.h
+++ b/core/fpdfdoc/ipdf_formnotify.h
@@ -17,10 +17,10 @@
virtual ~IPDF_FormNotify() {}
virtual int BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) = 0;
+ const WideString& csValue) = 0;
virtual void AfterValueChange(CPDF_FormField* pField) = 0;
virtual int BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) = 0;
+ const WideString& csValue) = 0;
virtual void AfterSelectionChange(CPDF_FormField* pField) = 0;
virtual void AfterCheckedStatusChange(CPDF_FormField* pField) = 0;
virtual int BeforeFormReset(CPDF_InterForm* pForm) = 0;
diff --git a/core/fpdfdoc/ipvt_fontmap.h b/core/fpdfdoc/ipvt_fontmap.h
index 740cb19..31aa73b 100644
--- a/core/fpdfdoc/ipvt_fontmap.h
+++ b/core/fpdfdoc/ipvt_fontmap.h
@@ -18,7 +18,7 @@
virtual ~IPVT_FontMap() {}
virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0;
- virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
+ virtual ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
virtual int32_t GetWordFontIndex(uint16_t word,
int32_t charset,
int32_t nFontIndex) = 0;
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index a5eafe6..9111671 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -19,7 +19,7 @@
// |end|. The purpose of this function is to separate url from the surrounding
// context characters, we do not intend to fully validate the url. |str|
// contains lower case characters only.
-FX_STRSIZE FindWebLinkEnding(const CFX_WideString& str,
+FX_STRSIZE FindWebLinkEnding(const WideString& str,
FX_STRSIZE start,
FX_STRSIZE end) {
if (str.Contains(L'/', start)) {
@@ -67,7 +67,7 @@
// Remove characters from the end of |str|, delimited by |start| and |end|, up
// to and including |charToFind|. No-op if |charToFind| is not present. Updates
// |end| if characters were removed.
-void TrimBackwardsToChar(const CFX_WideString& str,
+void TrimBackwardsToChar(const WideString& str,
wchar_t charToFind,
FX_STRSIZE start,
FX_STRSIZE* end) {
@@ -83,7 +83,7 @@
// |start| and |end| in |str|. Matches a closing bracket or quote for each
// opening character and, if present, removes everything afterwards. Returns the
// new end position for the string.
-FX_STRSIZE TrimExternalBracketsFromWebLink(const CFX_WideString& str,
+FX_STRSIZE TrimExternalBracketsFromWebLink(const WideString& str,
FX_STRSIZE start,
FX_STRSIZE end) {
for (FX_STRSIZE pos = 0; pos < start; pos++) {
@@ -144,7 +144,7 @@
pos++;
continue;
}
- CFX_WideString strBeCheck;
+ WideString strBeCheck;
strBeCheck = m_pTextPage->GetPageText(start, nCount);
if (bLineBreak) {
strBeCheck.Remove(TEXT_LINEFEED_CHAR);
@@ -187,7 +187,7 @@
}
}
-bool CPDF_LinkExtract::CheckWebLink(CFX_WideString* strBeCheck,
+bool CPDF_LinkExtract::CheckWebLink(WideString* strBeCheck,
int32_t* nStart,
int32_t* nCount) {
static const wchar_t kHttpScheme[] = L"http";
@@ -195,7 +195,7 @@
static const wchar_t kWWWAddrStart[] = L"www.";
static const FX_STRSIZE kWWWAddrStartLen = FXSYS_len(kWWWAddrStart);
- CFX_WideString str = *strBeCheck;
+ WideString str = *strBeCheck;
str.MakeLower();
FX_STRSIZE len = str.GetLength();
@@ -237,7 +237,7 @@
return false;
}
-bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
+bool CPDF_LinkExtract::CheckMailLink(WideString* str) {
auto aPos = str->Find(L'@');
// Invalid when no '@' or when starts/ends with '@'.
if (!aPos.has_value() || aPos.value() == 0 || aPos == str->GetLength() - 1)
@@ -305,7 +305,7 @@
return true;
}
-CFX_WideString CPDF_LinkExtract::GetURL(size_t index) const {
+WideString CPDF_LinkExtract::GetURL(size_t index) const {
return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L"";
}
diff --git a/core/fpdftext/cpdf_linkextract.h b/core/fpdftext/cpdf_linkextract.h
index 5c022d3..db82deb 100644
--- a/core/fpdftext/cpdf_linkextract.h
+++ b/core/fpdftext/cpdf_linkextract.h
@@ -22,23 +22,23 @@
void ExtractLinks();
size_t CountLinks() const { return m_LinkArray.size(); }
- CFX_WideString GetURL(size_t index) const;
+ WideString GetURL(size_t index) const;
std::vector<CFX_FloatRect> GetRects(size_t index) const;
protected:
void ParseLink();
- bool CheckWebLink(CFX_WideString* str, int32_t* nStart, int32_t* nCount);
- bool CheckMailLink(CFX_WideString* str);
+ bool CheckWebLink(WideString* str, int32_t* nStart, int32_t* nCount);
+ bool CheckMailLink(WideString* str);
private:
struct Link {
int m_Start;
int m_Count;
- CFX_WideString m_strUrl;
+ WideString m_strUrl;
};
CFX_UnownedPtr<const CPDF_TextPage> const m_pTextPage;
- CFX_WideString m_strPageText;
+ WideString m_strPageText;
std::vector<Link> m_LinkArray;
};
diff --git a/core/fpdftext/cpdf_linkextract_unittest.cpp b/core/fpdftext/cpdf_linkextract_unittest.cpp
index efeb53e..30438e6 100644
--- a/core/fpdftext/cpdf_linkextract_unittest.cpp
+++ b/core/fpdftext/cpdf_linkextract_unittest.cpp
@@ -32,7 +32,7 @@
};
for (size_t i = 0; i < FX_ArraySize(invalid_strs); ++i) {
const wchar_t* const input = invalid_strs[i];
- CFX_WideString text_str(input);
+ WideString text_str(input);
EXPECT_FALSE(extractor.CheckMailLink(&text_str)) << input;
}
@@ -53,8 +53,8 @@
};
for (size_t i = 0; i < FX_ArraySize(valid_strs); ++i) {
const wchar_t* const input = valid_strs[i][0];
- CFX_WideString text_str(input);
- CFX_WideString expected_str(L"mailto:");
+ WideString text_str(input);
+ WideString expected_str(L"mailto:");
expected_str += valid_strs[i][1];
EXPECT_TRUE(extractor.CheckMailLink(&text_str)) << input;
EXPECT_STREQ(expected_str.c_str(), text_str.c_str());
@@ -80,7 +80,7 @@
const int32_t DEFAULT_VALUE = -42;
for (size_t i = 0; i < FX_ArraySize(invalid_cases); ++i) {
const wchar_t* const input = invalid_cases[i];
- CFX_WideString text_str(input);
+ WideString text_str(input);
int32_t start_offset = DEFAULT_VALUE;
int32_t count = DEFAULT_VALUE;
EXPECT_FALSE(extractor.CheckWebLink(&text_str, &start_offset, &count))
@@ -175,7 +175,7 @@
};
for (size_t i = 0; i < FX_ArraySize(valid_cases); ++i) {
const wchar_t* const input = valid_cases[i].input_string;
- CFX_WideString text_str(input);
+ WideString text_str(input);
int32_t start_offset = DEFAULT_VALUE;
int32_t count = DEFAULT_VALUE;
EXPECT_TRUE(extractor.CheckWebLink(&text_str, &start_offset, &count))
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index ee1d51b..f73793c 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -348,14 +348,14 @@
return pos < pdfium::CollectionSize<int>(m_CharList) ? pos : NearPos;
}
-CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
+WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
if (!m_bIsParsed)
- return CFX_WideString();
+ return WideString();
float posy = 0;
bool IsContainPreChar = false;
bool IsAddLineFeed = false;
- CFX_WideString strText;
+ WideString strText;
for (const auto& charinfo : m_CharList) {
if (IsRectIntersect(rect, charinfo.m_CharBox)) {
if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
@@ -436,7 +436,7 @@
}
}
-CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
+WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
if (!m_bIsParsed || nCount == 0)
return L"";
@@ -445,8 +445,8 @@
if (nCount == -1) {
nCount = pdfium::CollectionSize<int>(m_CharList) - start;
- CFX_WideStringC wsTextBuf = m_TextBuf.AsStringC();
- return CFX_WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
+ WideStringView wsTextBuf = m_TextBuf.AsStringView();
+ return WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
}
if (nCount <= 0 || m_CharList.empty())
return L"";
@@ -478,7 +478,7 @@
nCount = start + nCount - nCountOffset - startindex;
if (nCount <= 0)
return L"";
- return CFX_WideString(m_TextBuf.AsStringC().Mid(startindex, nCount));
+ return WideString(m_TextBuf.AsStringView().Mid(startindex, nCount));
}
int CPDF_TextPage::CountRects(int start, int nCount) {
@@ -630,7 +630,7 @@
if (int w = pFont->GetCharWidthF(charCode))
return w;
- CFX_ByteString str;
+ ByteString str;
pFont->AppendChar(&str, charCode);
if (int w = pFont->GetStringWidth(str.c_str(), 1))
return w;
@@ -702,7 +702,7 @@
if (m_TempCharList.empty())
return;
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
bool bPrevSpace = false;
for (FX_STRSIZE i = 0; i < str.GetLength(); i++) {
if (str[i] != ' ') {
@@ -814,7 +814,7 @@
if (nContentMark < 1)
return FPDFText_MarkedContent::Pass;
- CFX_WideString actText;
+ WideString actText;
bool bExist = false;
CPDF_Dictionary* pDict = nullptr;
int n = 0;
@@ -876,7 +876,7 @@
if (nContentMark < 1)
return;
- CFX_WideString actText;
+ WideString actText;
for (int n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
CPDF_Dictionary* pDict = item.GetParam();
@@ -941,13 +941,13 @@
bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
const CPDF_Font* pFont,
int nItems) const {
- CFX_WideString str;
+ WideString str;
for (int32_t i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1))
continue;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
wchar_t wChar = !wstrItem.IsEmpty() ? wstrItem[0] : 0;
if (wChar == 0)
wChar = item.m_CharCode;
@@ -1004,7 +1004,7 @@
if (pTextObj->CountChars() == 1) {
CPDF_TextObjectItem item;
pTextObj->GetCharInfo(0, &item);
- CFX_WideString wstrItem =
+ WideString wstrItem =
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += (wchar_t)item.m_CharCode;
@@ -1013,7 +1013,7 @@
return;
}
while (m_TempTextBuf.GetSize() > 0 &&
- m_TempTextBuf.AsStringC()[m_TempTextBuf.GetLength() - 1] ==
+ m_TempTextBuf.AsStringView()[m_TempTextBuf.GetLength() - 1] ==
0x20) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1053,9 +1053,9 @@
PAGECHAR_INFO charinfo;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1)) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (str.IsEmpty())
- str = m_TextBuf.AsStringC();
+ str = m_TextBuf.AsStringView();
if (str.IsEmpty() || str[str.GetLength() - 1] == TEXT_SPACE_CHAR)
continue;
@@ -1106,7 +1106,7 @@
continue;
}
spacing = 0;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
bool bNoUnicode = false;
if (wstrItem.IsEmpty() && item.m_CharCode) {
wstrItem += static_cast<wchar_t>(item.m_CharCode);
@@ -1177,7 +1177,7 @@
m_TempCharList.push_back(charinfo);
}
} else if (i == 0) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1220,11 +1220,11 @@
}
bool CPDF_TextPage::IsHyphen(wchar_t curChar) const {
- CFX_WideStringC curText;
+ WideStringView curText;
if (!m_TempTextBuf.IsEmpty())
- curText = m_TempTextBuf.AsStringC();
+ curText = m_TempTextBuf.AsStringView();
else if (!m_TextBuf.IsEmpty())
- curText = m_TextBuf.AsStringC();
+ curText = m_TextBuf.AsStringView();
else
return false;
@@ -1267,8 +1267,7 @@
int nItem = m_pPreTextObj->CountItems();
m_pPreTextObj->GetItemInfo(nItem - 1, &PrevItem);
pObj->GetItemInfo(0, &item);
- CFX_WideString wstrItem =
- pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += static_cast<wchar_t>(item.m_CharCode);
wchar_t curChar = wstrItem[0];
@@ -1356,7 +1355,7 @@
IsHyphen(curChar)) {
return GenerateCharacter::Hyphen;
}
- CFX_WideString PrevStr =
+ WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
if (PrevStr.IsEmpty())
return GenerateCharacter::None;
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 41892ea..ef55ad0 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -106,8 +106,8 @@
void GetCharInfo(int index, FPDF_CHAR_INFO* info) const;
std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const;
int GetIndexAtPos(const CFX_PointF& point, const CFX_SizeF& tolerance) const;
- CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const;
- CFX_WideString GetPageText(int start = 0, int nCount = -1) const;
+ WideString GetTextByRect(const CFX_FloatRect& rect) const;
+ WideString GetPageText(int start = 0, int nCount = -1) const;
int CountRects(int start, int nCount);
void GetRect(int rectIndex,
float& left,
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 3678e42..f00b8a9 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -79,14 +79,14 @@
return m_pTextPage->CharIndexFromTextIndex(index);
}
-bool CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
+bool CPDF_TextPageFind::FindFirst(const WideString& findwhat,
int flags,
pdfium::Optional<FX_STRSIZE> startPos) {
if (!m_pTextPage)
return false;
if (m_strText.IsEmpty() || m_bMatchCase != (flags & FPDFTEXT_MATCHCASE))
m_strText = m_pTextPage->GetPageText();
- CFX_WideString findwhatStr = findwhat;
+ WideString findwhatStr = findwhat;
m_findWhat = findwhatStr;
m_flags = flags;
m_bMatchCase = flags & FPDFTEXT_MATCHCASE;
@@ -147,7 +147,7 @@
FX_STRSIZE nStartPos = m_findNextStart.value();
bool bSpaceStart = false;
for (int iWord = 0; iWord < nCount; iWord++) {
- CFX_WideString csWord = m_csFindWhatArray[iWord];
+ WideString csWord = m_csFindWhatArray[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
wchar_t strInsert = m_strText[nStartPos];
@@ -175,7 +175,7 @@
if (iWord != 0 && !bSpaceStart) {
FX_STRSIZE PreResEndPos = nStartPos;
int curChar = csWord[0];
- CFX_WideString lastWord = m_csFindWhatArray[iWord - 1];
+ WideString lastWord = m_csFindWhatArray[iWord - 1];
int lastChar = lastWord[lastWord.GetLength() - 1];
if (nStartPos == nResultPos.value() &&
!(IsIgnoreSpaceCharacter(lastChar) ||
@@ -275,12 +275,12 @@
return m_IsFind;
}
-void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
+void CPDF_TextPageFind::ExtractFindWhat(const WideString& findwhat) {
if (findwhat.IsEmpty())
return;
int index = 0;
while (1) {
- CFX_WideString csWord = TEXT_EMPTY;
+ WideString csWord = TEXT_EMPTY;
int ret =
ExtractSubString(csWord, findwhat.c_str(), index, TEXT_SPACE_CHAR);
if (csWord.IsEmpty()) {
@@ -294,7 +294,7 @@
}
FX_STRSIZE pos = 0;
while (pos < csWord.GetLength()) {
- CFX_WideString curStr = csWord.Mid(pos, 1);
+ WideString curStr = csWord.Mid(pos, 1);
wchar_t curChar = csWord[pos];
if (IsIgnoreSpaceCharacter(curChar)) {
if (pos > 0 && curChar == 0x2019) {
@@ -320,7 +320,7 @@
}
}
-bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
+bool CPDF_TextPageFind::IsMatchWholeWord(const WideString& csPageText,
FX_STRSIZE startPos,
FX_STRSIZE endPos) {
if (startPos > endPos)
@@ -360,7 +360,7 @@
return true;
}
-bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
+bool CPDF_TextPageFind::ExtractSubString(WideString& rString,
const wchar_t* lpszFullString,
int iSubString,
wchar_t chSep) {
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index cf8d3d1..f9a28a0 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -22,7 +22,7 @@
explicit CPDF_TextPageFind(const CPDF_TextPage* pTextPage);
~CPDF_TextPageFind();
- bool FindFirst(const CFX_WideString& findwhat,
+ bool FindFirst(const WideString& findwhat,
int flags,
pdfium::Optional<FX_STRSIZE> startPos);
bool FindNext();
@@ -31,11 +31,11 @@
int GetMatchedCount() const;
protected:
- void ExtractFindWhat(const CFX_WideString& findwhat);
- bool IsMatchWholeWord(const CFX_WideString& csPageText,
+ void ExtractFindWhat(const WideString& findwhat);
+ bool IsMatchWholeWord(const WideString& csPageText,
FX_STRSIZE startPos,
FX_STRSIZE endPos);
- bool ExtractSubString(CFX_WideString& rString,
+ bool ExtractSubString(WideString& rString,
const wchar_t* lpszFullString,
int iSubString,
wchar_t chSep);
@@ -44,10 +44,10 @@
private:
std::vector<uint16_t> m_CharIndex;
CFX_UnownedPtr<const CPDF_TextPage> m_pTextPage;
- CFX_WideString m_strText;
- CFX_WideString m_findWhat;
+ WideString m_strText;
+ WideString m_findWhat;
int m_flags;
- std::vector<CFX_WideString> m_csFindWhatArray;
+ std::vector<WideString> m_csFindWhatArray;
pdfium::Optional<FX_STRSIZE> m_findNextStart;
pdfium::Optional<FX_STRSIZE> m_findPreStart;
bool m_bMatchCase;
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 7570193..f7e3546 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -71,7 +71,7 @@
if (len > 21) {
uint8_t size = *buf++;
if (size != 0)
- pAttribute->m_strAuthor = CFX_ByteString(buf, size);
+ pAttribute->m_strAuthor = ByteString(buf, size);
else
pAttribute->m_strAuthor.clear();
}
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 8a3de3a..ae70389 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -86,8 +86,8 @@
buf = "Author";
if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor =
- CFX_ByteString(reinterpret_cast<uint8_t*>(text[i].text),
- static_cast<FX_STRSIZE>(text[i].text_length));
+ ByteString(reinterpret_cast<uint8_t*>(text[i].text),
+ static_cast<FX_STRSIZE>(text[i].text_length));
}
}
}
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 2e83319..926a884 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -48,7 +48,7 @@
int32_t m_nYDPI;
float m_fAspectRatio;
uint16_t m_wDPIUnit;
- CFX_ByteString m_strAuthor;
+ ByteString m_strAuthor;
int32_t m_nGifLeft;
int32_t m_nGifTop;
uint32_t* m_pGifLocalPalette;
diff --git a/core/fxcodec/lgif/cgifcontext.h b/core/fxcodec/lgif/cgifcontext.h
index 1bd6d46..03976a7 100644
--- a/core/fxcodec/lgif/cgifcontext.h
+++ b/core/fxcodec/lgif/cgifcontext.h
@@ -46,7 +46,7 @@
uint32_t avail_in;
int32_t decode_status;
uint32_t skip_size;
- CFX_ByteString cmt_data;
+ ByteString cmt_data;
std::unique_ptr<GifGCE> m_GifGCE;
uint8_t* next_in;
std::vector<std::unique_ptr<GifImage>> m_Images;
diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp
index cef4f9a..18385c3 100644
--- a/core/fxcodec/lgif/fx_gif.cpp
+++ b/core/fxcodec/lgif/fx_gif.cpp
@@ -61,7 +61,7 @@
context->skip_size = skip_size_org;
return GifDecodeStatus::Unfinished;
}
- context->cmt_data += CFX_ByteString(data_ptr, data_size);
+ context->cmt_data += ByteString(data_ptr, data_size);
}
break;
}
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/bytestring.cpp
similarity index 76%
rename from core/fxcrt/cfx_bytestring.cpp
rename to core/fxcrt/bytestring.cpp
index 073591a..dd4dbd9 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/bytestring.h"
#include <stddef.h>
@@ -21,9 +21,9 @@
#include "third_party/base/stl_util.h"
template class CFX_StringDataTemplate<char>;
-template class CFX_StringCTemplate<char>;
-template class CFX_StringPoolTemplate<CFX_ByteString>;
-template struct std::hash<CFX_ByteString>;
+template class fxcrt::StringViewTemplate<char>;
+template class CFX_StringPoolTemplate<ByteString>;
+template struct std::hash<ByteString>;
namespace {
@@ -66,7 +66,7 @@
}
#endif
-CFX_ByteString GetByteString(uint16_t codepage, const CFX_WideStringC& wstr) {
+ByteString GetByteString(uint16_t codepage, const WideStringView& wstr) {
ASSERT(IsValidCodePage(codepage));
int src_len = wstr.GetLength();
@@ -74,9 +74,9 @@
FXSYS_WideCharToMultiByte(codepage, 0, wstr.unterminated_c_str(), src_len,
nullptr, 0, nullptr, nullptr);
if (!dest_len)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString bstr;
+ ByteString bstr;
char* dest_buf = bstr.GetBuffer(dest_len);
FXSYS_WideCharToMultiByte(codepage, 0, wstr.unterminated_c_str(), src_len,
dest_buf, dest_len, nullptr, nullptr);
@@ -86,45 +86,45 @@
} // namespace
-static_assert(sizeof(CFX_ByteString) <= sizeof(char*),
+namespace fxcrt {
+
+static_assert(sizeof(ByteString) <= sizeof(char*),
"Strings must not require more space than pointers");
-CFX_ByteString::CFX_ByteString(const char* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const char* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(StringData::Create(pStr, nLen));
}
-CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(
StringData::Create(reinterpret_cast<const char*>(pStr), nLen));
}
-CFX_ByteString::CFX_ByteString() {}
+ByteString::ByteString() {}
-CFX_ByteString::CFX_ByteString(const CFX_ByteString& other)
- : m_pData(other.m_pData) {}
+ByteString::ByteString(const ByteString& other) : m_pData(other.m_pData) {}
-CFX_ByteString::CFX_ByteString(CFX_ByteString&& other) noexcept {
+ByteString::ByteString(ByteString&& other) noexcept {
m_pData.Swap(other.m_pData);
}
-CFX_ByteString::CFX_ByteString(char ch) {
+ByteString::ByteString(char ch) {
m_pData.Reset(StringData::Create(1));
m_pData->m_String[0] = ch;
}
-CFX_ByteString::CFX_ByteString(const char* ptr)
- : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
+ByteString::ByteString(const char* ptr)
+ : ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) {
+ByteString::ByteString(const ByteStringView& stringSrc) {
if (!stringSrc.IsEmpty())
m_pData.Reset(StringData::Create(stringSrc.unterminated_c_str(),
stringSrc.GetLength()));
}
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
+ByteString::ByteString(const ByteStringView& str1, const ByteStringView& str2) {
FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
nSafeLen += str2.GetLength();
@@ -138,8 +138,7 @@
str2.GetLength());
}
-CFX_ByteString::CFX_ByteString(
- const std::initializer_list<CFX_ByteStringC>& list) {
+ByteString::ByteString(const std::initializer_list<ByteStringView>& list) {
FX_SAFE_STRSIZE nSafeLen = 0;
for (const auto& item : list)
nSafeLen += item.GetLength();
@@ -158,15 +157,15 @@
}
}
-CFX_ByteString::CFX_ByteString(const std::ostringstream& outStream) {
+ByteString::ByteString(const std::ostringstream& outStream) {
std::string str = outStream.str();
if (str.length() > 0)
m_pData.Reset(StringData::Create(str.c_str(), str.length()));
}
-CFX_ByteString::~CFX_ByteString() {}
+ByteString::~ByteString() {}
-const CFX_ByteString& CFX_ByteString::operator=(const char* pStr) {
+const ByteString& ByteString::operator=(const char* pStr) {
if (!pStr || !pStr[0])
clear();
else
@@ -175,8 +174,7 @@
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteStringC& stringSrc) {
+const ByteString& ByteString::operator=(const ByteStringView& stringSrc) {
if (stringSrc.IsEmpty())
clear();
else
@@ -185,41 +183,40 @@
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteString& stringSrc) {
+const ByteString& ByteString::operator=(const ByteString& stringSrc) {
if (m_pData != stringSrc.m_pData)
m_pData = stringSrc.m_pData;
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const char* pStr) {
+const ByteString& ByteString::operator+=(const char* pStr) {
if (pStr)
Concat(pStr, FXSYS_strlen(pStr));
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(char ch) {
+const ByteString& ByteString::operator+=(char ch) {
Concat(&ch, 1);
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) {
+const ByteString& ByteString::operator+=(const ByteString& str) {
if (str.m_pData)
Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) {
+const ByteString& ByteString::operator+=(const ByteStringView& str) {
if (!str.IsEmpty())
Concat(str.unterminated_c_str(), str.GetLength());
return *this;
}
-bool CFX_ByteString::operator==(const char* ptr) const {
+bool ByteString::operator==(const char* ptr) const {
if (!m_pData)
return !ptr || !ptr[0];
@@ -230,7 +227,7 @@
memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
-bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
+bool ByteString::operator==(const ByteStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -239,7 +236,7 @@
0;
}
-bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
+bool ByteString::operator==(const ByteString& other) const {
if (m_pData == other.m_pData)
return true;
@@ -254,7 +251,7 @@
m_pData->m_nDataLength) == 0;
}
-bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
+bool ByteString::operator<(const ByteString& str) const {
if (m_pData == str.m_pData)
return false;
@@ -263,7 +260,7 @@
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
-bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
+bool ByteString::EqualNoCase(const ByteStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -286,13 +283,13 @@
return true;
}
-void CFX_ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
AllocBeforeWrite(nSrcLen);
m_pData->CopyContents(pSrcData, nSrcLen);
m_pData->m_nDataLength = nSrcLen;
}
-void CFX_ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -313,7 +310,7 @@
m_pData.Swap(pNewData);
}
-void CFX_ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -325,7 +322,7 @@
m_pData.Reset(StringData::Create(nNewLength));
}
-void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (!m_pData)
return;
@@ -341,16 +338,16 @@
if (m_pData->m_nAllocLength - nNewLength >= 32) {
// Over arbitrary threshold, so pay the price to relocate. Force copy to
// always occur by holding a second reference to the string.
- CFX_ByteString preserve(*this);
+ ByteString preserve(*this);
ReallocBeforeWrite(nNewLength);
}
}
-void CFX_ByteString::Reserve(FX_STRSIZE len) {
+void ByteString::Reserve(FX_STRSIZE len) {
GetBuffer(len);
}
-char* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
+char* ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
if (!m_pData) {
if (nMinBufLength == 0)
return nullptr;
@@ -375,7 +372,7 @@
return m_pData->m_String;
}
-FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+FX_STRSIZE ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
if (!m_pData)
return 0;
@@ -396,7 +393,7 @@
return m_pData->m_nDataLength;
}
-void CFX_ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
if (!pSrcData || nSrcLen == 0)
return;
@@ -418,42 +415,42 @@
m_pData.Swap(pNewData);
}
-CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+ByteString ByteString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_pData)
- return CFX_ByteString();
+ return ByteString();
if (!IsValidIndex(first))
- return CFX_ByteString();
+ return ByteString();
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
if (!IsValidIndex(first + count - 1))
- return CFX_ByteString();
+ return ByteString();
if (first == 0 && count == m_pData->m_nDataLength)
return *this;
- CFX_ByteString dest;
+ ByteString dest;
AllocCopy(dest, count, first);
return dest;
}
-CFX_ByteString CFX_ByteString::Left(FX_STRSIZE count) const {
+ByteString ByteString::Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
return Mid(0, count);
}
-CFX_ByteString CFX_ByteString::Right(FX_STRSIZE count) const {
+ByteString ByteString::Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
return Mid(GetLength() - count, count);
}
-void CFX_ByteString::AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
+void ByteString::AllocCopy(ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
if (nCopyLen == 0)
return;
@@ -466,13 +463,13 @@
#define FORCE_UNICODE 0x20000
#define FORCE_INT64 0x40000
-CFX_ByteString CFX_ByteString::FormatInteger(int i) {
+ByteString ByteString::FormatInteger(int i) {
char buf[32];
FXSYS_snprintf(buf, 32, "%d", i);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-void CFX_ByteString::FormatV(const char* pFormat, va_list argList) {
+void ByteString::FormatV(const char* pFormat, va_list argList) {
va_list argListCopy;
va_copy(argListCopy, argList);
FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argListCopy);
@@ -491,20 +488,20 @@
}
}
-void CFX_ByteString::Format(const char* pFormat, ...) {
+void ByteString::Format(const char* pFormat, ...) {
va_list argList;
va_start(argList, pFormat);
FormatV(pFormat, argList);
va_end(argList);
}
-void CFX_ByteString::SetAt(FX_STRSIZE index, char c) {
+void ByteString::SetAt(FX_STRSIZE index, char c) {
ASSERT(IsValidIndex(index));
ReallocBeforeWrite(m_pData->m_nDataLength);
m_pData->m_String[index] = c;
}
-FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE location, char ch) {
+FX_STRSIZE ByteString::Insert(FX_STRSIZE location, char ch) {
const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
if (!IsValidLength(location))
return cur_length;
@@ -518,8 +515,7 @@
return new_length;
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(char ch,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> ByteString::Find(char ch, FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -533,8 +529,8 @@
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(const CFX_ByteStringC& subStr,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> ByteString::Find(const ByteStringView& subStr,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -549,7 +545,7 @@
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::ReverseFind(char ch) const {
+pdfium::Optional<FX_STRSIZE> ByteString::ReverseFind(char ch) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -561,7 +557,7 @@
return pdfium::Optional<FX_STRSIZE>();
}
-void CFX_ByteString::MakeLower() {
+void ByteString::MakeLower() {
if (!m_pData)
return;
@@ -569,7 +565,7 @@
FXSYS_strlwr(m_pData->m_String);
}
-void CFX_ByteString::MakeUpper() {
+void ByteString::MakeUpper() {
if (!m_pData)
return;
@@ -577,7 +573,7 @@
FXSYS_strupr(m_pData->m_String);
}
-FX_STRSIZE CFX_ByteString::Remove(char chRemove) {
+FX_STRSIZE ByteString::Remove(char chRemove) {
if (!m_pData || m_pData->m_nDataLength < 1)
return 0;
@@ -611,8 +607,8 @@
return nCount;
}
-FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
- const CFX_ByteStringC& pNew) {
+FX_STRSIZE ByteString::Replace(const ByteStringView& pOld,
+ const ByteStringView& pNew) {
if (!m_pData || pOld.IsEmpty())
return 0;
@@ -658,20 +654,20 @@
return nCount;
}
-CFX_WideString CFX_ByteString::UTF8Decode() const {
+WideString ByteString::UTF8Decode() const {
CFX_UTF8Decoder decoder;
for (FX_STRSIZE i = 0; i < GetLength(); i++) {
decoder.Input(static_cast<uint8_t>(m_pData->m_String[i]));
}
- return CFX_WideString(decoder.GetResult());
+ return WideString(decoder.GetResult());
}
// static
-CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
- return GetByteString(0, str.AsStringC());
+ByteString ByteString::FromUnicode(const WideString& str) {
+ return GetByteString(0, str.AsStringView());
}
-int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
+int ByteString::Compare(const ByteStringView& str) const {
if (!m_pData) {
return str.IsEmpty() ? 0 : -1;
}
@@ -695,7 +691,7 @@
return 0;
}
-void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) {
+void ByteString::TrimRight(const ByteStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -721,15 +717,15 @@
}
}
-void CFX_ByteString::TrimRight(char chTarget) {
- TrimRight(CFX_ByteStringC(chTarget));
+void ByteString::TrimRight(char chTarget) {
+ TrimRight(ByteStringView(chTarget));
}
-void CFX_ByteString::TrimRight() {
+void ByteString::TrimRight() {
TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
}
-void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
+void ByteString::TrimLeft(const ByteStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -757,24 +753,26 @@
}
}
-void CFX_ByteString::TrimLeft(char chTarget) {
- TrimLeft(CFX_ByteStringC(chTarget));
+void ByteString::TrimLeft(char chTarget) {
+ TrimLeft(ByteStringView(chTarget));
}
-void CFX_ByteString::TrimLeft() {
+void ByteString::TrimLeft() {
TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
}
-CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) {
+ByteString ByteString::FormatFloat(float d, int precision) {
char buf[32];
FX_STRSIZE len = FX_ftoa(d, buf);
- return CFX_ByteString(buf, len);
+ return ByteString(buf, len);
}
-std::ostream& operator<<(std::ostream& os, const CFX_ByteString& str) {
+std::ostream& operator<<(std::ostream& os, const ByteString& str) {
return os.write(str.c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_ByteStringC& str) {
+std::ostream& operator<<(std::ostream& os, const ByteStringView& str) {
return os.write(str.unterminated_c_str(), str.GetLength());
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
new file mode 100644
index 0000000..0220e70
--- /dev/null
+++ b/core/fxcrt/bytestring.h
@@ -0,0 +1,279 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_BYTESTRING_H_
+#define CORE_FXCRT_BYTESTRING_H_
+
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/string_view_template.h"
+#include "third_party/base/optional.h"
+
+class ByteString_Concat_Test;
+class fxcrt_ByteStringPool_Test;
+
+namespace fxcrt {
+
+class WideString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class ByteString {
+ public:
+ using CharType = char;
+ using const_iterator = const CharType*;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ ByteString();
+ ByteString(const ByteString& other);
+ ByteString(ByteString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(char ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(const char* ptr);
+
+ // No implicit conversions from wide strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(wchar_t) = delete;
+
+ ByteString(const char* ptr, FX_STRSIZE len);
+ ByteString(const uint8_t* ptr, FX_STRSIZE len);
+
+ explicit ByteString(const ByteStringView& bstrc);
+ ByteString(const ByteStringView& bstrc1, const ByteStringView& bstrc2);
+ ByteString(const std::initializer_list<ByteStringView>& list);
+ explicit ByteString(const std::ostringstream& outStream);
+
+ ~ByteString();
+
+ void clear() { m_pData.Reset(); }
+
+ static ByteString FromUnicode(const WideString& str);
+
+ // Explicit conversion to C-style string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const char* c_str() const { return m_pData ? m_pData->m_String : ""; }
+
+ // Explicit conversion to uint8_t*.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const uint8_t* raw_str() const {
+ return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
+ : nullptr;
+ }
+
+ // Explicit conversion to ByteStringView.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ ByteStringView AsStringView() const {
+ return ByteStringView(raw_str(), GetLength());
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
+ const_iterator end() const {
+ return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ FX_STRSIZE GetStringLength() const {
+ return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
+ }
+ bool IsEmpty() const { return !GetLength(); }
+ bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
+ bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+
+ int Compare(const ByteStringView& str) const;
+ bool EqualNoCase(const ByteStringView& str) const;
+
+ bool operator==(const char* ptr) const;
+ bool operator==(const ByteStringView& str) const;
+ bool operator==(const ByteString& other) const;
+
+ bool operator!=(const char* ptr) const { return !(*this == ptr); }
+ bool operator!=(const ByteStringView& str) const { return !(*this == str); }
+ bool operator!=(const ByteString& other) const { return !(*this == other); }
+
+ bool operator<(const ByteString& str) const;
+
+ const ByteString& operator=(const char* str);
+ const ByteString& operator=(const ByteStringView& bstrc);
+ const ByteString& operator=(const ByteString& stringSrc);
+
+ const ByteString& operator+=(char ch);
+ const ByteString& operator+=(const char* str);
+ const ByteString& operator+=(const ByteString& str);
+ const ByteString& operator+=(const ByteStringView& bstrc);
+
+ CharType operator[](const FX_STRSIZE index) const {
+ ASSERT(IsValidIndex(index));
+ return m_pData ? m_pData->m_String[index] : 0;
+ }
+
+ CharType First() const { return GetLength() ? (*this)[0] : 0; }
+ CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
+
+ void SetAt(FX_STRSIZE index, char c);
+
+ FX_STRSIZE Insert(FX_STRSIZE index, char ch);
+ FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
+ FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const char* lpszFormat, ...);
+ void FormatV(const char* lpszFormat, va_list argList);
+
+ void Reserve(FX_STRSIZE len);
+ char* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len);
+
+ ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ ByteString Left(FX_STRSIZE count) const;
+ ByteString Right(FX_STRSIZE count) const;
+
+ pdfium::Optional<FX_STRSIZE> Find(const ByteStringView& lpszSub,
+ FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
+
+ bool Contains(const ByteStringView& lpszSub, FX_STRSIZE start = 0) const {
+ return Find(lpszSub, start).has_value();
+ }
+
+ bool Contains(char ch, FX_STRSIZE start = 0) const {
+ return Find(ch, start).has_value();
+ }
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(char chTarget);
+ void TrimRight(const ByteStringView& lpszTargets);
+
+ void TrimLeft();
+ void TrimLeft(char chTarget);
+ void TrimLeft(const ByteStringView& lpszTargets);
+
+ FX_STRSIZE Replace(const ByteStringView& lpszOld,
+ const ByteStringView& lpszNew);
+
+ FX_STRSIZE Remove(char ch);
+
+ WideString UTF8Decode() const;
+
+ uint32_t GetID() const { return AsStringView().GetID(); }
+
+ static ByteString FormatInteger(int i);
+ static ByteString FormatFloat(float f, int precision = 0);
+
+ protected:
+ using StringData = CFX_StringDataTemplate<char>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocCopy(ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend ByteString_Concat_Test;
+ friend fxcrt_ByteStringPool_Test;
+};
+
+inline bool operator==(const char* lhs, const ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const ByteStringView& lhs, const ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const char* lhs, const ByteString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const ByteStringView& lhs, const ByteString& rhs) {
+ return rhs != lhs;
+}
+
+inline ByteString operator+(const ByteStringView& str1,
+ const ByteStringView& str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const ByteStringView& str1, const char* str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const char* str1, const ByteStringView& str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const ByteStringView& str1, char ch) {
+ return ByteString(str1, ByteStringView(ch));
+}
+inline ByteString operator+(char ch, const ByteStringView& str2) {
+ return ByteString(ch, str2);
+}
+inline ByteString operator+(const ByteString& str1, const ByteString& str2) {
+ return ByteString(str1.AsStringView(), str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1, char ch) {
+ return ByteString(str1.AsStringView(), ByteStringView(ch));
+}
+inline ByteString operator+(char ch, const ByteString& str2) {
+ return ByteString(ch, str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1, const char* str2) {
+ return ByteString(str1.AsStringView(), str2);
+}
+inline ByteString operator+(const char* str1, const ByteString& str2) {
+ return ByteString(str1, str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1,
+ const ByteStringView& str2) {
+ return ByteString(str1.AsStringView(), str2);
+}
+inline ByteString operator+(const ByteStringView& str1,
+ const ByteString& str2) {
+ return ByteString(str1, str2.AsStringView());
+}
+
+std::ostream& operator<<(std::ostream& os, const ByteString& str);
+std::ostream& operator<<(std::ostream& os, const ByteStringView& str);
+
+} // namespace fxcrt
+
+using ByteString = fxcrt::ByteString;
+
+uint32_t FX_HashCode_GetA(const ByteStringView& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<ByteString> {
+ std::size_t operator()(const ByteString& str) const {
+ return FX_HashCode_GetA(str.AsStringView(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<ByteString>;
+
+#endif // CORE_FXCRT_BYTESTRING_H_
diff --git a/core/fxcrt/cfx_bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
similarity index 77%
rename from core/fxcrt/cfx_bytestring_unittest.cpp
rename to core/fxcrt/bytestring_unittest.cpp
index 6bbe305..06ba1f4 100644
--- a/core/fxcrt/cfx_bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcrt/cfx_bytestring.h"
-#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/bytestring.h"
#include <algorithm>
#include <vector>
+#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/stl_util.h"
-TEST(fxcrt, ByteStringElementAccess) {
- const CFX_ByteString abc("abc");
+TEST(ByteString, ElementAccess) {
+ const ByteString abc("abc");
EXPECT_EQ('a', abc[0]);
EXPECT_EQ('b', abc[1]);
EXPECT_EQ('c', abc[2]);
@@ -20,7 +20,7 @@
EXPECT_DEATH({ abc[3]; }, ".*");
#endif
- CFX_ByteString mutable_abc = abc;
+ ByteString mutable_abc = abc;
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
EXPECT_EQ('a', mutable_abc[0]);
EXPECT_EQ('b', mutable_abc[1]);
@@ -48,11 +48,11 @@
#endif
}
-TEST(fxcrt, ByteStringOperatorLT) {
- CFX_ByteString empty;
- CFX_ByteString a("a");
- CFX_ByteString abc("abc");
- CFX_ByteString def("def");
+TEST(ByteString, OperatorLT) {
+ ByteString empty;
+ ByteString a("a");
+ ByteString abc("abc");
+ ByteString def("def");
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -78,16 +78,16 @@
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, ByteStringOperatorEQ) {
- CFX_ByteString null_string;
+TEST(ByteString, OperatorEQ) {
+ ByteString null_string;
EXPECT_TRUE(null_string == null_string);
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_TRUE(empty_string == empty_string);
EXPECT_TRUE(empty_string == null_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_ByteString deleted_string("hello");
+ ByteString deleted_string("hello");
deleted_string.Delete(0, 5);
EXPECT_TRUE(deleted_string == deleted_string);
EXPECT_TRUE(deleted_string == null_string);
@@ -95,7 +95,7 @@
EXPECT_TRUE(null_string == deleted_string);
EXPECT_TRUE(empty_string == deleted_string);
- CFX_ByteString byte_string("hello");
+ ByteString byte_string("hello");
EXPECT_TRUE(byte_string == byte_string);
EXPECT_FALSE(byte_string == null_string);
EXPECT_FALSE(byte_string == empty_string);
@@ -104,17 +104,17 @@
EXPECT_FALSE(empty_string == byte_string);
EXPECT_FALSE(deleted_string == byte_string);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_TRUE(byte_string == byte_string_same1);
EXPECT_TRUE(byte_string_same1 == byte_string);
- CFX_ByteString byte_string_same2(byte_string);
+ ByteString byte_string_same2(byte_string);
EXPECT_TRUE(byte_string == byte_string_same2);
EXPECT_TRUE(byte_string_same2 == byte_string);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_FALSE(byte_string == byte_string1);
EXPECT_FALSE(byte_string == byte_string2);
EXPECT_FALSE(byte_string == byte_string3);
@@ -122,8 +122,8 @@
EXPECT_FALSE(byte_string2 == byte_string);
EXPECT_FALSE(byte_string3 == byte_string);
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
+ ByteStringView null_string_c;
+ ByteStringView empty_string_c("");
EXPECT_TRUE(null_string == null_string_c);
EXPECT_TRUE(null_string == empty_string_c);
EXPECT_TRUE(empty_string == null_string_c);
@@ -137,13 +137,13 @@
EXPECT_TRUE(null_string_c == deleted_string);
EXPECT_TRUE(empty_string_c == deleted_string);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_TRUE(byte_string == byte_string_c_same1);
EXPECT_TRUE(byte_string_c_same1 == byte_string);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_FALSE(byte_string == byte_string_c1);
EXPECT_FALSE(byte_string == byte_string_c2);
EXPECT_FALSE(byte_string == byte_string_c3);
@@ -181,16 +181,16 @@
EXPECT_FALSE(c_string3 == byte_string);
}
-TEST(fxcrt, ByteStringOperatorNE) {
- CFX_ByteString null_string;
+TEST(ByteString, OperatorNE) {
+ ByteString null_string;
EXPECT_FALSE(null_string != null_string);
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string != empty_string);
EXPECT_FALSE(empty_string != null_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_ByteString deleted_string("hello");
+ ByteString deleted_string("hello");
deleted_string.Delete(0, 5);
EXPECT_FALSE(deleted_string != deleted_string);
EXPECT_FALSE(deleted_string != null_string);
@@ -200,7 +200,7 @@
EXPECT_FALSE(empty_string != deleted_string);
EXPECT_FALSE(deleted_string != deleted_string);
- CFX_ByteString byte_string("hello");
+ ByteString byte_string("hello");
EXPECT_FALSE(byte_string != byte_string);
EXPECT_TRUE(byte_string != null_string);
EXPECT_TRUE(byte_string != empty_string);
@@ -209,17 +209,17 @@
EXPECT_TRUE(empty_string != byte_string);
EXPECT_TRUE(deleted_string != byte_string);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_FALSE(byte_string != byte_string_same1);
EXPECT_FALSE(byte_string_same1 != byte_string);
- CFX_ByteString byte_string_same2(byte_string);
+ ByteString byte_string_same2(byte_string);
EXPECT_FALSE(byte_string != byte_string_same2);
EXPECT_FALSE(byte_string_same2 != byte_string);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_TRUE(byte_string != byte_string1);
EXPECT_TRUE(byte_string != byte_string2);
EXPECT_TRUE(byte_string != byte_string3);
@@ -227,8 +227,8 @@
EXPECT_TRUE(byte_string2 != byte_string);
EXPECT_TRUE(byte_string3 != byte_string);
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
+ ByteStringView null_string_c;
+ ByteStringView empty_string_c("");
EXPECT_FALSE(null_string != null_string_c);
EXPECT_FALSE(null_string != empty_string_c);
EXPECT_FALSE(empty_string != null_string_c);
@@ -238,13 +238,13 @@
EXPECT_FALSE(null_string_c != empty_string);
EXPECT_FALSE(empty_string_c != empty_string);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_FALSE(byte_string != byte_string_c_same1);
EXPECT_FALSE(byte_string_c_same1 != byte_string);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_TRUE(byte_string != byte_string_c1);
EXPECT_TRUE(byte_string != byte_string_c2);
EXPECT_TRUE(byte_string != byte_string_c3);
@@ -282,47 +282,47 @@
EXPECT_TRUE(c_string3 != byte_string);
}
-TEST(fxcrt, ByteStringCNull) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Null) {
+ ByteStringView null_string;
EXPECT_FALSE(null_string.raw_str());
EXPECT_EQ(0u, null_string.GetLength());
EXPECT_TRUE(null_string.IsEmpty());
- CFX_ByteStringC another_null_string;
+ ByteStringView another_null_string;
EXPECT_EQ(null_string, another_null_string);
- CFX_ByteStringC copied_null_string(null_string);
+ ByteStringView copied_null_string(null_string);
EXPECT_FALSE(copied_null_string.raw_str());
EXPECT_EQ(0u, copied_null_string.GetLength());
EXPECT_TRUE(copied_null_string.IsEmpty());
EXPECT_EQ(null_string, copied_null_string);
- CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer.
+ ByteStringView empty_string(""); // Pointer to NUL, not NULL pointer.
EXPECT_TRUE(empty_string.raw_str());
EXPECT_EQ(0u, empty_string.GetLength());
EXPECT_TRUE(empty_string.IsEmpty());
EXPECT_EQ(null_string, empty_string);
- CFX_ByteStringC assigned_null_string("initially not nullptr");
+ ByteStringView assigned_null_string("initially not nullptr");
assigned_null_string = null_string;
EXPECT_FALSE(assigned_null_string.raw_str());
EXPECT_EQ(0u, assigned_null_string.GetLength());
EXPECT_TRUE(assigned_null_string.IsEmpty());
EXPECT_EQ(null_string, assigned_null_string);
- CFX_ByteStringC assigned_nullptr_string("initially not nullptr");
+ ByteStringView assigned_nullptr_string("initially not nullptr");
assigned_nullptr_string = nullptr;
EXPECT_FALSE(assigned_nullptr_string.raw_str());
EXPECT_EQ(0u, assigned_nullptr_string.GetLength());
EXPECT_TRUE(assigned_nullptr_string.IsEmpty());
EXPECT_EQ(null_string, assigned_nullptr_string);
- CFX_ByteStringC non_null_string("a");
+ ByteStringView non_null_string("a");
EXPECT_NE(null_string, non_null_string);
}
-TEST(fxcrt, ByteStringConcat) {
- CFX_ByteString fred;
+TEST(ByteString, Concat) {
+ ByteString fred;
fred.Concat("FRED", 4);
EXPECT_EQ("FRED", fred);
@@ -335,14 +335,14 @@
fred.Concat("D", 1);
EXPECT_EQ("FRED", fred);
- CFX_ByteString copy = fred;
+ ByteString copy = fred;
fred.Concat("DY", 2);
EXPECT_EQ("FREDDY", fred);
EXPECT_EQ("FRED", copy);
}
-TEST(fxcrt, ByteStringRemove) {
- CFX_ByteString freed("FREED");
+TEST(ByteString, Remove) {
+ ByteString freed("FREED");
freed.Remove('E');
EXPECT_EQ("FRD", freed);
freed.Remove('F');
@@ -354,13 +354,13 @@
freed.Remove('R');
EXPECT_EQ("", freed);
- CFX_ByteString empty;
+ ByteString empty;
empty.Remove('X');
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringRemoveCopies) {
- CFX_ByteString freed("FREED");
+TEST(ByteString, RemoveCopies) {
+ ByteString freed("FREED");
const char* old_buffer = freed.c_str();
// No change with single reference - no copy.
@@ -374,7 +374,7 @@
EXPECT_EQ(old_buffer, freed.c_str());
// No change with multiple references - no copy.
- CFX_ByteString shared(freed);
+ ByteString shared(freed);
freed.Remove('Q');
EXPECT_EQ("FRD", freed);
EXPECT_EQ(old_buffer, freed.c_str());
@@ -388,8 +388,8 @@
EXPECT_EQ(old_buffer, shared.c_str());
}
-TEST(fxcrt, ByteStringReplace) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Replace) {
+ ByteString fred("FRED");
fred.Replace("FR", "BL");
EXPECT_EQ("BLED", fred);
fred.Replace("D", "DDY");
@@ -406,8 +406,8 @@
EXPECT_EQ("", fred);
}
-TEST(fxcrt, ByteStringInsert) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Insert) {
+ ByteString fred("FRED");
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ("SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -419,20 +419,20 @@
EXPECT_EQ(8u, fred.Insert(12, 'P'));
EXPECT_EQ("STFRUEDV", fred);
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ("X", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(0u, empty.Insert(5, 'X'));
EXPECT_NE("X", empty);
}
}
-TEST(fxcrt, ByteStringInsertAtFrontAndInsertAtBack) {
+TEST(ByteString, InsertAtFrontAndInsertAtBack) {
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtFront('D'));
EXPECT_EQ("D", empty);
EXPECT_EQ(2u, empty.InsertAtFront('E'));
@@ -443,7 +443,7 @@
EXPECT_EQ("FRED", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtBack('F'));
EXPECT_EQ("F", empty);
EXPECT_EQ(2u, empty.InsertAtBack('R'));
@@ -454,7 +454,7 @@
EXPECT_EQ("FRED", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtBack('E'));
EXPECT_EQ("E", empty);
EXPECT_EQ(2u, empty.InsertAtFront('R'));
@@ -466,8 +466,8 @@
}
}
-TEST(fxcrt, ByteStringDelete) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Delete) {
+ ByteString fred("FRED");
EXPECT_EQ(4u, fred.Delete(0, 0));
EXPECT_EQ("FRED", fred);
EXPECT_EQ(2u, fred.Delete(0, 2));
@@ -479,15 +479,15 @@
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ("", fred);
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ("", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringMid) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Mid) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Mid(0, 0));
EXPECT_EQ("", fred.Mid(3, 0));
EXPECT_EQ("FRED", fred.Mid(0, 4));
@@ -505,12 +505,12 @@
EXPECT_EQ("RED", fred.Mid(1, 3));
EXPECT_EQ("", fred.Mid(4, 1));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Mid(0, 0));
}
-TEST(fxcrt, ByteStringLeft) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Left) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Left(0));
EXPECT_EQ("F", fred.Left(1));
EXPECT_EQ("FR", fred.Left(2));
@@ -519,13 +519,13 @@
EXPECT_EQ("", fred.Left(5));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Left(0));
EXPECT_EQ("", empty.Left(1));
}
-TEST(fxcrt, ByteStringRight) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Right) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Right(0));
EXPECT_EQ("D", fred.Right(1));
EXPECT_EQ("ED", fred.Right(2));
@@ -534,29 +534,29 @@
EXPECT_EQ("", fred.Right(5));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Right(0));
EXPECT_EQ("", empty.Right(1));
}
-TEST(fxcrt, ByteStringFind) {
- CFX_ByteString null_string;
+TEST(ByteString, Find) {
+ ByteString null_string;
EXPECT_FALSE(null_string.Find('a').has_value());
EXPECT_FALSE(null_string.Find('\0').has_value());
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteString single_string("a");
+ ByteString single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find('b').has_value());
EXPECT_FALSE(single_string.Find('\0').has_value());
- CFX_ByteString longer_string("abccc");
+ ByteString longer_string("abccc");
result = longer_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -580,7 +580,7 @@
EXPECT_EQ(3u, result.value());
EXPECT_FALSE(longer_string.Find("d").has_value());
- CFX_ByteString hibyte_string(
+ ByteString hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.Find('\x8c');
@@ -588,24 +588,24 @@
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringReverseFind) {
- CFX_ByteString null_string;
+TEST(ByteString, ReverseFind) {
+ ByteString null_string;
EXPECT_FALSE(null_string.ReverseFind('a').has_value());
EXPECT_FALSE(null_string.ReverseFind('\0').has_value());
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string.ReverseFind('a').has_value());
EXPECT_FALSE(empty_string.ReverseFind('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteString single_string("a");
+ ByteString single_string("a");
result = single_string.ReverseFind('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.ReverseFind('b').has_value());
EXPECT_FALSE(single_string.ReverseFind('\0').has_value());
- CFX_ByteString longer_string("abccc");
+ ByteString longer_string("abccc");
result = longer_string.ReverseFind('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -614,7 +614,7 @@
EXPECT_EQ(4u, result.value());
EXPECT_FALSE(longer_string.ReverseFind('\0').has_value());
- CFX_ByteString hibyte_string(
+ ByteString hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.ReverseFind('\x8c');
@@ -622,22 +622,22 @@
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringUpperLower) {
- CFX_ByteString fred("F-Re.42D");
+TEST(ByteString, UpperLower) {
+ ByteString fred("F-Re.42D");
fred.MakeLower();
EXPECT_EQ("f-re.42d", fred);
fred.MakeUpper();
EXPECT_EQ("F-RE.42D", fred);
- CFX_ByteString empty;
+ ByteString empty;
empty.MakeLower();
EXPECT_EQ("", empty);
empty.MakeUpper();
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimRight) {
- CFX_ByteString fred(" FRED ");
+TEST(ByteString, TrimRight) {
+ ByteString fred(" FRED ");
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
fred.TrimRight('E');
@@ -647,7 +647,7 @@
fred.TrimRight("ERP");
EXPECT_EQ(" F", fred);
- CFX_ByteString blank(" ");
+ ByteString blank(" ");
blank.TrimRight("ERP");
EXPECT_EQ(" ", blank);
blank.TrimRight('E');
@@ -655,7 +655,7 @@
blank.TrimRight();
EXPECT_EQ("", blank);
- CFX_ByteString empty;
+ ByteString empty;
empty.TrimRight("ERP");
EXPECT_EQ("", empty);
empty.TrimRight('E');
@@ -664,10 +664,10 @@
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimRightCopies) {
+TEST(ByteString, TrimRightCopies) {
{
// With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
+ ByteString fred(" FRED ");
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
@@ -675,8 +675,8 @@
}
{
// With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
+ ByteString fred(" FRED ");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
@@ -685,8 +685,8 @@
}
{
// With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
+ ByteString fred("FRED");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ("FRED", fred);
@@ -695,8 +695,8 @@
}
}
-TEST(fxcrt, ByteStringTrimLeft) {
- CFX_ByteString fred(" FRED ");
+TEST(ByteString, TrimLeft) {
+ ByteString fred(" FRED ");
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
fred.TrimLeft('E');
@@ -706,7 +706,7 @@
fred.TrimLeft("ERP");
EXPECT_EQ("D ", fred);
- CFX_ByteString blank(" ");
+ ByteString blank(" ");
blank.TrimLeft("ERP");
EXPECT_EQ(" ", blank);
blank.TrimLeft('E');
@@ -714,7 +714,7 @@
blank.TrimLeft();
EXPECT_EQ("", blank);
- CFX_ByteString empty;
+ ByteString empty;
empty.TrimLeft("ERP");
EXPECT_EQ("", empty);
empty.TrimLeft('E');
@@ -723,10 +723,10 @@
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimLeftCopies) {
+TEST(ByteString, TrimLeftCopies) {
{
// With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
+ ByteString fred(" FRED ");
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
@@ -734,8 +734,8 @@
}
{
// With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
+ ByteString fred(" FRED ");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
@@ -744,8 +744,8 @@
}
{
// With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
+ ByteString fred("FRED");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED", fred);
@@ -754,9 +754,9 @@
}
}
-TEST(fxcrt, ByteStringReserve) {
+TEST(ByteString, Reserve) {
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(6);
const char* old_buffer = str.c_str();
str += "ABCDEF";
@@ -765,7 +765,7 @@
EXPECT_NE(old_buffer, str.c_str());
}
{
- CFX_ByteString str("A");
+ ByteString str("A");
str.Reserve(6);
const char* old_buffer = str.c_str();
str += "BCDEF";
@@ -775,9 +775,9 @@
}
}
-TEST(fxcrt, ByteStringGetBuffer) {
+TEST(ByteString, GetBuffer) {
{
- CFX_ByteString str;
+ ByteString str;
char* buffer = str.GetBuffer(12);
// NOLINTNEXTLINE(runtime/printf)
strcpy(buffer, "clams");
@@ -785,7 +785,7 @@
EXPECT_EQ("clams", str);
}
{
- CFX_ByteString str("cl");
+ ByteString str("cl");
char* buffer = str.GetBuffer(12);
// NOLINTNEXTLINE(runtime/printf)
strcpy(buffer + 2, "ams");
@@ -794,9 +794,9 @@
}
}
-TEST(fxcrt, ByteStringReleaseBuffer) {
+TEST(ByteString, ReleaseBuffer) {
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(12);
str += "clams";
const char* old_buffer = str.c_str();
@@ -805,7 +805,7 @@
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str("c");
+ ByteString str("c");
str.Reserve(12);
str += "lams";
const char* old_buffer = str.c_str();
@@ -814,7 +814,7 @@
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(200);
str += "clams";
const char* old_buffer = str.c_str();
@@ -823,7 +823,7 @@
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str("c");
+ ByteString str("c");
str.Reserve(200);
str += "lams";
const char* old_buffer = str.c_str();
@@ -833,16 +833,16 @@
}
}
-TEST(fxcrt, ByteStringEmptyReverseIterator) {
- CFX_ByteString empty;
+TEST(ByteString, EmptyReverseIterator) {
+ ByteString empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, ByteStringOneCharReverseIterator) {
- CFX_ByteString one_str("a");
+TEST(ByteString, OneCharReverseIterator) {
+ ByteString one_str("a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -855,8 +855,8 @@
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, ByteStringMultiCharReverseIterator) {
- CFX_ByteString multi_str("abcd");
+TEST(ByteString, MultiCharReverseIterator) {
+ ByteString multi_str("abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -900,12 +900,12 @@
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, ByteStringCNotNull) {
- CFX_ByteStringC string3("abc");
- CFX_ByteStringC string6("abcdef");
- CFX_ByteStringC alternate_string3("abcdef", 3);
- CFX_ByteStringC embedded_nul_string7("abc\0def", 7);
- CFX_ByteStringC illegal_string7("abcdef", 7);
+TEST(ByteStringView, NotNull) {
+ ByteStringView string3("abc");
+ ByteStringView string6("abcdef");
+ ByteStringView alternate_string3("abcdef", 3);
+ ByteStringView embedded_nul_string7("abc\0def", 7);
+ ByteStringView illegal_string7("abcdef", 7);
EXPECT_EQ(3u, string3.GetLength());
EXPECT_EQ(6u, string6.GetLength());
@@ -924,18 +924,18 @@
EXPECT_NE(alternate_string3, illegal_string7);
EXPECT_NE(embedded_nul_string7, illegal_string7);
- CFX_ByteStringC copied_string3(string3);
- CFX_ByteStringC copied_alternate_string3(alternate_string3);
- CFX_ByteStringC copied_embedded_nul_string7(embedded_nul_string7);
+ ByteStringView copied_string3(string3);
+ ByteStringView copied_alternate_string3(alternate_string3);
+ ByteStringView copied_embedded_nul_string7(embedded_nul_string7);
EXPECT_EQ(string3, copied_string3);
EXPECT_EQ(alternate_string3, copied_alternate_string3);
EXPECT_EQ(embedded_nul_string7, copied_embedded_nul_string7);
- CFX_ByteStringC assigned_string3("intially something else");
- CFX_ByteStringC assigned_alternate_string3("initally something else");
- CFX_ByteStringC assigned_ptr_string3("initially something else");
- CFX_ByteStringC assigned_embedded_nul_string7("initially something else");
+ ByteStringView assigned_string3("intially something else");
+ ByteStringView assigned_alternate_string3("initally something else");
+ ByteStringView assigned_ptr_string3("initially something else");
+ ByteStringView assigned_embedded_nul_string7("initially something else");
assigned_string3 = string3;
assigned_alternate_string3 = alternate_string3;
@@ -947,15 +947,15 @@
EXPECT_EQ(embedded_nul_string7, assigned_embedded_nul_string7);
}
-TEST(fxcrt, ByteStringCFromChar) {
- CFX_ByteStringC null_string;
- CFX_ByteStringC lower_a_string("a");
+TEST(ByteStringView, FromChar) {
+ ByteStringView null_string;
+ ByteStringView lower_a_string("a");
// Must have lvalues that outlive the corresponding ByteStringC.
char nul = '\0';
char lower_a = 'a';
- CFX_ByteStringC nul_string_from_char(nul);
- CFX_ByteStringC lower_a_string_from_char(lower_a);
+ ByteStringView nul_string_from_char(nul);
+ ByteStringView lower_a_string_from_char(lower_a);
// Pointer to nul, not nullptr ptr, hence length 1 ...
EXPECT_EQ(1u, nul_string_from_char.GetLength());
@@ -965,60 +965,60 @@
EXPECT_EQ(lower_a_string, lower_a_string_from_char);
EXPECT_NE(nul_string_from_char, lower_a_string_from_char);
- CFX_ByteStringC longer_string("ab");
+ ByteStringView longer_string("ab");
EXPECT_NE(longer_string, lower_a_string_from_char);
}
-TEST(fxcrt, ByteStringCFromVector) {
+TEST(ByteStringView, FromVector) {
std::vector<uint8_t> null_vec;
- CFX_ByteStringC null_string(null_vec);
+ ByteStringView null_string(null_vec);
EXPECT_EQ(0u, null_string.GetLength());
std::vector<uint8_t> lower_a_vec(10, static_cast<uint8_t>('a'));
- CFX_ByteStringC lower_a_string(lower_a_vec);
+ ByteStringView lower_a_string(lower_a_vec);
EXPECT_EQ(static_cast<FX_STRSIZE>(10), lower_a_string.GetLength());
EXPECT_EQ("aaaaaaaaaa", lower_a_string);
std::vector<uint8_t> cleared_vec;
cleared_vec.push_back(42);
cleared_vec.pop_back();
- CFX_ByteStringC cleared_string(cleared_vec);
+ ByteStringView cleared_string(cleared_vec);
EXPECT_EQ(0u, cleared_string.GetLength());
EXPECT_EQ(nullptr, cleared_string.raw_str());
}
-TEST(fxcrt, ByteStringCGetID) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, GetID) {
+ ByteStringView null_string;
EXPECT_EQ(0u, null_string.GetID());
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_EQ(0u, empty_string.GetID());
- CFX_ByteStringC short_string("ab");
+ ByteStringView short_string("ab");
EXPECT_EQ(FXBSTR_ID('a', 'b', 0, 0), short_string.GetID());
- CFX_ByteStringC longer_string("abcdef");
+ ByteStringView longer_string("abcdef");
EXPECT_EQ(FXBSTR_ID('a', 'b', 'c', 'd'), longer_string.GetID());
}
-TEST(fxcrt, ByteStringCFind) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Find) {
+ ByteStringView null_string;
EXPECT_FALSE(null_string.Find('a').has_value());
EXPECT_FALSE(null_string.Find('\0').has_value());
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteStringC single_string("a");
+ ByteStringView single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find('b').has_value());
EXPECT_FALSE(single_string.Find('\0').has_value());
- CFX_ByteStringC longer_string("abccc");
+ ByteStringView longer_string("abccc");
result = longer_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -1028,7 +1028,7 @@
EXPECT_FALSE(longer_string.Find('d').has_value());
EXPECT_FALSE(longer_string.Find('\0').has_value());
- CFX_ByteStringC hibyte_string(
+ ByteStringView hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.Find('\x8c');
@@ -1036,47 +1036,47 @@
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringCMid) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Mid) {
+ ByteStringView null_string;
EXPECT_EQ(null_string, null_string.Mid(0, 1));
EXPECT_EQ(null_string, null_string.Mid(1, 1));
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_EQ("", empty_string.Mid(0, 1));
EXPECT_EQ("", empty_string.Mid(1, 1));
- CFX_ByteStringC single_character("a");
+ ByteStringView single_character("a");
EXPECT_EQ("", single_character.Mid(0, 0));
EXPECT_EQ(single_character, single_character.Mid(0, 1));
EXPECT_EQ("", single_character.Mid(1, 0));
EXPECT_EQ("", single_character.Mid(1, 1));
- CFX_ByteStringC longer_string("abcdef");
+ ByteStringView longer_string("abcdef");
EXPECT_EQ(longer_string, longer_string.Mid(0, 6));
EXPECT_EQ("", longer_string.Mid(0, 187));
- CFX_ByteStringC leading_substring("ab");
+ ByteStringView leading_substring("ab");
EXPECT_EQ(leading_substring, longer_string.Mid(0, 2));
- CFX_ByteStringC middle_substring("bcde");
+ ByteStringView middle_substring("bcde");
EXPECT_EQ(middle_substring, longer_string.Mid(1, 4));
- CFX_ByteStringC trailing_substring("ef");
+ ByteStringView trailing_substring("ef");
EXPECT_EQ(trailing_substring, longer_string.Mid(4, 2));
EXPECT_EQ("", longer_string.Mid(4, 3));
}
-TEST(fxcrt, ByteStringCTrimmedRight) {
- CFX_ByteStringC fred("FRED");
+TEST(ByteStringView, TrimmedRight) {
+ ByteStringView fred("FRED");
EXPECT_EQ("FRED", fred.TrimmedRight('E'));
EXPECT_EQ("FRE", fred.TrimmedRight('D'));
- CFX_ByteStringC fredd("FREDD");
+ ByteStringView fredd("FREDD");
EXPECT_EQ("FRE", fred.TrimmedRight('D'));
}
-TEST(fxcrt, ByteStringCElementAccess) {
- // CFX_ByteStringC includes the NUL terminator for non-empty strings.
- CFX_ByteStringC abc("abc");
+TEST(ByteStringView, ElementAccess) {
+ // ByteStringView includes the NUL terminator for non-empty strings.
+ ByteStringView abc("abc");
EXPECT_EQ('a', static_cast<char>(abc[0]));
EXPECT_EQ('b', static_cast<char>(abc[1]));
EXPECT_EQ('c', static_cast<char>(abc[2]));
@@ -1085,11 +1085,11 @@
#endif
}
-TEST(fxcrt, ByteStringCOperatorLT) {
- CFX_ByteStringC empty;
- CFX_ByteStringC a("a");
- CFX_ByteStringC abc("abc");
- CFX_ByteStringC def("def");
+TEST(ByteStringView, OperatorLT) {
+ ByteStringView empty;
+ ByteStringView a("a");
+ ByteStringView abc("abc");
+ ByteStringView def("def");
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -1115,21 +1115,21 @@
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, ByteStringCOperatorEQ) {
- CFX_ByteStringC byte_string_c("hello");
+TEST(ByteStringView, OperatorEQ) {
+ ByteStringView byte_string_c("hello");
EXPECT_TRUE(byte_string_c == byte_string_c);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_TRUE(byte_string_c == byte_string_c_same1);
EXPECT_TRUE(byte_string_c_same1 == byte_string_c);
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ ByteStringView byte_string_c_same2(byte_string_c);
EXPECT_TRUE(byte_string_c == byte_string_c_same2);
EXPECT_TRUE(byte_string_c_same2 == byte_string_c);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_FALSE(byte_string_c == byte_string_c1);
EXPECT_FALSE(byte_string_c == byte_string_c2);
EXPECT_FALSE(byte_string_c == byte_string_c3);
@@ -1137,13 +1137,13 @@
EXPECT_FALSE(byte_string_c2 == byte_string_c);
EXPECT_FALSE(byte_string_c3 == byte_string_c);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_TRUE(byte_string_c == byte_string_same1);
EXPECT_TRUE(byte_string_same1 == byte_string_c);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_FALSE(byte_string_c == byte_string1);
EXPECT_FALSE(byte_string_c == byte_string2);
EXPECT_FALSE(byte_string_c == byte_string3);
@@ -1167,21 +1167,21 @@
EXPECT_FALSE(c_string3 == byte_string_c);
}
-TEST(fxcrt, ByteStringCOperatorNE) {
- CFX_ByteStringC byte_string_c("hello");
+TEST(ByteStringView, OperatorNE) {
+ ByteStringView byte_string_c("hello");
EXPECT_FALSE(byte_string_c != byte_string_c);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_FALSE(byte_string_c != byte_string_c_same1);
EXPECT_FALSE(byte_string_c_same1 != byte_string_c);
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ ByteStringView byte_string_c_same2(byte_string_c);
EXPECT_FALSE(byte_string_c != byte_string_c_same2);
EXPECT_FALSE(byte_string_c_same2 != byte_string_c);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_TRUE(byte_string_c != byte_string_c1);
EXPECT_TRUE(byte_string_c != byte_string_c2);
EXPECT_TRUE(byte_string_c != byte_string_c3);
@@ -1189,13 +1189,13 @@
EXPECT_TRUE(byte_string_c2 != byte_string_c);
EXPECT_TRUE(byte_string_c3 != byte_string_c);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_FALSE(byte_string_c != byte_string_same1);
EXPECT_FALSE(byte_string_same1 != byte_string_c);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_TRUE(byte_string_c != byte_string1);
EXPECT_TRUE(byte_string_c != byte_string2);
EXPECT_TRUE(byte_string_c != byte_string3);
@@ -1219,8 +1219,8 @@
EXPECT_TRUE(c_string3 != byte_string_c);
}
-TEST(fxcrt, ByteStringCNullIterator) {
- CFX_ByteStringC null_str;
+TEST(ByteStringView, NullIterator) {
+ ByteStringView null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1231,8 +1231,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringCEmptyIterator) {
- CFX_ByteStringC empty_str("");
+TEST(ByteStringView, EmptyIterator) {
+ ByteStringView empty_str("");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1243,8 +1243,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringCOneCharIterator) {
- CFX_ByteStringC one_str("a");
+TEST(ByteStringView, OneCharIterator) {
+ ByteStringView one_str("a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1255,8 +1255,8 @@
EXPECT_EQ('a', sum);
}
-TEST(fxcrt, ByteStringCMultiCharIterator) {
- CFX_ByteStringC one_str("abc");
+TEST(ByteStringView, MultiCharIterator) {
+ ByteStringView one_str("abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1267,16 +1267,16 @@
EXPECT_EQ('a' + 'b' + 'c', sum);
}
-TEST(fxcrt, ByteStringCEmptyReverseIterator) {
- CFX_ByteStringC empty;
+TEST(ByteStringView, EmptyReverseIterator) {
+ ByteStringView empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, ByteStringCOneCharReverseIterator) {
- CFX_ByteStringC one_str("a");
+TEST(ByteStringView, OneCharReverseIterator) {
+ ByteStringView one_str("a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -1289,8 +1289,8 @@
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, ByteStringCMultiCharReverseIterator) {
- CFX_ByteStringC multi_str("abcd");
+TEST(ByteStringView, MultiCharReverseIterator) {
+ ByteStringView multi_str("abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -1334,8 +1334,8 @@
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, ByteStringCAnyAllNoneOf) {
- CFX_ByteStringC str("aaaaaaaaaaaaaaaaab");
+TEST(ByteStringView, AnyAllNoneOf) {
+ ByteStringView str("aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const char& c) { return c == 'a'; }));
@@ -1350,87 +1350,87 @@
EXPECT_FALSE(pdfium::ContainsValue(str, 'z'));
}
-TEST(fxcrt, ByteStringFormatWidth) {
+TEST(ByteString, FormatWidth) {
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%5d", 1);
EXPECT_EQ(" 1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%d", 1);
EXPECT_EQ("1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%*d", 5, 1);
EXPECT_EQ(" 1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%-1d", 1);
EXPECT_EQ("1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%0d", 1);
EXPECT_EQ("1", str);
}
}
-TEST(fxcrt, ByteStringFormatPrecision) {
+TEST(ByteString, FormatPrecision) {
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%.2f", 1.12345);
EXPECT_EQ("1.12", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%.*f", 3, 1.12345);
EXPECT_EQ("1.123", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%f", 1.12345);
EXPECT_EQ("1.123450", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%-1f", 1.12345);
EXPECT_EQ("1.123450", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%0f", 1.12345);
EXPECT_EQ("1.123450", str);
}
}
-TEST(fxcrt, EmptyByteString) {
- CFX_ByteString empty_str;
+TEST(ByteString, Empty) {
+ ByteString empty_str;
EXPECT_TRUE(empty_str.IsEmpty());
EXPECT_EQ(0u, empty_str.GetLength());
const char* cstr = empty_str.c_str();
EXPECT_EQ(0u, FXSYS_strlen(cstr));
}
-TEST(fxcrt, ByteStringInitializerList) {
- CFX_ByteString many_str({"clams", " and ", "oysters"});
+TEST(ByteString, InitializerList) {
+ ByteString many_str({"clams", " and ", "oysters"});
EXPECT_EQ("clams and oysters", many_str);
many_str = {"fish", " and ", "chips", " and ", "soda"};
EXPECT_EQ("fish and chips and soda", many_str);
}
-TEST(fxcrt, ByteStringNullIterator) {
- CFX_ByteString null_str;
+TEST(ByteString, NullIterator) {
+ ByteString null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1441,8 +1441,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringEmptyIterator) {
- CFX_ByteString empty_str("");
+TEST(ByteString, EmptyIterator) {
+ ByteString empty_str("");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1453,8 +1453,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringOneCharIterator) {
- CFX_ByteString one_str("a");
+TEST(ByteString, OneCharIterator) {
+ ByteString one_str("a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1465,8 +1465,8 @@
EXPECT_EQ('a', sum);
}
-TEST(fxcrt, ByteStringMultiCharIterator) {
- CFX_ByteString one_str("abc");
+TEST(ByteString, MultiCharIterator) {
+ ByteString one_str("abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1477,8 +1477,8 @@
EXPECT_EQ('a' + 'b' + 'c', sum);
}
-TEST(fxcrt, ByteStringAnyAllNoneOf) {
- CFX_ByteString str("aaaaaaaaaaaaaaaaab");
+TEST(ByteString, AnyAllNoneOf) {
+ ByteString str("aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const char& c) { return c == 'a'; }));
@@ -1493,8 +1493,8 @@
EXPECT_FALSE(pdfium::ContainsValue(str, 'z'));
}
-TEST(fxcrt, EqualNoCase) {
- CFX_ByteString str("aaa");
+TEST(CFX_BytrString, EqualNoCase) {
+ ByteString str("aaa");
EXPECT_TRUE(str.EqualNoCase("aaa"));
EXPECT_TRUE(str.EqualNoCase("AAA"));
EXPECT_TRUE(str.EqualNoCase("aaA"));
@@ -1506,11 +1506,11 @@
EXPECT_FALSE(str.EqualNoCase(""));
}
-TEST(fxcrt, OStreamByteStringOverload) {
+TEST(ByteString, OStreamOverload) {
std::ostringstream stream;
// Basic case, empty string
- CFX_ByteString str;
+ ByteString str;
stream << str;
EXPECT_EQ("", stream.str());
@@ -1520,7 +1520,7 @@
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
- // Changing the CFX_ByteString does not change the stream it was written to.
+ // Changing the ByteString does not change the stream it was written to.
str = "123";
EXPECT_EQ("abcdefghi", stream.str());
@@ -1531,35 +1531,35 @@
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_ByteString with nulls and no specified length treats it as
+ // Writing a ByteString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_ByteString(stringWithNulls);
+ str = ByteString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_ByteString with nulls but specifying its length treats it as
+ // Writing a ByteString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_ByteString(stringWithNulls, 4);
+ str = ByteString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_ByteString str1("abc");
- CFX_ByteString str2("def");
+ ByteString str1("abc");
+ ByteString str2("def");
stream.str("");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
-TEST(fxcrt, OStreamByteStringCOverload) {
+TEST(ByteStringView, OStreamOverload) {
// Basic case, empty string
{
std::ostringstream stream;
- CFX_ByteStringC str;
+ ByteStringView str;
stream << str;
EXPECT_EQ("", stream.str());
}
@@ -1567,15 +1567,15 @@
// Basic case, non-empty string
{
std::ostringstream stream;
- CFX_ByteStringC str("def");
+ ByteStringView str("def");
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
}
- // Changing the CFX_ByteStringC does not change the stream it was written to.
+ // Changing the ByteStringView does not change the stream it was written to.
{
std::ostringstream stream;
- CFX_ByteStringC str("abc");
+ ByteStringView str("abc");
stream << str;
str = "123";
EXPECT_EQ("abc", stream.str());
@@ -1584,7 +1584,7 @@
// Writing it again to the stream will use the latest value.
{
std::ostringstream stream;
- CFX_ByteStringC str("abc");
+ ByteStringView str("abc");
stream << str;
stream.str("");
str = "123";
@@ -1592,24 +1592,24 @@
EXPECT_EQ("123", stream.str());
}
- // Writing a CFX_ByteStringC with nulls and no specified length treats it as
+ // Writing a ByteStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
std::ostringstream stream;
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- CFX_ByteStringC str(stringWithNulls);
+ ByteStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
str = "";
}
- // Writing a CFX_ByteStringC with nulls but specifying its length treats it as
+ // Writing a ByteStringView with nulls but specifying its length treats it as
// a C++-style string.
{
std::ostringstream stream;
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- CFX_ByteStringC str(stringWithNulls, 4);
+ ByteStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1619,24 +1619,24 @@
// << operators can be chained.
{
std::ostringstream stream;
- CFX_ByteStringC str1("abc");
- CFX_ByteStringC str2("def");
+ ByteStringView str1("abc");
+ ByteStringView str2("def");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
}
-TEST(fxcrt, ByteStringFormatInteger) {
+TEST(ByteString, FormatInteger) {
// Base case of 0.
- EXPECT_EQ("0", CFX_ByteString::FormatInteger(0));
+ EXPECT_EQ("0", ByteString::FormatInteger(0));
// Positive ordinary number.
- EXPECT_EQ("123456", CFX_ByteString::FormatInteger(123456));
+ EXPECT_EQ("123456", ByteString::FormatInteger(123456));
// Negative ordinary number.
- EXPECT_EQ("-123456", CFX_ByteString::FormatInteger(-123456));
+ EXPECT_EQ("-123456", ByteString::FormatInteger(-123456));
// int limits.
- EXPECT_EQ("2147483647", CFX_ByteString::FormatInteger(INT_MAX));
- EXPECT_EQ("-2147483648", CFX_ByteString::FormatInteger(INT_MIN));
+ EXPECT_EQ("2147483647", ByteString::FormatInteger(INT_MAX));
+ EXPECT_EQ("-2147483648", ByteString::FormatInteger(INT_MIN));
}
diff --git a/core/fxcrt/cfx_binarybuf.h b/core/fxcrt/cfx_binarybuf.h
index 4c795ed..186d8d1 100644
--- a/core/fxcrt/cfx_binarybuf.h
+++ b/core/fxcrt/cfx_binarybuf.h
@@ -27,7 +27,7 @@
void Clear();
void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0);
void AppendBlock(const void* pBuf, FX_STRSIZE size);
- void AppendString(const CFX_ByteString& str) {
+ void AppendString(const ByteString& str) {
AppendBlock(str.c_str(), str.GetLength());
}
diff --git a/core/fxcrt/cfx_blockbuffer.cpp b/core/fxcrt/cfx_blockbuffer.cpp
index aeef565..13134f0 100644
--- a/core/fxcrt/cfx_blockbuffer.cpp
+++ b/core/fxcrt/cfx_blockbuffer.cpp
@@ -70,19 +70,19 @@
m_DataLength -= count;
}
-CFX_WideString CFX_BlockBuffer::GetTextData(size_t start, size_t length) const {
+WideString CFX_BlockBuffer::GetTextData(size_t start, size_t length) const {
if (m_BufferSize <= m_StartPosition + 1 || length == 0)
- return CFX_WideString();
+ return WideString();
size_t maybeDataLength = m_BufferSize - 1 - m_StartPosition;
if (start > maybeDataLength)
- return CFX_WideString();
+ return WideString();
length = std::min(length, maybeDataLength);
- CFX_WideString wsTextData;
+ WideString wsTextData;
wchar_t* pBuf = wsTextData.GetBuffer(length);
if (!pBuf)
- return CFX_WideString();
+ return WideString();
size_t startBlock = 0;
size_t startInner = 0;
diff --git a/core/fxcrt/cfx_blockbuffer.h b/core/fxcrt/cfx_blockbuffer.h
index 8674490..423aa68 100644
--- a/core/fxcrt/cfx_blockbuffer.h
+++ b/core/fxcrt/cfx_blockbuffer.h
@@ -37,7 +37,7 @@
void SetTextChar(size_t iIndex, wchar_t ch);
void DeleteTextChars(size_t iCount);
- CFX_WideString GetTextData(size_t iStart, size_t iLength) const;
+ WideString GetTextData(size_t iStart, size_t iLength) const;
private:
std::pair<size_t, size_t> TextDataIndex2BufIndex(const size_t iIndex) const;
diff --git a/core/fxcrt/cfx_bytestring.h b/core/fxcrt/cfx_bytestring.h
deleted file mode 100644
index b976287..0000000
--- a/core/fxcrt/cfx_bytestring.h
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_CFX_BYTESTRING_H_
-#define CORE_FXCRT_CFX_BYTESTRING_H_
-
-#include <functional>
-#include <iterator>
-#include <sstream>
-#include <utility>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_string_c_template.h"
-#include "core/fxcrt/cfx_string_data_template.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/optional.h"
-
-class CFX_WideString;
-
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_ByteString {
- public:
- using CharType = char;
- using const_iterator = const CharType*;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- CFX_ByteString();
- CFX_ByteString(const CFX_ByteString& other);
- CFX_ByteString(CFX_ByteString&& other) noexcept;
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(char ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(const char* ptr);
-
- // No implicit conversions from wide strings.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(wchar_t) = delete;
-
- CFX_ByteString(const char* ptr, FX_STRSIZE len);
- CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
-
- explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
- CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
- CFX_ByteString(const std::initializer_list<CFX_ByteStringC>& list);
- explicit CFX_ByteString(const std::ostringstream& outStream);
-
- ~CFX_ByteString();
-
- void clear() { m_pData.Reset(); }
-
- static CFX_ByteString FromUnicode(const CFX_WideString& str);
-
- // Explicit conversion to C-style string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const char* c_str() const { return m_pData ? m_pData->m_String : ""; }
-
- // Explicit conversion to uint8_t*.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const uint8_t* raw_str() const {
- return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
- : nullptr;
- }
-
- // Explicit conversion to CFX_ByteStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_ByteStringC AsStringC() const {
- return CFX_ByteStringC(raw_str(), GetLength());
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
- const_iterator end() const {
- return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
- return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
- }
- bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
-
- int Compare(const CFX_ByteStringC& str) const;
- bool EqualNoCase(const CFX_ByteStringC& str) const;
-
- bool operator==(const char* ptr) const;
- bool operator==(const CFX_ByteStringC& str) const;
- bool operator==(const CFX_ByteString& other) const;
-
- bool operator!=(const char* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_ByteString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_ByteString& str) const;
-
- const CFX_ByteString& operator=(const char* str);
- const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc);
- const CFX_ByteString& operator=(const CFX_ByteString& stringSrc);
-
- const CFX_ByteString& operator+=(char ch);
- const CFX_ByteString& operator+=(const char* str);
- const CFX_ByteString& operator+=(const CFX_ByteString& str);
- const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc);
-
- CharType operator[](const FX_STRSIZE index) const {
- ASSERT(IsValidIndex(index));
- return m_pData ? m_pData->m_String[index] : 0;
- }
-
- CharType First() const { return GetLength() ? (*this)[0] : 0; }
- CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
-
- void SetAt(FX_STRSIZE index, char c);
-
- FX_STRSIZE Insert(FX_STRSIZE index, char ch);
- FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const char* lpszFormat, ...);
- void FormatV(const char* lpszFormat, va_list argList);
-
- void Reserve(FX_STRSIZE len);
- char* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
-
- CFX_ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_ByteString Left(FX_STRSIZE count) const;
- CFX_ByteString Right(FX_STRSIZE count) const;
-
- pdfium::Optional<FX_STRSIZE> Find(const CFX_ByteStringC& lpszSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
-
- bool Contains(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const {
- return Find(lpszSub, start).has_value();
- }
-
- bool Contains(char ch, FX_STRSIZE start = 0) const {
- return Find(ch, start).has_value();
- }
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(char chTarget);
- void TrimRight(const CFX_ByteStringC& lpszTargets);
-
- void TrimLeft();
- void TrimLeft(char chTarget);
- void TrimLeft(const CFX_ByteStringC& lpszTargets);
-
- FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld,
- const CFX_ByteStringC& lpszNew);
-
- FX_STRSIZE Remove(char ch);
-
- CFX_WideString UTF8Decode() const;
-
- uint32_t GetID() const { return AsStringC().GetID(); }
-
- static CFX_ByteString FormatInteger(int i);
- static CFX_ByteString FormatFloat(float f, int precision = 0);
-
- protected:
- using StringData = CFX_StringDataTemplate<char>;
-
- void ReallocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_ByteStringConcat_Test;
- friend class fxcrt_ByteStringPool_Test;
-};
-
-inline bool operator==(const char* lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const char* lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const char* str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const char* str1, const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1, char ch) {
- return CFX_ByteString(str1, CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(char ch, const CFX_ByteStringC& str2) {
- return CFX_ByteString(ch, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1, char ch) {
- return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(char ch, const CFX_ByteString& str2) {
- return CFX_ByteString(ch, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1, const char* str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const char* str1, const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-
-uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase);
-
-std::ostream& operator<<(std::ostream& os, const CFX_ByteString& str);
-std::ostream& operator<<(std::ostream& os, const CFX_ByteStringC& str);
-
-namespace std {
-
-template <>
-struct hash<CFX_ByteString> {
- std::size_t operator()(const CFX_ByteString& str) const {
- return FX_HashCode_GetA(str.AsStringC(), false);
- }
-};
-
-} // namespace std
-
-extern template struct std::hash<CFX_ByteString>;
-
-#endif // CORE_FXCRT_CFX_BYTESTRING_H_
diff --git a/core/fxcrt/cfx_checksumcontext.cpp b/core/fxcrt/cfx_checksumcontext.cpp
index 3114016..c75e440 100644
--- a/core/fxcrt/cfx_checksumcontext.cpp
+++ b/core/fxcrt/cfx_checksumcontext.cpp
@@ -140,11 +140,11 @@
}
}
-CFX_ByteString CFX_ChecksumContext::GetChecksum() const {
+ByteString CFX_ChecksumContext::GetChecksum() const {
return m_bsChecksum;
}
-void CFX_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
+void CFX_ChecksumContext::Update(const ByteStringView& bsText) {
if (!m_pByteContext)
return;
diff --git a/core/fxcrt/cfx_checksumcontext.h b/core/fxcrt/cfx_checksumcontext.h
index 8869c54..4231e09 100644
--- a/core/fxcrt/cfx_checksumcontext.h
+++ b/core/fxcrt/cfx_checksumcontext.h
@@ -18,17 +18,17 @@
~CFX_ChecksumContext();
void StartChecksum();
- void Update(const CFX_ByteStringC& bsText);
+ void Update(const ByteStringView& bsText);
bool UpdateChecksum(const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
FX_FILESIZE offset = 0,
size_t size = 0);
void FinishChecksum();
- CFX_ByteString GetChecksum() const;
+ ByteString GetChecksum() const;
private:
std::unique_ptr<CFX_SAXReader> m_pSAXReader;
std::unique_ptr<CRYPT_sha1_context> m_pByteContext;
- CFX_ByteString m_bsChecksum;
+ ByteString m_bsChecksum;
};
#endif // CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
diff --git a/core/fxcrt/cfx_crtfileaccess.cpp b/core/fxcrt/cfx_crtfileaccess.cpp
index ddca68e..2479c95 100644
--- a/core/fxcrt/cfx_crtfileaccess.cpp
+++ b/core/fxcrt/cfx_crtfileaccess.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/cfx_crtfileaccess.h"
-CFX_CRTFileAccess::CFX_CRTFileAccess(const CFX_WideStringC& wsPath)
+CFX_CRTFileAccess::CFX_CRTFileAccess(const WideStringView& wsPath)
: m_path(wsPath) {}
CFX_CRTFileAccess::~CFX_CRTFileAccess() {}
diff --git a/core/fxcrt/cfx_crtfileaccess.h b/core/fxcrt/cfx_crtfileaccess.h
index cb2a034..3c63aa3 100644
--- a/core/fxcrt/cfx_crtfileaccess.h
+++ b/core/fxcrt/cfx_crtfileaccess.h
@@ -19,10 +19,10 @@
CFX_RetainPtr<IFX_SeekableStream> CreateFileStream(uint32_t dwModes);
private:
- explicit CFX_CRTFileAccess(const CFX_WideStringC& wsPath);
+ explicit CFX_CRTFileAccess(const WideStringView& wsPath);
~CFX_CRTFileAccess() override;
- CFX_WideString m_path;
+ WideString m_path;
};
#endif // CORE_FXCRT_CFX_CRTFILEACCESS_H_
diff --git a/core/fxcrt/cfx_decimal.cpp b/core/fxcrt/cfx_decimal.cpp
index b900e06..45980db 100644
--- a/core/fxcrt/cfx_decimal.cpp
+++ b/core/fxcrt/cfx_decimal.cpp
@@ -294,7 +294,7 @@
m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale);
}
-CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) {
+CFX_Decimal::CFX_Decimal(const WideStringView& strObj) {
const wchar_t* str = strObj.unterminated_c_str();
const wchar_t* strBound = str + strObj.GetLength();
bool pointmet = false;
@@ -329,9 +329,9 @@
m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(negmet && IsNotZero(), scale);
}
-CFX_Decimal::operator CFX_WideString() const {
- CFX_WideString retString;
- CFX_WideString tmpbuf;
+CFX_Decimal::operator WideString() const {
+ WideString retString;
+ WideString tmpbuf;
uint64_t phi = m_uHi;
uint64_t pmid = m_uMid;
uint64_t plo = m_uLo;
diff --git a/core/fxcrt/cfx_decimal.h b/core/fxcrt/cfx_decimal.h
index 5442804..de6e3de 100644
--- a/core/fxcrt/cfx_decimal.h
+++ b/core/fxcrt/cfx_decimal.h
@@ -16,9 +16,9 @@
explicit CFX_Decimal(uint64_t val);
explicit CFX_Decimal(int32_t val);
CFX_Decimal(float val, uint8_t scale);
- explicit CFX_Decimal(const CFX_WideStringC& str);
+ explicit CFX_Decimal(const WideStringView& str);
- operator CFX_WideString() const;
+ operator WideString() const;
operator double() const;
CFX_Decimal operator*(const CFX_Decimal& val) const;
diff --git a/core/fxcrt/cfx_fileaccess_posix.cpp b/core/fxcrt/cfx_fileaccess_posix.cpp
index 345b664..d98e58d 100644
--- a/core/fxcrt/cfx_fileaccess_posix.cpp
+++ b/core/fxcrt/cfx_fileaccess_posix.cpp
@@ -51,7 +51,7 @@
Close();
}
-bool CFX_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
+bool CFX_FileAccess_Posix::Open(const ByteStringView& fileName,
uint32_t dwMode) {
if (m_nFD > -1)
return false;
@@ -65,9 +65,9 @@
return m_nFD > -1;
}
-bool CFX_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
+bool CFX_FileAccess_Posix::Open(const WideStringView& fileName,
uint32_t dwMode) {
- return Open(FX_UTF8Encode(fileName).AsStringC(), dwMode);
+ return Open(FX_UTF8Encode(fileName).AsStringView(), dwMode);
}
void CFX_FileAccess_Posix::Close() {
diff --git a/core/fxcrt/cfx_fileaccess_posix.h b/core/fxcrt/cfx_fileaccess_posix.h
index c299f6c..0b739e7 100644
--- a/core/fxcrt/cfx_fileaccess_posix.h
+++ b/core/fxcrt/cfx_fileaccess_posix.h
@@ -18,8 +18,8 @@
~CFX_FileAccess_Posix() override;
// IFX_FileAccess:
- bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ bool Open(const ByteStringView& fileName, uint32_t dwMode) override;
+ bool Open(const WideStringView& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
diff --git a/core/fxcrt/cfx_fileaccess_windows.cpp b/core/fxcrt/cfx_fileaccess_windows.cpp
index b39a4d6..105ad78 100644
--- a/core/fxcrt/cfx_fileaccess_windows.cpp
+++ b/core/fxcrt/cfx_fileaccess_windows.cpp
@@ -54,7 +54,7 @@
Close();
}
-bool CFX_FileAccess_Windows::Open(const CFX_ByteStringC& fileName,
+bool CFX_FileAccess_Windows::Open(const ByteStringView& fileName,
uint32_t dwMode) {
if (m_hFile)
return false;
@@ -69,7 +69,7 @@
return !!m_hFile;
}
-bool CFX_FileAccess_Windows::Open(const CFX_WideStringC& fileName,
+bool CFX_FileAccess_Windows::Open(const WideStringView& fileName,
uint32_t dwMode) {
if (m_hFile)
return false;
diff --git a/core/fxcrt/cfx_fileaccess_windows.h b/core/fxcrt/cfx_fileaccess_windows.h
index 692a537..f05ab39 100644
--- a/core/fxcrt/cfx_fileaccess_windows.h
+++ b/core/fxcrt/cfx_fileaccess_windows.h
@@ -16,8 +16,8 @@
~CFX_FileAccess_Windows() override;
// IFX_FileAccess
- bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ bool Open(const ByteStringView& fileName, uint32_t dwMode) override;
+ bool Open(const WideStringView& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index d3516e1..6a6c6e6 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -269,7 +269,7 @@
return iMaxLength;
}
-void CFX_SeekableStreamProxy::WriteString(const CFX_WideStringC& str) {
+void CFX_SeekableStreamProxy::WriteString(const WideStringView& str) {
if (!m_IsWriteStream || str.GetLength() == 0 ||
m_wCodePage != FX_CODEPAGE_UTF8) {
return;
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index 0e427fc..fc041b4 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -31,7 +31,7 @@
void Seek(From eSeek, FX_FILESIZE iOffset);
FX_STRSIZE ReadString(wchar_t* pStr, FX_STRSIZE iMaxLength, bool* bEOS);
- void WriteString(const CFX_WideStringC& str);
+ void WriteString(const WideStringView& str);
uint16_t GetCodePage() const { return m_wCodePage; }
void SetCodePage(uint16_t wCodePage);
diff --git a/core/fxcrt/cfx_string_pool_template.h b/core/fxcrt/cfx_string_pool_template.h
index bfc1ce4..b170a84 100644
--- a/core/fxcrt/cfx_string_pool_template.h
+++ b/core/fxcrt/cfx_string_pool_template.h
@@ -21,10 +21,10 @@
std::unordered_set<StringType> m_Pool;
};
-using CFX_ByteStringPool = CFX_StringPoolTemplate<CFX_ByteString>;
-using CFX_WideStringPool = CFX_StringPoolTemplate<CFX_WideString>;
+using ByteStringPool = CFX_StringPoolTemplate<ByteString>;
+using WideStringPool = CFX_StringPoolTemplate<WideString>;
-extern template class CFX_StringPoolTemplate<CFX_ByteString>;
-extern template class CFX_StringPoolTemplate<CFX_WideString>;
+extern template class CFX_StringPoolTemplate<ByteString>;
+extern template class CFX_StringPoolTemplate<WideString>;
#endif // CORE_FXCRT_CFX_STRING_POOL_TEMPLATE_H_
diff --git a/core/fxcrt/cfx_string_pool_template_unittest.cpp b/core/fxcrt/cfx_string_pool_template_unittest.cpp
index a4e603c..9a5ac5d 100644
--- a/core/fxcrt/cfx_string_pool_template_unittest.cpp
+++ b/core/fxcrt/cfx_string_pool_template_unittest.cpp
@@ -7,22 +7,22 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(fxcrt, ByteStringPool) {
- CFX_ByteStringPool pool;
+ ByteStringPool pool;
- CFX_ByteString null1;
- CFX_ByteString null2;
- CFX_ByteString goats1("goats");
- CFX_ByteString goats2("goats");
+ ByteString null1;
+ ByteString null2;
+ ByteString goats1("goats");
+ ByteString goats2("goats");
// Underlying storage, if non-null, is not shared.
EXPECT_EQ(nullptr, null1.m_pData.Get());
EXPECT_EQ(nullptr, null2.m_pData.Get());
EXPECT_NE(goats1.m_pData, goats2.m_pData);
- CFX_ByteString interned_null1 = pool.Intern(null1);
- CFX_ByteString interned_null2 = pool.Intern(null2);
- CFX_ByteString interned_goats1 = pool.Intern(goats1);
- CFX_ByteString interned_goats2 = pool.Intern(goats2);
+ ByteString interned_null1 = pool.Intern(null1);
+ ByteString interned_null2 = pool.Intern(null2);
+ ByteString interned_goats1 = pool.Intern(goats1);
+ ByteString interned_goats2 = pool.Intern(goats2);
// Strings are logically equal after being interned.
EXPECT_EQ(null1, interned_null1);
@@ -37,10 +37,10 @@
EXPECT_EQ(goats1.m_pData, interned_goats2.m_pData);
pool.Clear();
- CFX_ByteString reinterned_null2 = pool.Intern(null2);
- CFX_ByteString reinterned_null1 = pool.Intern(null2);
- CFX_ByteString reinterned_goats2 = pool.Intern(goats2);
- CFX_ByteString reinterned_goats1 = pool.Intern(goats2);
+ ByteString reinterned_null2 = pool.Intern(null2);
+ ByteString reinterned_null1 = pool.Intern(null2);
+ ByteString reinterned_goats2 = pool.Intern(goats2);
+ ByteString reinterned_goats1 = pool.Intern(goats2);
// After clearing pool, storage was re-interned using second strings.
EXPECT_EQ(nullptr, interned_null1.m_pData.Get());
@@ -50,22 +50,22 @@
}
TEST(fxcrt, WideStringPool) {
- CFX_WideStringPool pool;
+ WideStringPool pool;
- CFX_WideString null1;
- CFX_WideString null2;
- CFX_WideString goats1(L"goats");
- CFX_WideString goats2(L"goats");
+ WideString null1;
+ WideString null2;
+ WideString goats1(L"goats");
+ WideString goats2(L"goats");
// Underlying storage, if non-null, is not shared.
EXPECT_EQ(nullptr, null1.m_pData.Get());
EXPECT_EQ(nullptr, null2.m_pData.Get());
EXPECT_NE(goats1.m_pData, goats2.m_pData);
- CFX_WideString interned_null1 = pool.Intern(null1);
- CFX_WideString interned_null2 = pool.Intern(null2);
- CFX_WideString interned_goats1 = pool.Intern(goats1);
- CFX_WideString interned_goats2 = pool.Intern(goats2);
+ WideString interned_null1 = pool.Intern(null1);
+ WideString interned_null2 = pool.Intern(null2);
+ WideString interned_goats1 = pool.Intern(goats1);
+ WideString interned_goats2 = pool.Intern(goats2);
// Strings are logically equal after being interned.
EXPECT_EQ(null1, interned_null1);
@@ -80,10 +80,10 @@
EXPECT_EQ(goats1.m_pData, interned_goats2.m_pData);
pool.Clear();
- CFX_WideString reinterned_null2 = pool.Intern(null2);
- CFX_WideString reinterned_null1 = pool.Intern(null2);
- CFX_WideString reinterned_goats2 = pool.Intern(goats2);
- CFX_WideString reinterned_goats1 = pool.Intern(goats2);
+ WideString reinterned_null2 = pool.Intern(null2);
+ WideString reinterned_null1 = pool.Intern(null2);
+ WideString reinterned_goats2 = pool.Intern(goats2);
+ WideString reinterned_goats1 = pool.Intern(goats2);
// After clearing pool, storage was re-interned using second strings.
EXPECT_EQ(nullptr, interned_null1.m_pData.Get());
diff --git a/core/fxcrt/cfx_utf8decoder.h b/core/fxcrt/cfx_utf8decoder.h
index dcf5ef7..1cafbe4 100644
--- a/core/fxcrt/cfx_utf8decoder.h
+++ b/core/fxcrt/cfx_utf8decoder.h
@@ -17,7 +17,7 @@
void Input(uint8_t byte);
void AppendCodePoint(uint32_t ch);
void ClearStatus() { m_PendingBytes = 0; }
- CFX_WideStringC GetResult() const { return m_Buffer.AsStringC(); }
+ WideStringView GetResult() const { return m_Buffer.AsStringView(); }
private:
int m_PendingBytes;
diff --git a/core/fxcrt/cfx_widestring.h b/core/fxcrt/cfx_widestring.h
deleted file mode 100644
index 595615a..0000000
--- a/core/fxcrt/cfx_widestring.h
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_CFX_WIDESTRING_H_
-#define CORE_FXCRT_CFX_WIDESTRING_H_
-
-#include <functional>
-#include <iterator>
-#include <utility>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_string_c_template.h"
-#include "core/fxcrt/cfx_string_data_template.h"
-#include "core/fxcrt/fx_memory.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/optional.h"
-
-class CFX_ByteString;
-
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_WideString {
- public:
- using CharType = wchar_t;
- using const_iterator = const CharType*;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- CFX_WideString();
- CFX_WideString(const CFX_WideString& other);
- CFX_WideString(CFX_WideString&& other) noexcept;
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(wchar_t ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(const wchar_t* ptr);
-
- // No implicit conversions from byte strings.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(char) = delete;
-
- CFX_WideString(const wchar_t* ptr, FX_STRSIZE len);
-
- explicit CFX_WideString(const CFX_WideStringC& str);
- CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
- CFX_WideString(const std::initializer_list<CFX_WideStringC>& list);
-
- ~CFX_WideString();
-
- static CFX_WideString FromLocal(const CFX_ByteStringC& str);
- static CFX_WideString FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage);
-
- static CFX_WideString FromUTF8(const CFX_ByteStringC& str);
- static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
-
- static FX_STRSIZE WStringLength(const unsigned short* str);
-
- // Explicit conversion to C-style wide string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; }
-
- // Explicit conversion to CFX_WideStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(c_str(), GetLength());
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
- const_iterator end() const {
- return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- void clear() { m_pData.Reset(); }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
- return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
- }
- bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
-
- const CFX_WideString& operator=(const wchar_t* str);
- const CFX_WideString& operator=(const CFX_WideString& stringSrc);
- const CFX_WideString& operator=(const CFX_WideStringC& stringSrc);
-
- const CFX_WideString& operator+=(const wchar_t* str);
- const CFX_WideString& operator+=(wchar_t ch);
- const CFX_WideString& operator+=(const CFX_WideString& str);
- const CFX_WideString& operator+=(const CFX_WideStringC& str);
-
- bool operator==(const wchar_t* ptr) const;
- bool operator==(const CFX_WideStringC& str) const;
- bool operator==(const CFX_WideString& other) const;
-
- bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_WideString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_WideString& str) const;
-
- CharType operator[](const FX_STRSIZE index) const {
- ASSERT(IsValidIndex(index));
- return m_pData ? m_pData->m_String[index] : 0;
- }
-
- CharType First() const { return GetLength() ? (*this)[0] : 0; }
- CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
-
- void SetAt(FX_STRSIZE index, wchar_t c);
-
- int Compare(const wchar_t* str) const;
- int Compare(const CFX_WideString& str) const;
- int CompareNoCase(const wchar_t* str) const;
-
- CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_WideString Left(FX_STRSIZE count) const;
- CFX_WideString Right(FX_STRSIZE count) const;
-
- FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
- FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const wchar_t* lpszFormat, ...);
- void FormatV(const wchar_t* lpszFormat, va_list argList);
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(wchar_t chTarget);
- void TrimRight(const CFX_WideStringC& pTargets);
-
- void TrimLeft();
- void TrimLeft(wchar_t chTarget);
- void TrimLeft(const CFX_WideStringC& pTargets);
-
- void Reserve(FX_STRSIZE len);
- wchar_t* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
-
- int GetInteger() const;
- float GetFloat() const;
-
- pdfium::Optional<FX_STRSIZE> Find(const CFX_WideStringC& pSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
-
- bool Contains(const CFX_WideStringC& lpszSub, FX_STRSIZE start = 0) const {
- return Find(lpszSub, start).has_value();
- }
-
- bool Contains(char ch, FX_STRSIZE start = 0) const {
- return Find(ch, start).has_value();
- }
-
- FX_STRSIZE Replace(const CFX_WideStringC& pOld, const CFX_WideStringC& pNew);
- FX_STRSIZE Remove(wchar_t ch);
-
- CFX_ByteString UTF8Encode() const;
- CFX_ByteString UTF16LE_Encode() const;
-
- protected:
- using StringData = CFX_StringDataTemplate<wchar_t>;
-
- void ReallocBeforeWrite(FX_STRSIZE nLen);
- void AllocBeforeWrite(FX_STRSIZE nLen);
- void AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
-
- // Returns true unless we ran out of space.
- bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_WideStringConcatInPlace_Test;
- friend class fxcrt_WideStringPool_Test;
-};
-
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const wchar_t* str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const wchar_t* str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1, wchar_t ch) {
- return CFX_WideString(str1, CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(wchar_t ch, const CFX_WideStringC& str2) {
- return CFX_WideString(ch, str2);
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1, wchar_t ch) {
- return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(wchar_t ch, const CFX_WideString& str2) {
- return CFX_WideString(ch, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const wchar_t* str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const wchar_t* str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-
-uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase);
-
-std::wostream& operator<<(std::wostream& os, const CFX_WideString& str);
-std::ostream& operator<<(std::ostream& os, const CFX_WideString& str);
-std::wostream& operator<<(std::wostream& os, const CFX_WideStringC& str);
-std::ostream& operator<<(std::ostream& os, const CFX_WideStringC& str);
-
-namespace std {
-
-template <>
-struct hash<CFX_WideString> {
- std::size_t operator()(const CFX_WideString& str) const {
- return FX_HashCode_GetW(str.AsStringC(), false);
- }
-};
-
-} // namespace std
-
-extern template struct std::hash<CFX_WideString>;
-
-#endif // CORE_FXCRT_CFX_WIDESTRING_H_
diff --git a/core/fxcrt/cfx_widetextbuf.cpp b/core/fxcrt/cfx_widetextbuf.cpp
index 81b5fd4..d51e5ea 100644
--- a/core/fxcrt/cfx_widetextbuf.cpp
+++ b/core/fxcrt/cfx_widetextbuf.cpp
@@ -16,12 +16,12 @@
m_DataSize += sizeof(wchar_t);
}
-CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) {
+CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const WideStringView& str) {
AppendBlock(str.unterminated_c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
-CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) {
+CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const WideString& str) {
AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
diff --git a/core/fxcrt/cfx_widetextbuf.h b/core/fxcrt/cfx_widetextbuf.h
index 389f2e5..77fe414 100644
--- a/core/fxcrt/cfx_widetextbuf.h
+++ b/core/fxcrt/cfx_widetextbuf.h
@@ -19,14 +19,14 @@
return reinterpret_cast<wchar_t*>(m_pBuffer.get());
}
- CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
- m_DataSize / sizeof(wchar_t));
- }
- CFX_WideString MakeString() const {
- return CFX_WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ WideStringView AsStringView() const {
+ return WideStringView(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
m_DataSize / sizeof(wchar_t));
}
+ WideString MakeString() const {
+ return WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ m_DataSize / sizeof(wchar_t));
+ }
void Delete(int start_index, int count) {
CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t),
@@ -36,8 +36,8 @@
CFX_WideTextBuf& operator<<(int i);
CFX_WideTextBuf& operator<<(double f);
CFX_WideTextBuf& operator<<(const wchar_t* lpsz);
- CFX_WideTextBuf& operator<<(const CFX_WideStringC& str);
- CFX_WideTextBuf& operator<<(const CFX_WideString& str);
+ CFX_WideTextBuf& operator<<(const WideStringView& str);
+ CFX_WideTextBuf& operator<<(const WideString& str);
CFX_WideTextBuf& operator<<(const CFX_WideTextBuf& buf);
};
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp
index 953c107..aae88a3 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.cpp
+++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp
@@ -14,8 +14,8 @@
CFX_CSSComputedStyle::~CFX_CSSComputedStyle() {}
-bool CFX_CSSComputedStyle::GetCustomStyle(const CFX_WideString& wsName,
- CFX_WideString& wsValue) const {
+bool CFX_CSSComputedStyle::GetCustomStyle(const WideString& wsName,
+ WideString& wsValue) const {
for (auto iter = m_CustomProperties.rbegin();
iter != m_CustomProperties.rend(); iter++) {
if (wsName == iter->name()) {
@@ -32,7 +32,7 @@
: 0;
}
-const CFX_WideString CFX_CSSComputedStyle::GetFontFamily(int32_t index) const {
+const WideString CFX_CSSComputedStyle::GetFontFamily(int32_t index) const {
return m_InheritedData.m_pFontFamily->GetValue(index)
.As<CFX_CSSStringValue>()
->Value();
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index bb4b62b..b05339a 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -56,7 +56,7 @@
};
int32_t CountFontFamilies() const;
- const CFX_WideString GetFontFamily(int32_t index) const;
+ const WideString GetFontFamily(int32_t index) const;
uint16_t GetFontWeight() const;
CFX_CSSFontVariant GetFontVariant() const;
CFX_CSSFontStyle GetFontStyle() const;
@@ -91,8 +91,7 @@
void SetLetterSpacing(const CFX_CSSLength& letterSpacing);
void AddCustomStyle(const CFX_CSSCustomProperty& prop);
- bool GetCustomStyle(const CFX_WideString& wsName,
- CFX_WideString& wsValue) const;
+ bool GetCustomStyle(const WideString& wsName, WideString& wsValue) const;
InheritedData m_InheritedData;
NonInheritedData m_NonInheritedData;
diff --git a/core/fxcrt/css/cfx_csscustomproperty.cpp b/core/fxcrt/css/cfx_csscustomproperty.cpp
index 8bfb9d9..353facd 100644
--- a/core/fxcrt/css/cfx_csscustomproperty.cpp
+++ b/core/fxcrt/css/cfx_csscustomproperty.cpp
@@ -4,8 +4,8 @@
#include "core/fxcrt/css/cfx_csscustomproperty.h"
-CFX_CSSCustomProperty::CFX_CSSCustomProperty(const CFX_WideString& name,
- const CFX_WideString& value)
+CFX_CSSCustomProperty::CFX_CSSCustomProperty(const WideString& name,
+ const WideString& value)
: name_(name), value_(value) {}
CFX_CSSCustomProperty::CFX_CSSCustomProperty(const CFX_CSSCustomProperty& prop)
diff --git a/core/fxcrt/css/cfx_csscustomproperty.h b/core/fxcrt/css/cfx_csscustomproperty.h
index e062c3e..15c3eca 100644
--- a/core/fxcrt/css/cfx_csscustomproperty.h
+++ b/core/fxcrt/css/cfx_csscustomproperty.h
@@ -11,17 +11,16 @@
class CFX_CSSCustomProperty {
public:
- CFX_CSSCustomProperty(const CFX_WideString& name,
- const CFX_WideString& value);
+ CFX_CSSCustomProperty(const WideString& name, const WideString& value);
CFX_CSSCustomProperty(const CFX_CSSCustomProperty& prop);
~CFX_CSSCustomProperty();
- CFX_WideString name() const { return name_; }
- CFX_WideString value() const { return value_; }
+ WideString name() const { return name_; }
+ WideString value() const { return value_; }
private:
- CFX_WideString name_;
- CFX_WideString value_;
+ WideString name_;
+ WideString value_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSCUSTOMPROPERTY_H_
diff --git a/core/fxcrt/css/cfx_cssdatatable.cpp b/core/fxcrt/css/cfx_cssdatatable.cpp
index 833b81b..53617b6 100644
--- a/core/fxcrt/css/cfx_cssdatatable.cpp
+++ b/core/fxcrt/css/cfx_cssdatatable.cpp
@@ -122,7 +122,7 @@
"Property table differs in size from property enum");
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = g_iCSSPropertyCount;
diff --git a/core/fxcrt/css/cfx_cssdatatable.h b/core/fxcrt/css/cfx_cssdatatable.h
index 43310c7..63c3034 100644
--- a/core/fxcrt/css/cfx_cssdatatable.h
+++ b/core/fxcrt/css/cfx_cssdatatable.h
@@ -23,7 +23,7 @@
};
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByName(
- const CFX_WideStringC& wsName);
+ const WideStringView& wsName);
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByEnum(CFX_CSSProperty eName);
#endif // CORE_FXCRT_CSS_CFX_CSSDATATABLE_H_
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index 344fc84..f2c7d39 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -113,7 +113,7 @@
};
const CFX_CSSPropertyValueTable* GetCSSPropertyValueByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = g_iCSSPropertyValueCount;
@@ -134,7 +134,7 @@
}
const CFX_CSSLengthUnitTable* GetCSSLengthUnitByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint16_t wHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd =
@@ -155,7 +155,7 @@
return nullptr;
}
-const CFX_CSSColorTable* GetCSSColorByName(const CFX_WideStringC& wsName) {
+const CFX_CSSColorTable* GetCSSColorByName(const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = sizeof(g_CFX_CSSColors) / sizeof(CFX_CSSColorTable) - 1;
@@ -192,7 +192,7 @@
eUnit = CFX_CSSNumberType::Percent;
} else if (iValueLen == 2) {
const CFX_CSSLengthUnitTable* pUnit =
- GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2));
+ GetCSSLengthUnitByName(WideStringView(pszValue, 2));
if (pUnit)
eUnit = pUnit->wValue;
}
@@ -273,7 +273,7 @@
}
const CFX_CSSColorTable* pColor =
- GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSColorByName(WideStringView(pszValue, iValueLen));
if (!pColor)
return false;
@@ -308,7 +308,7 @@
}
void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
- const CFX_WideStringC& value) {
+ const WideStringView& value) {
ASSERT(!value.IsEmpty());
const wchar_t* pszValue = value.unterminated_c_str();
@@ -422,8 +422,8 @@
}
}
-void CFX_CSSDeclaration::AddProperty(const CFX_WideString& prop,
- const CFX_WideString& value) {
+void CFX_CSSDeclaration::AddProperty(const WideString& prop,
+ const WideString& value) {
custom_properties_.push_back(
pdfium::MakeUnique<CFX_CSSCustomProperty>(prop, value));
}
@@ -442,7 +442,7 @@
const wchar_t* pszValue,
int32_t iValueLen) {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
return pValue ? pdfium::MakeRetain<CFX_CSSEnumValue>(pValue->eName) : nullptr;
}
@@ -466,7 +466,7 @@
return nullptr;
return pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue + iOffset, iValueLen));
+ WideString(pszValue + iOffset, iValueLen));
}
void CFX_CSSDeclaration::ParseValueListProperty(
@@ -502,7 +502,7 @@
}
if (dwType & CFX_CSSVALUETYPE_MaybeEnum) {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (pValue) {
list.push_back(pdfium::MakeRetain<CFX_CSSEnumValue>(pValue->eName));
continue;
@@ -510,7 +510,7 @@
}
if (dwType & CFX_CSSVALUETYPE_MaybeString) {
list.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue, iValueLen)));
+ WideString(pszValue, iValueLen)));
}
break;
case CFX_CSSPrimitiveType::RGB:
@@ -614,12 +614,12 @@
}
case CFX_CSSPrimitiveType::String: {
const CFX_CSSColorTable* pColorItem =
- GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSColorByName(WideStringView(pszValue, iValueLen));
if (pColorItem)
continue;
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (!pValue)
continue;
@@ -661,7 +661,7 @@
switch (eType) {
case CFX_CSSPrimitiveType::String: {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (pValue) {
switch (pValue->eName) {
case CFX_CSSPropertyValue::XxSmall:
@@ -710,7 +710,7 @@
}
if (pFontSize) {
familyList.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue, iValueLen)));
+ WideString(pszValue, iValueLen)));
}
parser.m_Separator = ',';
break;
diff --git a/core/fxcrt/css/cfx_cssdeclaration.h b/core/fxcrt/css/cfx_cssdeclaration.h
index 7b39dae..dba1d44 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.h
+++ b/core/fxcrt/css/cfx_cssdeclaration.h
@@ -48,8 +48,8 @@
bool empty() const { return properties_.empty(); }
void AddProperty(const CFX_CSSPropertyTable* pTable,
- const CFX_WideStringC& value);
- void AddProperty(const CFX_WideString& prop, const CFX_WideString& value);
+ const WideStringView& value);
+ void AddProperty(const WideString& prop, const WideString& value);
size_t PropertyCountForTesting() const;
diff --git a/core/fxcrt/css/cfx_cssrulecollection.cpp b/core/fxcrt/css/cfx_cssrulecollection.cpp
index 635ca91..2030518 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.cpp
+++ b/core/fxcrt/css/cfx_cssrulecollection.cpp
@@ -28,7 +28,7 @@
}
const std::vector<std::unique_ptr<CFX_CSSRuleCollection::Data>>*
-CFX_CSSRuleCollection::GetTagRuleData(const CFX_WideString& tagname) const {
+CFX_CSSRuleCollection::GetTagRuleData(const WideString& tagname) const {
auto it = m_TagRules.find(FX_HashCode_GetW(tagname.c_str(), true));
return it != m_TagRules.end() ? &it->second : nullptr;
}
diff --git a/core/fxcrt/css/cfx_cssrulecollection.h b/core/fxcrt/css/cfx_cssrulecollection.h
index 6b91c6b..72ae58c 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.h
+++ b/core/fxcrt/css/cfx_cssrulecollection.h
@@ -36,7 +36,7 @@
int32_t CountSelectors() const { return m_iSelectors; }
const std::vector<std::unique_ptr<Data>>* GetTagRuleData(
- const CFX_WideString& tagname) const;
+ const WideString& tagname) const;
private:
void AddRulesFrom(const CFX_CSSStyleSheet* pStyleSheet,
diff --git a/core/fxcrt/css/cfx_cssselector.cpp b/core/fxcrt/css/cfx_cssselector.cpp
index 6ee81f5..3993dca 100644
--- a/core/fxcrt/css/cfx_cssselector.cpp
+++ b/core/fxcrt/css/cfx_cssselector.cpp
@@ -31,7 +31,7 @@
int32_t iLen,
bool bIgnoreCase)
: m_eType(eType),
- m_dwHash(FX_HashCode_GetW(CFX_WideStringC(psz, iLen), bIgnoreCase)) {}
+ m_dwHash(FX_HashCode_GetW(WideStringView(psz, iLen), bIgnoreCase)) {}
CFX_CSSSelector::~CFX_CSSSelector() {}
@@ -49,7 +49,7 @@
// static.
std::unique_ptr<CFX_CSSSelector> CFX_CSSSelector::FromString(
- const CFX_WideStringC& str) {
+ const WideStringView& str) {
ASSERT(!str.IsEmpty());
const wchar_t* psz = str.unterminated_c_str();
diff --git a/core/fxcrt/css/cfx_cssselector.h b/core/fxcrt/css/cfx_cssselector.h
index 9fff42a..62f8b16 100644
--- a/core/fxcrt/css/cfx_cssselector.h
+++ b/core/fxcrt/css/cfx_cssselector.h
@@ -15,8 +15,7 @@
class CFX_CSSSelector {
public:
- static std::unique_ptr<CFX_CSSSelector> FromString(
- const CFX_WideStringC& str);
+ static std::unique_ptr<CFX_CSSSelector> FromString(const WideStringView& str);
CFX_CSSSelector(CFX_CSSSelectorType eType,
const wchar_t* psz,
diff --git a/core/fxcrt/css/cfx_cssstringvalue.cpp b/core/fxcrt/css/cfx_cssstringvalue.cpp
index b66c545..6ff2a33 100644
--- a/core/fxcrt/css/cfx_cssstringvalue.cpp
+++ b/core/fxcrt/css/cfx_cssstringvalue.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/css/cfx_cssstringvalue.h"
-CFX_CSSStringValue::CFX_CSSStringValue(const CFX_WideString& value)
+CFX_CSSStringValue::CFX_CSSStringValue(const WideString& value)
: CFX_CSSValue(CFX_CSSPrimitiveType::String), value_(value) {}
CFX_CSSStringValue::~CFX_CSSStringValue() {}
diff --git a/core/fxcrt/css/cfx_cssstringvalue.h b/core/fxcrt/css/cfx_cssstringvalue.h
index 7680360..d72078a 100644
--- a/core/fxcrt/css/cfx_cssstringvalue.h
+++ b/core/fxcrt/css/cfx_cssstringvalue.h
@@ -11,13 +11,13 @@
class CFX_CSSStringValue : public CFX_CSSValue {
public:
- explicit CFX_CSSStringValue(const CFX_WideString& value);
+ explicit CFX_CSSStringValue(const WideString& value);
~CFX_CSSStringValue() override;
- const CFX_WideString Value() const { return value_; }
+ const WideString Value() const { return value_; }
private:
- const CFX_WideString value_;
+ const WideString value_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSTRINGVALUE_H_
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 9a2bc8c..9ae2b87 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -50,7 +50,7 @@
}
std::vector<const CFX_CSSDeclaration*> CFX_CSSStyleSelector::MatchDeclarations(
- const CFX_WideString& tagname) {
+ const WideString& tagname) {
std::vector<const CFX_CSSDeclaration*> matchedDecls;
if (m_UARules.CountSelectors() == 0 || tagname.IsEmpty())
return matchedDecls;
@@ -66,7 +66,7 @@
return matchedDecls;
}
-bool CFX_CSSStyleSelector::MatchSelector(const CFX_WideString& tagname,
+bool CFX_CSSStyleSelector::MatchSelector(const WideString& tagname,
CFX_CSSSelector* pSel) {
// TODO(dsinclair): The code only supports a single level of selector at this
// point. None of the code using selectors required the complexity so lets
@@ -80,8 +80,8 @@
void CFX_CSSStyleSelector::ComputeStyle(
const std::vector<const CFX_CSSDeclaration*>& declArray,
- const CFX_WideString& styleString,
- const CFX_WideString& alignString,
+ const WideString& styleString,
+ const WideString& alignString,
CFX_CSSComputedStyle* pDest) {
std::unique_ptr<CFX_CSSDeclaration> pDecl;
if (!styleString.IsEmpty() || !alignString.IsEmpty()) {
@@ -91,7 +91,7 @@
AppendInlineStyle(pDecl.get(), styleString);
if (!alignString.IsEmpty()) {
pDecl->AddProperty(CFX_GetCSSPropertyByEnum(CFX_CSSProperty::TextAlign),
- alignString.AsStringC());
+ alignString.AsStringView());
}
}
ApplyDeclarations(declArray, pDecl.get(), pDest);
@@ -137,29 +137,29 @@
}
void CFX_CSSStyleSelector::AppendInlineStyle(CFX_CSSDeclaration* pDecl,
- const CFX_WideString& style) {
+ const WideString& style) {
ASSERT(pDecl && !style.IsEmpty());
auto pSyntax = pdfium::MakeUnique<CFX_CSSSyntaxParser>(
style.c_str(), style.GetLength(), 32, true);
int32_t iLen2 = 0;
const CFX_CSSPropertyTable* table = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
while (1) {
CFX_CSSSyntaxStatus eStatus = pSyntax->DoSyntaxParse();
if (eStatus == CFX_CSSSyntaxStatus::PropertyName) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
table = CFX_GetCSSPropertyByName(strValue);
if (!table)
- wsName = CFX_WideString(strValue);
+ wsName = WideString(strValue);
} else if (eStatus == CFX_CSSSyntaxStatus::PropertyValue) {
if (table || iLen2 > 0) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
if (!strValue.IsEmpty()) {
if (table)
pDecl->AddProperty(table, strValue);
else if (iLen2 > 0)
- pDecl->AddProperty(wsName, CFX_WideString(strValue));
+ pDecl->AddProperty(wsName, WideString(strValue));
}
}
} else {
diff --git a/core/fxcrt/css/cfx_cssstyleselector.h b/core/fxcrt/css/cfx_cssstyleselector.h
index 143e51e..b59e304 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.h
+++ b/core/fxcrt/css/cfx_cssstyleselector.h
@@ -39,18 +39,17 @@
// adds non-inherited data from the parent style. Attempting to copy
// internally will fail as you'll lose the non-inherited data.
void ComputeStyle(const std::vector<const CFX_CSSDeclaration*>& declArray,
- const CFX_WideString& styleString,
- const CFX_WideString& alignString,
+ const WideString& styleString,
+ const WideString& alignString,
CFX_CSSComputedStyle* pDestStyle);
std::vector<const CFX_CSSDeclaration*> MatchDeclarations(
- const CFX_WideString& tagname);
+ const WideString& tagname);
private:
- bool MatchSelector(const CFX_WideString& tagname, CFX_CSSSelector* pSel);
+ bool MatchSelector(const WideString& tagname, CFX_CSSSelector* pSel);
- void AppendInlineStyle(CFX_CSSDeclaration* pDecl,
- const CFX_WideString& style);
+ void AppendInlineStyle(CFX_CSSDeclaration* pDecl, const WideString& style);
void ApplyDeclarations(
const std::vector<const CFX_CSSDeclaration*>& declArray,
const CFX_CSSDeclaration* extraDecl,
diff --git a/core/fxcrt/css/cfx_cssstylesheet.cpp b/core/fxcrt/css/cfx_cssstylesheet.cpp
index 9bd25c0..183765f 100644
--- a/core/fxcrt/css/cfx_cssstylesheet.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet.cpp
@@ -63,32 +63,32 @@
CFX_CSSStyleRule* pStyleRule = nullptr;
int32_t iValueLen = 0;
const CFX_CSSPropertyTable* propertyTable = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
while (1) {
switch (pSyntax->DoSyntaxParse()) {
case CFX_CSSSyntaxStatus::Selector: {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
auto pSelector = CFX_CSSSelector::FromString(strValue);
if (pSelector)
selectors.push_back(std::move(pSelector));
break;
}
case CFX_CSSSyntaxStatus::PropertyName: {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
propertyTable = CFX_GetCSSPropertyByName(strValue);
if (!propertyTable)
- wsName = CFX_WideString(strValue);
+ wsName = WideString(strValue);
break;
}
case CFX_CSSSyntaxStatus::PropertyValue: {
if (propertyTable || iValueLen > 0) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
auto* decl = pStyleRule->GetDeclaration();
if (!strValue.IsEmpty()) {
if (propertyTable) {
decl->AddProperty(propertyTable, strValue);
} else {
- decl->AddProperty(wsName, CFX_WideString(strValue));
+ decl->AddProperty(wsName, WideString(strValue));
}
}
}
diff --git a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
index 4194a70..abcd2f6 100644
--- a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
@@ -28,7 +28,7 @@
void TearDown() override { decl_ = nullptr; }
void LoadAndVerifyDecl(const wchar_t* buf,
- const std::vector<CFX_WideString>& selectors,
+ const std::vector<WideString>& selectors,
size_t decl_count) {
ASSERT(sheet_);
@@ -39,7 +39,7 @@
EXPECT_EQ(selectors.size(), style->CountSelectorLists());
for (size_t i = 0; i < selectors.size(); i++) {
- uint32_t hash = FX_HashCode_GetW(selectors[i].AsStringC(), true);
+ uint32_t hash = FX_HashCode_GetW(selectors[i].AsStringView(), true);
EXPECT_EQ(hash, style->GetSelectorList(i)->GetNameHash());
}
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index c8082e8..066b82b 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -223,6 +223,6 @@
return true;
}
-CFX_WideStringC CFX_CSSSyntaxParser::GetCurrentString() const {
- return CFX_WideStringC(m_TextData.GetBuffer(), m_iTextDataLen);
+WideStringView CFX_CSSSyntaxParser::GetCurrentString() const {
+ return WideStringView(m_TextData.GetBuffer(), m_iTextDataLen);
}
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.h b/core/fxcrt/css/cfx_csssyntaxparser.h
index 9ddedfe..778f9a3 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.h
+++ b/core/fxcrt/css/cfx_csssyntaxparser.h
@@ -47,7 +47,7 @@
~CFX_CSSSyntaxParser();
CFX_CSSSyntaxStatus DoSyntaxParse();
- CFX_WideStringC GetCurrentString() const;
+ WideStringView GetCurrentString() const;
protected:
void SwitchMode(CFX_CSSSyntaxMode eMode);
diff --git a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
index 510c962..62a542b 100644
--- a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
@@ -18,25 +18,25 @@
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abc", 4, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"#abc", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abc", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abcdef", 7, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"#abcdef", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abcdef", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
parser =
pdfium::MakeUnique<CFX_CSSValueListParser>(L"rgb(1, 255, 4)", 14, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"rgb(1, 255, 4)", CFX_WideString(start, len));
+ EXPECT_EQ(L"rgb(1, 255, 4)", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abcdefghij", 11, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Unknown, type);
- EXPECT_EQ(L"#abcdefghij", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abcdefghij", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
}
@@ -48,38 +48,38 @@
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"1234", 4, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"-1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"-1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"-1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"+1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"+1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"+1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L".1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L".1234", CFX_WideString(start, len));
+ EXPECT_EQ(L".1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"4321.1234", 9, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4321.1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"4321.1234", WideString(start, len));
// TODO(dsinclair): These should probably fail but currently don't.
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"4321.12.34", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4321.12.34", CFX_WideString(start, len));
+ EXPECT_EQ(L"4321.12.34", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"43a1.12.34", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"43a1.12.34", CFX_WideString(start, len));
+ EXPECT_EQ(L"43a1.12.34", WideString(start, len));
}
TEST(CFX_CSSValueListParserTest, string_parsing) {
@@ -91,18 +91,18 @@
pdfium::MakeUnique<CFX_CSSValueListParser>(L"'string'", 8, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"string", CFX_WideString(start, len));
+ EXPECT_EQ(L"string", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"\"another string\"", 16,
L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"another string", CFX_WideString(start, len));
+ EXPECT_EQ(L"another string", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"standalone", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"standalone", CFX_WideString(start, len));
+ EXPECT_EQ(L"standalone", WideString(start, len));
}
TEST(CFX_CSSValueListParserTest, multiparsing) {
@@ -113,15 +113,15 @@
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"1, 2, 3", 7, L',');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"1", CFX_WideString(start, len));
+ EXPECT_EQ(L"1", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"2", CFX_WideString(start, len));
+ EXPECT_EQ(L"2", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"3", CFX_WideString(start, len));
+ EXPECT_EQ(L"3", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
@@ -129,13 +129,13 @@
22, L',');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"str", CFX_WideString(start, len));
+ EXPECT_EQ(L"str", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"rgb(1, 2, 3)", CFX_WideString(start, len));
+ EXPECT_EQ(L"rgb(1, 2, 3)", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4", CFX_WideString(start, len));
+ EXPECT_EQ(L"4", WideString(start, len));
}
diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp
index b7c7cac..cae0942 100644
--- a/core/fxcrt/fx_bidi.cpp
+++ b/core/fxcrt/fx_bidi.cpp
@@ -581,7 +581,7 @@
m_CurrentSegment.direction = direction;
}
-CFX_BidiString::CFX_BidiString(const CFX_WideString& str)
+CFX_BidiString::CFX_BidiString(const WideString& str)
: m_Str(str),
m_pBidiChar(pdfium::MakeUnique<CFX_BidiChar>()),
m_eOverallDirection(CFX_BidiChar::LEFT) {
diff --git a/core/fxcrt/fx_bidi.h b/core/fxcrt/fx_bidi.h
index 0dc426b..23f5d02 100644
--- a/core/fxcrt/fx_bidi.h
+++ b/core/fxcrt/fx_bidi.h
@@ -54,7 +54,7 @@
public:
using const_iterator = std::vector<CFX_BidiChar::Segment>::const_iterator;
- explicit CFX_BidiString(const CFX_WideString& str);
+ explicit CFX_BidiString(const WideString& str);
~CFX_BidiString();
// Overall direction is always LEFT or RIGHT, never NEUTRAL.
@@ -70,7 +70,7 @@
const_iterator end() const { return m_Order.end(); }
private:
- const CFX_WideString m_Str;
+ const WideString m_Str;
std::unique_ptr<CFX_BidiChar> m_pBidiChar;
std::vector<CFX_BidiChar::Segment> m_Order;
CFX_BidiChar::Direction m_eOverallDirection;
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 7f73a4c..4d0adb8 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -73,7 +73,7 @@
return wch1 - wch2;
}
-uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) {
+uint32_t FX_HashCode_GetA(const ByteStringView& str, bool bIgnoreCase) {
uint32_t dwHashCode = 0;
if (bIgnoreCase) {
for (const auto& c : str)
@@ -85,7 +85,7 @@
return dwHashCode;
}
-uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase) {
+uint32_t FX_HashCode_GetW(const WideStringView& str, bool bIgnoreCase) {
uint32_t dwHashCode = 0;
if (bIgnoreCase) {
for (const auto& c : str)
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index c269ec9..a04e781 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -95,16 +95,16 @@
return WriteBlock(buffer, GetSize(), size);
}
-bool IFX_SeekableStream::WriteString(const CFX_ByteStringC& str) {
+bool IFX_SeekableStream::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
FX_FileHandle* FX_OpenFolder(const char* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
auto pData = pdfium::MakeUnique<CFindFileDataA>();
- pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(),
- FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, nullptr, 0);
+ pData->m_Handle =
+ FindFirstFileExA((ByteString(path) + "/*.*").c_str(), FindExInfoStandard,
+ &pData->m_FindData, FindExSearchNameMatch, nullptr, 0);
if (pData->m_Handle == INVALID_HANDLE_VALUE)
return nullptr;
@@ -116,7 +116,7 @@
}
bool FX_GetNextFile(FX_FileHandle* handle,
- CFX_ByteString* filename,
+ ByteString* filename,
bool* bFolder) {
if (!handle)
return false;
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index abf031d..08331e9 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -29,9 +29,7 @@
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
FX_FileHandle* FX_OpenFolder(const char* path);
-bool FX_GetNextFile(FX_FileHandle* handle,
- CFX_ByteString* filename,
- bool* bFolder);
+bool FX_GetNextFile(FX_FileHandle* handle, ByteString* filename, bool* bFolder);
void FX_CloseFolder(FX_FileHandle* handle);
#define FX_FILEMODE_Write 0
@@ -41,7 +39,7 @@
class IFX_WriteStream : virtual public CFX_Retainable {
public:
virtual bool WriteBlock(const void* pData, size_t size) = 0;
- virtual bool WriteString(const CFX_ByteStringC& str) = 0;
+ virtual bool WriteString(const ByteStringView& str) = 0;
};
class IFX_ArchiveStream : public IFX_WriteStream {
@@ -107,7 +105,7 @@
FX_FILESIZE offset,
size_t size) override = 0;
bool WriteBlock(const void* buffer, size_t size) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
bool Flush() override = 0;
};
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index 075f29e..ce4e187 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -51,8 +51,8 @@
// The data returned by GetResult() is invalidated when this is modified by
// appending any data.
- CFX_ByteStringC GetResult() const {
- return CFX_ByteStringC(m_Buffer.data(), m_Buffer.size());
+ ByteStringView GetResult() const {
+ return ByteStringView(m_Buffer.data(), m_Buffer.size());
}
private:
@@ -61,14 +61,14 @@
} // namespace
-CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) {
+ByteString FX_UTF8Encode(const WideStringView& wsStr) {
FX_STRSIZE len = wsStr.GetLength();
const wchar_t* pStr = wsStr.unterminated_c_str();
CFX_UTF8Encoder encoder;
while (len-- > 0)
encoder.Input(*pStr++);
- return CFX_ByteString(encoder.GetResult());
+ return ByteString(encoder.GetResult());
}
namespace {
@@ -84,7 +84,7 @@
} // namespace
-bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
+bool FX_atonum(const ByteStringView& strc, void* pData) {
if (strc.Contains('.')) {
float* pFloat = static_cast<float*>(pData);
*pFloat = FX_atof(strc);
@@ -141,7 +141,7 @@
return true;
}
-float FX_atof(const CFX_ByteStringC& strc) {
+float FX_atof(const ByteStringView& strc) {
if (strc.IsEmpty())
return 0.0;
@@ -180,7 +180,7 @@
return bNegative ? -value : value;
}
-float FX_atof(const CFX_WideStringC& wsStr) {
+float FX_atof(const WideStringView& wsStr) {
return FX_atof(FX_UTF8Encode(wsStr).c_str());
}
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index 9cc0b25..0481a15 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -7,17 +7,17 @@
#ifndef CORE_FXCRT_FX_STRING_H_
#define CORE_FXCRT_FX_STRING_H_
-#include "core/fxcrt/cfx_bytestring.h"
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/bytestring.h"
+#include "core/fxcrt/widestring.h"
#define FXBSTR_ID(c1, c2, c3, c4) \
(((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \
((uint32_t)c4))
-CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr);
-float FX_atof(const CFX_ByteStringC& str);
-float FX_atof(const CFX_WideStringC& wsStr);
-bool FX_atonum(const CFX_ByteStringC& str, void* pData);
+ByteString FX_UTF8Encode(const WideStringView& wsStr);
+float FX_atof(const ByteStringView& str);
+float FX_atof(const WideStringView& wsStr);
+bool FX_atonum(const ByteStringView& str, void* pData);
FX_STRSIZE FX_ftoa(float f, char* buf);
#endif // CORE_FXCRT_FX_STRING_H_
diff --git a/core/fxcrt/ifx_fileaccess.h b/core/fxcrt/ifx_fileaccess.h
index e818303..9bfe2b4 100644
--- a/core/fxcrt/ifx_fileaccess.h
+++ b/core/fxcrt/ifx_fileaccess.h
@@ -19,8 +19,8 @@
static std::unique_ptr<IFX_FileAccess> Create();
virtual ~IFX_FileAccess() {}
- virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0;
- virtual bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const ByteStringView& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const WideStringView& fileName, uint32_t dwMode) = 0;
virtual void Close() = 0;
virtual FX_FILESIZE GetSize() const = 0;
virtual FX_FILESIZE GetPosition() const = 0;
diff --git a/core/fxcrt/ifx_locale.h b/core/fxcrt/ifx_locale.h
index 5039aec..5918e7a 100644
--- a/core/fxcrt/ifx_locale.h
+++ b/core/fxcrt/ifx_locale.h
@@ -58,19 +58,19 @@
public:
virtual ~IFX_Locale() {}
- virtual CFX_WideString GetName() const = 0;
- virtual CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const = 0;
- virtual CFX_WideString GetDateTimeSymbols() const = 0;
- virtual CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const = 0;
- virtual CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const = 0;
- virtual CFX_WideString GetMeridiemName(bool bAM) const = 0;
+ virtual WideString GetName() const = 0;
+ virtual WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const = 0;
+ virtual WideString GetDateTimeSymbols() const = 0;
+ virtual WideString GetMonthName(int32_t nMonth, bool bAbbr) const = 0;
+ virtual WideString GetDayName(int32_t nWeek, bool bAbbr) const = 0;
+ virtual WideString GetMeridiemName(bool bAM) const = 0;
virtual FX_TIMEZONE GetTimeZone() const = 0;
- virtual CFX_WideString GetEraName(bool bAD) const = 0;
- virtual CFX_WideString GetDatePattern(
+ virtual WideString GetEraName(bool bAD) const = 0;
+ virtual WideString GetDatePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
- virtual CFX_WideString GetTimePattern(
+ virtual WideString GetTimePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
- virtual CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0;
+ virtual WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0;
};
#endif // CORE_FXCRT_IFX_LOCALE_H_
diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/string_view_template.h
similarity index 74%
rename from core/fxcrt/cfx_string_c_template.h
rename to core/fxcrt/string_view_template.h
index 9123fc2..21426ac 100644
--- a/core/fxcrt/cfx_string_c_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
-#define CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
+#ifndef CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
+#define CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
#include <algorithm>
#include <iterator>
@@ -18,61 +18,63 @@
#include "third_party/base/optional.h"
#include "third_party/base/stl_util.h"
+namespace fxcrt {
+
// An immutable string with caller-provided storage which must outlive the
// string itself. These are not necessarily nul-terminated, so that substring
// extraction (via the Mid(), Left(), and Right() methods) is copy-free.
template <typename T>
-class CFX_StringCTemplate {
+class StringViewTemplate {
public:
using CharType = T;
using UnsignedType = typename std::make_unsigned<CharType>::type;
using const_iterator = const CharType*;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- CFX_StringCTemplate() : m_Ptr(nullptr), m_Length(0) {}
+ StringViewTemplate() : m_Ptr(nullptr), m_Length(0) {}
// Deliberately implicit to avoid calling on every string literal.
// NOLINTNEXTLINE(runtime/explicit)
- CFX_StringCTemplate(const CharType* ptr)
+ StringViewTemplate(const CharType* ptr)
: m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)),
m_Length(ptr ? FXSYS_len(ptr) : 0) {}
- CFX_StringCTemplate(const CharType* ptr, FX_STRSIZE len)
+ StringViewTemplate(const CharType* ptr, FX_STRSIZE len)
: m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)), m_Length(len) {}
template <typename U = UnsignedType>
- CFX_StringCTemplate(
+ StringViewTemplate(
const UnsignedType* ptr,
FX_STRSIZE size,
typename std::enable_if<!std::is_same<U, CharType>::value>::type* = 0)
: m_Ptr(ptr), m_Length(size) {}
// Deliberately implicit to avoid calling on every string literal.
- // |ch| must be an lvalue that outlives the the CFX_StringCTemplate.
+ // |ch| must be an lvalue that outlives the the StringViewTemplate.
// NOLINTNEXTLINE(runtime/explicit)
- CFX_StringCTemplate(CharType& ch) {
+ StringViewTemplate(CharType& ch) {
m_Ptr = reinterpret_cast<const UnsignedType*>(&ch);
m_Length = 1;
}
- CFX_StringCTemplate(const CFX_StringCTemplate& src) {
+ StringViewTemplate(const StringViewTemplate& src) {
m_Ptr = src.m_Ptr;
m_Length = src.m_Length;
}
// Any changes to |vec| invalidate the string.
- explicit CFX_StringCTemplate(const std::vector<UnsignedType>& vec) {
+ explicit StringViewTemplate(const std::vector<UnsignedType>& vec) {
m_Length = pdfium::CollectionSize<FX_STRSIZE>(vec);
m_Ptr = m_Length ? vec.data() : nullptr;
}
- CFX_StringCTemplate& operator=(const CharType* src) {
+ StringViewTemplate& operator=(const CharType* src) {
m_Ptr = reinterpret_cast<const UnsignedType*>(src);
m_Length = src ? FXSYS_len(src) : 0;
return *this;
}
- CFX_StringCTemplate& operator=(const CFX_StringCTemplate& src) {
+ StringViewTemplate& operator=(const StringViewTemplate& src) {
m_Ptr = src.m_Ptr;
m_Length = src.m_Length;
return *this;
@@ -98,14 +100,14 @@
FXSYS_cmp(ptr, reinterpret_cast<const CharType*>(m_Ptr.Get()),
m_Length) == 0;
}
- bool operator==(const CFX_StringCTemplate& other) const {
+ bool operator==(const StringViewTemplate& other) const {
return other.m_Length == m_Length &&
FXSYS_cmp(reinterpret_cast<const CharType*>(other.m_Ptr.Get()),
reinterpret_cast<const CharType*>(m_Ptr.Get()),
m_Length) == 0;
}
bool operator!=(const CharType* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_StringCTemplate& other) const {
+ bool operator!=(const StringViewTemplate& other) const {
return !(*this == other);
}
@@ -157,56 +159,56 @@
bool Contains(CharType ch) const { return Find(ch).has_value(); }
- CFX_StringCTemplate Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+ StringViewTemplate Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_Ptr.Get())
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (!IsValidIndex(first))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (!IsValidIndex(first + count - 1))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
- return CFX_StringCTemplate(m_Ptr.Get() + first, count);
+ return StringViewTemplate(m_Ptr.Get() + first, count);
}
- CFX_StringCTemplate Left(FX_STRSIZE count) const {
+ StringViewTemplate Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
return Mid(0, count);
}
- CFX_StringCTemplate Right(FX_STRSIZE count) const {
+ StringViewTemplate Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
return Mid(GetLength() - count, count);
}
- CFX_StringCTemplate TrimmedRight(CharType ch) const {
+ StringViewTemplate TrimmedRight(CharType ch) const {
if (IsEmpty())
- return CFX_StringCTemplate();
+ return StringViewTemplate();
FX_STRSIZE pos = GetLength();
while (pos && CharAt(pos - 1) == ch)
pos--;
if (pos == 0)
- return CFX_StringCTemplate();
+ return StringViewTemplate();
- return CFX_StringCTemplate(m_Ptr.Get(), pos);
+ return StringViewTemplate(m_Ptr.Get(), pos);
}
- bool operator<(const CFX_StringCTemplate& that) const {
+ bool operator<(const StringViewTemplate& that) const {
int result = FXSYS_cmp(reinterpret_cast<const CharType*>(m_Ptr.Get()),
reinterpret_cast<const CharType*>(that.m_Ptr.Get()),
std::min(m_Length, that.m_Length));
return result < 0 || (result == 0 && m_Length < that.m_Length);
}
- bool operator>(const CFX_StringCTemplate& that) const {
+ bool operator>(const StringViewTemplate& that) const {
int result = FXSYS_cmp(reinterpret_cast<const CharType*>(m_Ptr.Get()),
reinterpret_cast<const CharType*>(that.m_Ptr.Get()),
std::min(m_Length, that.m_Length));
@@ -222,19 +224,24 @@
};
template <typename T>
-inline bool operator==(const T* lhs, const CFX_StringCTemplate<T>& rhs) {
+inline bool operator==(const T* lhs, const StringViewTemplate<T>& rhs) {
return rhs == lhs;
}
template <typename T>
-inline bool operator!=(const T* lhs, const CFX_StringCTemplate<T>& rhs) {
+inline bool operator!=(const T* lhs, const StringViewTemplate<T>& rhs) {
return rhs != lhs;
}
-extern template class CFX_StringCTemplate<char>;
-extern template class CFX_StringCTemplate<wchar_t>;
+extern template class StringViewTemplate<char>;
+extern template class StringViewTemplate<wchar_t>;
-using CFX_ByteStringC = CFX_StringCTemplate<char>;
-using CFX_WideStringC = CFX_StringCTemplate<wchar_t>;
+using ByteStringView = StringViewTemplate<char>;
+using WideStringView = StringViewTemplate<wchar_t>;
-#endif // CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
+} // namespace fxcrt
+
+using ByteStringView = fxcrt::ByteStringView;
+using WideStringView = fxcrt::WideStringView;
+
+#endif // CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
diff --git a/core/fxcrt/cfx_widestring.cpp b/core/fxcrt/widestring.cpp
similarity index 80%
rename from core/fxcrt/cfx_widestring.cpp
rename to core/fxcrt/widestring.cpp
index aadd1a2..fa5c801 100644
--- a/core/fxcrt/cfx_widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
#include <stddef.h>
@@ -21,9 +21,9 @@
#include "third_party/base/stl_util.h"
template class CFX_StringDataTemplate<wchar_t>;
-template class CFX_StringCTemplate<wchar_t>;
-template class CFX_StringPoolTemplate<CFX_WideString>;
-template struct std::hash<CFX_WideString>;
+template class fxcrt::StringViewTemplate<wchar_t>;
+template class CFX_StringPoolTemplate<WideString>;
+template struct std::hash<WideString>;
#define FORCE_ANSI 0x10000
#define FORCE_UNICODE 0x20000
@@ -261,16 +261,16 @@
}
#endif
-CFX_WideString GetWideString(uint16_t codepage, const CFX_ByteStringC& bstr) {
+WideString GetWideString(uint16_t codepage, const ByteStringView& bstr) {
ASSERT(IsValidCodePage(codepage));
int src_len = bstr.GetLength();
int dest_len = FXSYS_MultiByteToWideChar(
codepage, 0, bstr.unterminated_c_str(), src_len, nullptr, 0);
if (!dest_len)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wstr;
+ WideString wstr;
wchar_t* dest_buf = wstr.GetBuffer(dest_len);
FXSYS_MultiByteToWideChar(codepage, 0, bstr.unterminated_c_str(), src_len,
dest_buf, dest_len);
@@ -280,40 +280,40 @@
} // namespace
-static_assert(sizeof(CFX_WideString) <= sizeof(wchar_t*),
+namespace fxcrt {
+
+static_assert(sizeof(WideString) <= sizeof(wchar_t*),
"Strings must not require more space than pointers");
-CFX_WideString::CFX_WideString() {}
+WideString::WideString() {}
-CFX_WideString::CFX_WideString(const CFX_WideString& other)
- : m_pData(other.m_pData) {}
+WideString::WideString(const WideString& other) : m_pData(other.m_pData) {}
-CFX_WideString::CFX_WideString(CFX_WideString&& other) noexcept {
+WideString::WideString(WideString&& other) noexcept {
m_pData.Swap(other.m_pData);
}
-CFX_WideString::CFX_WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
+WideString::WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(StringData::Create(pStr, nLen));
}
-CFX_WideString::CFX_WideString(wchar_t ch) {
+WideString::WideString(wchar_t ch) {
m_pData.Reset(StringData::Create(1));
m_pData->m_String[0] = ch;
}
-CFX_WideString::CFX_WideString(const wchar_t* ptr)
- : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
+WideString::WideString(const wchar_t* ptr)
+ : WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
-CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) {
+WideString::WideString(const WideStringView& stringSrc) {
if (!stringSrc.IsEmpty()) {
m_pData.Reset(StringData::Create(stringSrc.unterminated_c_str(),
stringSrc.GetLength()));
}
}
-CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
+WideString::WideString(const WideStringView& str1, const WideStringView& str2) {
FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
nSafeLen += str2.GetLength();
@@ -327,8 +327,7 @@
str2.GetLength());
}
-CFX_WideString::CFX_WideString(
- const std::initializer_list<CFX_WideStringC>& list) {
+WideString::WideString(const std::initializer_list<WideStringView>& list) {
FX_SAFE_STRSIZE nSafeLen = 0;
for (const auto& item : list)
nSafeLen += item.GetLength();
@@ -347,9 +346,9 @@
}
}
-CFX_WideString::~CFX_WideString() {}
+WideString::~WideString() {}
-const CFX_WideString& CFX_WideString::operator=(const wchar_t* pStr) {
+const WideString& WideString::operator=(const wchar_t* pStr) {
if (!pStr || !pStr[0])
clear();
else
@@ -358,8 +357,7 @@
return *this;
}
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideStringC& stringSrc) {
+const WideString& WideString::operator=(const WideStringView& stringSrc) {
if (stringSrc.IsEmpty())
clear();
else
@@ -368,41 +366,40 @@
return *this;
}
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideString& stringSrc) {
+const WideString& WideString::operator=(const WideString& stringSrc) {
if (m_pData != stringSrc.m_pData)
m_pData = stringSrc.m_pData;
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const wchar_t* pStr) {
+const WideString& WideString::operator+=(const wchar_t* pStr) {
if (pStr)
Concat(pStr, FXSYS_wcslen(pStr));
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(wchar_t ch) {
+const WideString& WideString::operator+=(wchar_t ch) {
Concat(&ch, 1);
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& str) {
+const WideString& WideString::operator+=(const WideString& str) {
if (str.m_pData)
Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) {
+const WideString& WideString::operator+=(const WideStringView& str) {
if (!str.IsEmpty())
Concat(str.unterminated_c_str(), str.GetLength());
return *this;
}
-bool CFX_WideString::operator==(const wchar_t* ptr) const {
+bool WideString::operator==(const wchar_t* ptr) const {
if (!m_pData)
return !ptr || !ptr[0];
@@ -413,7 +410,7 @@
wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
-bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
+bool WideString::operator==(const WideStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -422,7 +419,7 @@
str.GetLength()) == 0;
}
-bool CFX_WideString::operator==(const CFX_WideString& other) const {
+bool WideString::operator==(const WideString& other) const {
if (m_pData == other.m_pData)
return true;
@@ -437,7 +434,7 @@
m_pData->m_nDataLength) == 0;
}
-bool CFX_WideString::operator<(const CFX_WideString& str) const {
+bool WideString::operator<(const WideString& str) const {
if (m_pData == str.m_pData)
return false;
@@ -446,13 +443,13 @@
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
-void CFX_WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
AllocBeforeWrite(nSrcLen);
m_pData->CopyContents(pSrcData, nSrcLen);
m_pData->m_nDataLength = nSrcLen;
}
-void CFX_WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -473,7 +470,7 @@
m_pData.Swap(pNewData);
}
-void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -485,7 +482,7 @@
m_pData.Reset(StringData::Create(nNewLength));
}
-void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (!m_pData)
return;
@@ -501,16 +498,16 @@
if (m_pData->m_nAllocLength - nNewLength >= 32) {
// Over arbitrary threshold, so pay the price to relocate. Force copy to
// always occur by holding a second reference to the string.
- CFX_WideString preserve(*this);
+ WideString preserve(*this);
ReallocBeforeWrite(nNewLength);
}
}
-void CFX_WideString::Reserve(FX_STRSIZE len) {
+void WideString::Reserve(FX_STRSIZE len) {
GetBuffer(len);
}
-wchar_t* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
+wchar_t* WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
if (!m_pData) {
if (nMinBufLength == 0)
return nullptr;
@@ -535,7 +532,7 @@
return m_pData->m_String;
}
-FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+FX_STRSIZE WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
if (!m_pData)
return 0;
@@ -556,7 +553,7 @@
return m_pData->m_nDataLength;
}
-void CFX_WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
if (!pSrcData || nSrcLen == 0)
return;
@@ -578,16 +575,16 @@
m_pData.Swap(pNewData);
}
-CFX_ByteString CFX_WideString::UTF8Encode() const {
- return FX_UTF8Encode(AsStringC());
+ByteString WideString::UTF8Encode() const {
+ return FX_UTF8Encode(AsStringView());
}
-CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
+ByteString WideString::UTF16LE_Encode() const {
if (!m_pData) {
- return CFX_ByteString("\0\0", 2);
+ return ByteString("\0\0", 2);
}
int len = m_pData->m_nDataLength;
- CFX_ByteString result;
+ ByteString result;
char* buffer = result.GetBuffer(len * 2 + 2);
for (int i = 0; i < len; i++) {
buffer[i * 2] = m_pData->m_String[i] & 0xff;
@@ -599,42 +596,42 @@
return result;
}
-CFX_WideString CFX_WideString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+WideString WideString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_pData)
- return CFX_WideString();
+ return WideString();
if (!IsValidIndex(first))
- return CFX_WideString();
+ return WideString();
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
if (!IsValidIndex(first + count - 1))
- return CFX_WideString();
+ return WideString();
if (first == 0 && count == GetLength())
return *this;
- CFX_WideString dest;
+ WideString dest;
AllocCopy(dest, count, first);
return dest;
}
-CFX_WideString CFX_WideString::Left(FX_STRSIZE count) const {
+WideString WideString::Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
return Mid(0, count);
}
-CFX_WideString CFX_WideString::Right(FX_STRSIZE count) const {
+WideString WideString::Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
return Mid(GetLength() - count, count);
}
-void CFX_WideString::AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
+void WideString::AllocCopy(WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
if (nCopyLen == 0)
return;
@@ -643,9 +640,9 @@
dest.m_pData.Swap(pNewData);
}
-bool CFX_WideString::TryVSWPrintf(FX_STRSIZE size,
- const wchar_t* pFormat,
- va_list argList) {
+bool WideString::TryVSWPrintf(FX_STRSIZE size,
+ const wchar_t* pFormat,
+ va_list argList) {
GetBuffer(size);
if (!m_pData)
return true;
@@ -663,7 +660,7 @@
return bSufficientBuffer;
}
-void CFX_WideString::FormatV(const wchar_t* format, va_list argList) {
+void WideString::FormatV(const wchar_t* format, va_list argList) {
va_list argListCopy;
va_copy(argListCopy, argList);
int maxLen = vswprintf(nullptr, 0, format, argListCopy);
@@ -687,14 +684,14 @@
}
}
-void CFX_WideString::Format(const wchar_t* pFormat, ...) {
+void WideString::Format(const wchar_t* pFormat, ...) {
va_list argList;
va_start(argList, pFormat);
FormatV(pFormat, argList);
va_end(argList);
}
-FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE location, wchar_t ch) {
+FX_STRSIZE WideString::Insert(FX_STRSIZE location, wchar_t ch) {
const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
if (!IsValidLength(location))
return cur_length;
@@ -708,8 +705,8 @@
return new_length;
}
-pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(wchar_t ch,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> WideString::Find(wchar_t ch,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -723,8 +720,8 @@
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(const CFX_WideStringC& subStr,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> WideString::Find(const WideStringView& subStr,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -739,7 +736,7 @@
: pdfium::Optional<FX_STRSIZE>();
}
-void CFX_WideString::MakeLower() {
+void WideString::MakeLower() {
if (!m_pData)
return;
@@ -747,7 +744,7 @@
FXSYS_wcslwr(m_pData->m_String);
}
-void CFX_WideString::MakeUpper() {
+void WideString::MakeUpper() {
if (!m_pData)
return;
@@ -755,7 +752,7 @@
FXSYS_wcsupr(m_pData->m_String);
}
-FX_STRSIZE CFX_WideString::Remove(wchar_t chRemove) {
+FX_STRSIZE WideString::Remove(wchar_t chRemove) {
if (!m_pData || m_pData->m_nDataLength < 1)
return 0;
@@ -789,8 +786,8 @@
return count;
}
-FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld,
- const CFX_WideStringC& pNew) {
+FX_STRSIZE WideString::Replace(const WideStringView& pOld,
+ const WideStringView& pNew) {
if (!m_pData || pOld.IsEmpty())
return 0;
@@ -837,36 +834,36 @@
}
// static
-CFX_WideString CFX_WideString::FromLocal(const CFX_ByteStringC& str) {
+WideString WideString::FromLocal(const ByteStringView& str) {
return FromCodePage(str, 0);
}
// static
-CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage) {
+WideString WideString::FromCodePage(const ByteStringView& str,
+ uint16_t codepage) {
return GetWideString(codepage, str);
}
// static
-CFX_WideString CFX_WideString::FromUTF8(const CFX_ByteStringC& str) {
+WideString WideString::FromUTF8(const ByteStringView& str) {
if (str.IsEmpty())
- return CFX_WideString();
+ return WideString();
CFX_UTF8Decoder decoder;
for (FX_STRSIZE i = 0; i < str.GetLength(); i++)
decoder.Input(str[i]);
- return CFX_WideString(decoder.GetResult());
+ return WideString(decoder.GetResult());
}
// static
-CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr,
- FX_STRSIZE wlen) {
+WideString WideString::FromUTF16LE(const unsigned short* wstr,
+ FX_STRSIZE wlen) {
if (!wstr || wlen == 0) {
- return CFX_WideString();
+ return WideString();
}
- CFX_WideString result;
+ WideString result;
wchar_t* buf = result.GetBuffer(wlen);
for (FX_STRSIZE i = 0; i < wlen; i++) {
buf[i] = wstr[i];
@@ -875,19 +872,19 @@
return result;
}
-void CFX_WideString::SetAt(FX_STRSIZE index, wchar_t c) {
+void WideString::SetAt(FX_STRSIZE index, wchar_t c) {
ASSERT(IsValidIndex(index));
ReallocBeforeWrite(m_pData->m_nDataLength);
m_pData->m_String[index] = c;
}
-int CFX_WideString::Compare(const wchar_t* lpsz) const {
+int WideString::Compare(const wchar_t* lpsz) const {
if (m_pData)
return wcscmp(m_pData->m_String, lpsz);
return (!lpsz || lpsz[0] == 0) ? 0 : -1;
}
-int CFX_WideString::Compare(const CFX_WideString& str) const {
+int WideString::Compare(const WideString& str) const {
if (!m_pData) {
if (!str.m_pData) {
return 0;
@@ -917,14 +914,14 @@
return 0;
}
-int CFX_WideString::CompareNoCase(const wchar_t* lpsz) const {
+int WideString::CompareNoCase(const wchar_t* lpsz) const {
if (!m_pData) {
return (!lpsz || lpsz[0] == 0) ? 0 : -1;
}
return FXSYS_wcsicmp(m_pData->m_String, lpsz);
}
-FX_STRSIZE CFX_WideString::WStringLength(const unsigned short* str) {
+FX_STRSIZE WideString::WStringLength(const unsigned short* str) {
FX_STRSIZE len = 0;
if (str)
while (str[len])
@@ -932,7 +929,7 @@
return len;
}
-void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) {
+void WideString::TrimRight(const WideStringView& pTargets) {
if (IsEmpty() || pTargets.IsEmpty())
return;
@@ -947,16 +944,16 @@
}
}
-void CFX_WideString::TrimRight(wchar_t chTarget) {
+void WideString::TrimRight(wchar_t chTarget) {
wchar_t str[2] = {chTarget, 0};
TrimRight(str);
}
-void CFX_WideString::TrimRight() {
+void WideString::TrimRight() {
TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20");
}
-void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
+void WideString::TrimLeft(const WideStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -986,12 +983,12 @@
m_pData->m_nDataLength = nDataLength;
}
-void CFX_WideString::TrimLeft(wchar_t chTarget) {
+void WideString::TrimLeft(wchar_t chTarget) {
wchar_t str[2] = {chTarget, 0};
TrimLeft(str);
}
-void CFX_WideString::TrimLeft() {
+void WideString::TrimLeft() {
TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20");
}
float FX_wtof(const wchar_t* str, int len) {
@@ -1028,28 +1025,30 @@
return bNegative ? -fraction : fraction;
}
-int CFX_WideString::GetInteger() const {
+int WideString::GetInteger() const {
return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0;
}
-float CFX_WideString::GetFloat() const {
+float WideString::GetFloat() const {
return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f;
}
-std::wostream& operator<<(std::wostream& os, const CFX_WideString& str) {
+std::wostream& operator<<(std::wostream& os, const WideString& str) {
return os.write(str.c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_WideString& str) {
+std::ostream& operator<<(std::ostream& os, const WideString& str) {
os << str.UTF8Encode();
return os;
}
-std::wostream& operator<<(std::wostream& os, const CFX_WideStringC& str) {
+std::wostream& operator<<(std::wostream& os, const WideStringView& str) {
return os.write(str.unterminated_c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_WideStringC& str) {
+std::ostream& operator<<(std::ostream& os, const WideStringView& str) {
os << FX_UTF8Encode(str);
return os;
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
new file mode 100644
index 0000000..8841c84
--- /dev/null
+++ b/core/fxcrt/widestring.h
@@ -0,0 +1,277 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_WIDESTRING_H_
+#define CORE_FXCRT_WIDESTRING_H_
+
+#include <functional>
+#include <iterator>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/string_view_template.h"
+#include "third_party/base/optional.h"
+
+class WideString_ConcatInPlace_Test;
+class fxcrt_WideStringPool_Test;
+
+namespace fxcrt {
+
+class ByteString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class WideString {
+ public:
+ using CharType = wchar_t;
+ using const_iterator = const CharType*;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ WideString();
+ WideString(const WideString& other);
+ WideString(WideString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(wchar_t ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(const wchar_t* ptr);
+
+ // No implicit conversions from byte strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(char) = delete;
+
+ WideString(const wchar_t* ptr, FX_STRSIZE len);
+
+ explicit WideString(const WideStringView& str);
+ WideString(const WideStringView& str1, const WideStringView& str2);
+ WideString(const std::initializer_list<WideStringView>& list);
+
+ ~WideString();
+
+ static WideString FromLocal(const ByteStringView& str);
+ static WideString FromCodePage(const ByteStringView& str, uint16_t codepage);
+
+ static WideString FromUTF8(const ByteStringView& str);
+ static WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
+
+ static FX_STRSIZE WStringLength(const unsigned short* str);
+
+ // Explicit conversion to C-style wide string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; }
+
+ // Explicit conversion to WideStringView.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ WideStringView AsStringView() const {
+ return WideStringView(c_str(), GetLength());
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
+ const_iterator end() const {
+ return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ void clear() { m_pData.Reset(); }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ FX_STRSIZE GetStringLength() const {
+ return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
+ }
+ bool IsEmpty() const { return !GetLength(); }
+ bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
+ bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+
+ const WideString& operator=(const wchar_t* str);
+ const WideString& operator=(const WideString& stringSrc);
+ const WideString& operator=(const WideStringView& stringSrc);
+
+ const WideString& operator+=(const wchar_t* str);
+ const WideString& operator+=(wchar_t ch);
+ const WideString& operator+=(const WideString& str);
+ const WideString& operator+=(const WideStringView& str);
+
+ bool operator==(const wchar_t* ptr) const;
+ bool operator==(const WideStringView& str) const;
+ bool operator==(const WideString& other) const;
+
+ bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
+ bool operator!=(const WideStringView& str) const { return !(*this == str); }
+ bool operator!=(const WideString& other) const { return !(*this == other); }
+
+ bool operator<(const WideString& str) const;
+
+ CharType operator[](const FX_STRSIZE index) const {
+ ASSERT(IsValidIndex(index));
+ return m_pData ? m_pData->m_String[index] : 0;
+ }
+
+ CharType First() const { return GetLength() ? (*this)[0] : 0; }
+ CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
+
+ void SetAt(FX_STRSIZE index, wchar_t c);
+
+ int Compare(const wchar_t* str) const;
+ int Compare(const WideString& str) const;
+ int CompareNoCase(const wchar_t* str) const;
+
+ WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ WideString Left(FX_STRSIZE count) const;
+ WideString Right(FX_STRSIZE count) const;
+
+ FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
+ FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
+ FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const wchar_t* lpszFormat, ...);
+ void FormatV(const wchar_t* lpszFormat, va_list argList);
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(wchar_t chTarget);
+ void TrimRight(const WideStringView& pTargets);
+
+ void TrimLeft();
+ void TrimLeft(wchar_t chTarget);
+ void TrimLeft(const WideStringView& pTargets);
+
+ void Reserve(FX_STRSIZE len);
+ wchar_t* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len);
+
+ int GetInteger() const;
+ float GetFloat() const;
+
+ pdfium::Optional<FX_STRSIZE> Find(const WideStringView& pSub,
+ FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
+
+ bool Contains(const WideStringView& lpszSub, FX_STRSIZE start = 0) const {
+ return Find(lpszSub, start).has_value();
+ }
+
+ bool Contains(char ch, FX_STRSIZE start = 0) const {
+ return Find(ch, start).has_value();
+ }
+
+ FX_STRSIZE Replace(const WideStringView& pOld, const WideStringView& pNew);
+ FX_STRSIZE Remove(wchar_t ch);
+
+ ByteString UTF8Encode() const;
+ ByteString UTF16LE_Encode() const;
+
+ protected:
+ using StringData = CFX_StringDataTemplate<wchar_t>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nLen);
+ void AllocBeforeWrite(FX_STRSIZE nLen);
+ void AllocCopy(WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ // Returns true unless we ran out of space.
+ bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend WideString_ConcatInPlace_Test;
+ friend fxcrt_WideStringPool_Test;
+};
+
+inline WideString operator+(const WideStringView& str1,
+ const WideStringView& str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const WideStringView& str1, const wchar_t* str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const wchar_t* str1, const WideStringView& str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const WideStringView& str1, wchar_t ch) {
+ return WideString(str1, WideStringView(ch));
+}
+inline WideString operator+(wchar_t ch, const WideStringView& str2) {
+ return WideString(ch, str2);
+}
+inline WideString operator+(const WideString& str1, const WideString& str2) {
+ return WideString(str1.AsStringView(), str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1, wchar_t ch) {
+ return WideString(str1.AsStringView(), WideStringView(ch));
+}
+inline WideString operator+(wchar_t ch, const WideString& str2) {
+ return WideString(ch, str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1, const wchar_t* str2) {
+ return WideString(str1.AsStringView(), str2);
+}
+inline WideString operator+(const wchar_t* str1, const WideString& str2) {
+ return WideString(str1, str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1,
+ const WideStringView& str2) {
+ return WideString(str1.AsStringView(), str2);
+}
+inline WideString operator+(const WideStringView& str1,
+ const WideString& str2) {
+ return WideString(str1, str2.AsStringView());
+}
+inline bool operator==(const wchar_t* lhs, const WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const WideStringView& lhs, const WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const wchar_t* lhs, const WideString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const WideStringView& lhs, const WideString& rhs) {
+ return rhs != lhs;
+}
+
+std::wostream& operator<<(std::wostream& os, const WideString& str);
+std::ostream& operator<<(std::ostream& os, const WideString& str);
+std::wostream& operator<<(std::wostream& os, const WideStringView& str);
+std::ostream& operator<<(std::ostream& os, const WideStringView& str);
+
+} // namespace fxcrt
+
+using WideString = fxcrt::WideString;
+
+uint32_t FX_HashCode_GetW(const WideStringView& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<WideString> {
+ std::size_t operator()(const WideString& str) const {
+ return FX_HashCode_GetW(str.AsStringView(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<WideString>;
+
+#endif // CORE_FXCRT_WIDESTRING_H_
diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
similarity index 77%
rename from core/fxcrt/cfx_widestring_unittest.cpp
rename to core/fxcrt/widestring_unittest.cpp
index 6f3bc08..949827f 100644
--- a/core/fxcrt/cfx_widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcrt/cfx_widestring.h"
-#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/widestring.h"
#include <algorithm>
#include <vector>
+#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(fxcrt, WideStringElementAccess) {
- const CFX_WideString abc(L"abc");
+TEST(WideString, ElementAccess) {
+ const WideString abc(L"abc");
EXPECT_EQ(L'a', abc[0]);
EXPECT_EQ(L'b', abc[1]);
EXPECT_EQ(L'c', abc[2]);
@@ -19,7 +19,7 @@
EXPECT_DEATH({ abc[4]; }, ".*");
#endif
- CFX_WideString mutable_abc = abc;
+ WideString mutable_abc = abc;
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
EXPECT_EQ(L'a', mutable_abc[0]);
EXPECT_EQ(L'b', mutable_abc[1]);
@@ -47,11 +47,11 @@
#endif
}
-TEST(fxcrt, WideStringOperatorLT) {
- CFX_WideString empty;
- CFX_WideString a(L"a");
- CFX_WideString abc(L"\x0110qq"); // Comes before despite endianness.
- CFX_WideString def(L"\x1001qq"); // Comes after despite endianness.
+TEST(WideString, OperatorLT) {
+ WideString empty;
+ WideString a(L"a");
+ WideString abc(L"\x0110qq"); // Comes before despite endianness.
+ WideString def(L"\x1001qq"); // Comes after despite endianness.
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -77,16 +77,16 @@
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, WideStringOperatorEQ) {
- CFX_WideString null_string;
+TEST(WideString, OperatorEQ) {
+ WideString null_string;
EXPECT_TRUE(null_string == null_string);
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_TRUE(empty_string == empty_string);
EXPECT_TRUE(empty_string == null_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_WideString deleted_string(L"hello");
+ WideString deleted_string(L"hello");
deleted_string.Delete(0, 5);
EXPECT_TRUE(deleted_string == deleted_string);
EXPECT_TRUE(deleted_string == null_string);
@@ -94,7 +94,7 @@
EXPECT_TRUE(null_string == deleted_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_WideString wide_string(L"hello");
+ WideString wide_string(L"hello");
EXPECT_TRUE(wide_string == wide_string);
EXPECT_FALSE(wide_string == null_string);
EXPECT_FALSE(wide_string == empty_string);
@@ -103,17 +103,17 @@
EXPECT_FALSE(empty_string == wide_string);
EXPECT_FALSE(deleted_string == wide_string);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_TRUE(wide_string == wide_string_same1);
EXPECT_TRUE(wide_string_same1 == wide_string);
- CFX_WideString wide_string_same2(wide_string);
+ WideString wide_string_same2(wide_string);
EXPECT_TRUE(wide_string == wide_string_same2);
EXPECT_TRUE(wide_string_same2 == wide_string);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_FALSE(wide_string == wide_string1);
EXPECT_FALSE(wide_string == wide_string2);
EXPECT_FALSE(wide_string == wide_string3);
@@ -121,8 +121,8 @@
EXPECT_FALSE(wide_string2 == wide_string);
EXPECT_FALSE(wide_string3 == wide_string);
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
+ WideStringView null_string_c;
+ WideStringView empty_string_c(L"");
EXPECT_TRUE(null_string == null_string_c);
EXPECT_TRUE(null_string == empty_string_c);
EXPECT_TRUE(empty_string == null_string_c);
@@ -136,13 +136,13 @@
EXPECT_TRUE(null_string_c == deleted_string);
EXPECT_TRUE(empty_string_c == deleted_string);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_TRUE(wide_string == wide_string_c_same1);
EXPECT_TRUE(wide_string_c_same1 == wide_string);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_FALSE(wide_string == wide_string_c1);
EXPECT_FALSE(wide_string == wide_string_c2);
EXPECT_FALSE(wide_string == wide_string_c3);
@@ -180,16 +180,16 @@
EXPECT_FALSE(c_string3 == wide_string);
}
-TEST(fxcrt, WideStringOperatorNE) {
- CFX_WideString null_string;
+TEST(WideString, OperatorNE) {
+ WideString null_string;
EXPECT_FALSE(null_string != null_string);
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_FALSE(empty_string != empty_string);
EXPECT_FALSE(empty_string != null_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_WideString deleted_string(L"hello");
+ WideString deleted_string(L"hello");
deleted_string.Delete(0, 5);
EXPECT_FALSE(deleted_string != deleted_string);
EXPECT_FALSE(deleted_string != null_string);
@@ -197,7 +197,7 @@
EXPECT_FALSE(null_string != deleted_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_WideString wide_string(L"hello");
+ WideString wide_string(L"hello");
EXPECT_FALSE(wide_string != wide_string);
EXPECT_TRUE(wide_string != null_string);
EXPECT_TRUE(wide_string != empty_string);
@@ -206,17 +206,17 @@
EXPECT_TRUE(empty_string != wide_string);
EXPECT_TRUE(deleted_string != wide_string);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_FALSE(wide_string != wide_string_same1);
EXPECT_FALSE(wide_string_same1 != wide_string);
- CFX_WideString wide_string_same2(wide_string);
+ WideString wide_string_same2(wide_string);
EXPECT_FALSE(wide_string != wide_string_same2);
EXPECT_FALSE(wide_string_same2 != wide_string);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_TRUE(wide_string != wide_string1);
EXPECT_TRUE(wide_string != wide_string2);
EXPECT_TRUE(wide_string != wide_string3);
@@ -224,8 +224,8 @@
EXPECT_TRUE(wide_string2 != wide_string);
EXPECT_TRUE(wide_string3 != wide_string);
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
+ WideStringView null_string_c;
+ WideStringView empty_string_c(L"");
EXPECT_FALSE(null_string != null_string_c);
EXPECT_FALSE(null_string != empty_string_c);
EXPECT_FALSE(empty_string != null_string_c);
@@ -237,13 +237,13 @@
EXPECT_FALSE(null_string_c != empty_string);
EXPECT_FALSE(empty_string_c != empty_string);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_FALSE(wide_string != wide_string_c_same1);
EXPECT_FALSE(wide_string_c_same1 != wide_string);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_TRUE(wide_string != wide_string_c1);
EXPECT_TRUE(wide_string != wide_string_c2);
EXPECT_TRUE(wide_string != wide_string_c3);
@@ -281,8 +281,8 @@
EXPECT_TRUE(c_string3 != wide_string);
}
-TEST(fxcrt, WideStringConcatInPlace) {
- CFX_WideString fred;
+TEST(WideString, ConcatInPlace) {
+ WideString fred;
fred.Concat(L"FRED", 4);
EXPECT_EQ(L"FRED", fred);
@@ -295,14 +295,14 @@
fred.Concat(L"D", 1);
EXPECT_EQ(L"FRED", fred);
- CFX_WideString copy = fred;
+ WideString copy = fred;
fred.Concat(L"DY", 2);
EXPECT_EQ(L"FREDDY", fred);
EXPECT_EQ(L"FRED", copy);
}
-TEST(fxcrt, WideStringRemove) {
- CFX_WideString freed(L"FREED");
+TEST(WideString, Remove) {
+ WideString freed(L"FREED");
freed.Remove(L'E');
EXPECT_EQ(L"FRD", freed);
freed.Remove(L'F');
@@ -314,13 +314,13 @@
freed.Remove(L'R');
EXPECT_EQ(L"", freed);
- CFX_WideString empty;
+ WideString empty;
empty.Remove(L'X');
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringRemoveCopies) {
- CFX_WideString freed(L"FREED");
+TEST(WideString, RemoveCopies) {
+ WideString freed(L"FREED");
const wchar_t* old_buffer = freed.c_str();
// No change with single reference - no copy.
@@ -334,7 +334,7 @@
EXPECT_EQ(old_buffer, freed.c_str());
// No change with multiple references - no copy.
- CFX_WideString shared(freed);
+ WideString shared(freed);
freed.Remove(L'Q');
EXPECT_EQ(L"FRD", freed);
EXPECT_EQ(old_buffer, freed.c_str());
@@ -348,8 +348,8 @@
EXPECT_EQ(old_buffer, shared.c_str());
}
-TEST(fxcrt, WideStringReplace) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Replace) {
+ WideString fred(L"FRED");
fred.Replace(L"FR", L"BL");
EXPECT_EQ(L"BLED", fred);
fred.Replace(L"D", L"DDY");
@@ -366,8 +366,8 @@
EXPECT_EQ(L"", fred);
}
-TEST(fxcrt, WideStringInsert) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Insert) {
+ WideString fred(L"FRED");
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ(L"SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -379,20 +379,20 @@
EXPECT_EQ(8u, fred.Insert(12, 'P'));
EXPECT_EQ(L"STFRUEDV", fred);
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ(L"X", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(0u, empty.Insert(5, 'X'));
EXPECT_NE(L"X", empty);
}
}
-TEST(fxcrt, WideStringInsertAtFrontAndInsertAtBack) {
+TEST(WideString, InsertAtFrontAndInsertAtBack) {
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtFront('D'));
EXPECT_EQ(L"D", empty);
EXPECT_EQ(2u, empty.InsertAtFront('E'));
@@ -403,7 +403,7 @@
EXPECT_EQ(L"FRED", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtBack('F'));
EXPECT_EQ(L"F", empty);
EXPECT_EQ(2u, empty.InsertAtBack('R'));
@@ -414,7 +414,7 @@
EXPECT_EQ(L"FRED", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtBack('E'));
EXPECT_EQ(L"E", empty);
EXPECT_EQ(2u, empty.InsertAtFront('R'));
@@ -426,8 +426,8 @@
}
}
-TEST(fxcrt, WideStringDelete) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Delete) {
+ WideString fred(L"FRED");
EXPECT_EQ(4u, fred.Delete(0, 0));
EXPECT_EQ(L"FRED", fred);
EXPECT_EQ(2u, fred.Delete(0, 2));
@@ -439,15 +439,15 @@
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ(L"", fred);
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ(L"", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringMid) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Mid) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Mid(0, 0));
EXPECT_EQ(L"", fred.Mid(3, 0));
EXPECT_EQ(L"FRED", fred.Mid(0, 4));
@@ -465,12 +465,12 @@
EXPECT_EQ(L"", fred.Mid(1, 4));
EXPECT_EQ(L"", fred.Mid(4, 1));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Mid(0, 0));
}
-TEST(fxcrt, WideStringLeft) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Left) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Left(0));
EXPECT_EQ(L"F", fred.Left(1));
EXPECT_EQ(L"FR", fred.Left(2));
@@ -479,13 +479,13 @@
EXPECT_EQ(L"", fred.Left(5));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Left(0));
EXPECT_EQ(L"", empty.Left(1));
}
-TEST(fxcrt, WideStringRight) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Right) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Right(0));
EXPECT_EQ(L"D", fred.Right(1));
EXPECT_EQ(L"ED", fred.Right(2));
@@ -494,29 +494,29 @@
EXPECT_EQ(L"", fred.Right(5));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Right(0));
EXPECT_EQ(L"", empty.Right(1));
}
-TEST(fxcrt, WideStringFind) {
- CFX_WideString null_string;
+TEST(WideString, Find) {
+ WideString null_string;
EXPECT_FALSE(null_string.Find(L'a').has_value());
EXPECT_FALSE(null_string.Find(L'\0').has_value());
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_WideString single_string(L"a");
+ WideString single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find(L'b').has_value());
EXPECT_FALSE(single_string.Find(L'\0').has_value());
- CFX_WideString longer_string(L"abccc");
+ WideString longer_string(L"abccc");
result = longer_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -539,7 +539,7 @@
EXPECT_EQ(3u, result.value());
EXPECT_FALSE(longer_string.Find(L"d").has_value());
- CFX_WideString hibyte_string(
+ WideString hibyte_string(
L"ab\xff8c"
L"def");
result = hibyte_string.Find(L'\xff8c');
@@ -547,22 +547,22 @@
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, WideStringUpperLower) {
- CFX_WideString fred(L"F-Re.42D");
+TEST(WideString, UpperLower) {
+ WideString fred(L"F-Re.42D");
fred.MakeLower();
EXPECT_EQ(L"f-re.42d", fred);
fred.MakeUpper();
EXPECT_EQ(L"F-RE.42D", fred);
- CFX_WideString empty;
+ WideString empty;
empty.MakeLower();
EXPECT_EQ(L"", empty);
empty.MakeUpper();
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimRight) {
- CFX_WideString fred(L" FRED ");
+TEST(WideString, TrimRight) {
+ WideString fred(L" FRED ");
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
fred.TrimRight(L'E');
@@ -572,7 +572,7 @@
fred.TrimRight(L"ERP");
EXPECT_EQ(L" F", fred);
- CFX_WideString blank(L" ");
+ WideString blank(L" ");
blank.TrimRight(L"ERP");
EXPECT_EQ(L" ", blank);
blank.TrimRight(L'E');
@@ -580,7 +580,7 @@
blank.TrimRight();
EXPECT_EQ(L"", blank);
- CFX_WideString empty;
+ WideString empty;
empty.TrimRight(L"ERP");
EXPECT_EQ(L"", empty);
empty.TrimRight(L'E');
@@ -589,10 +589,10 @@
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimRightCopies) {
+TEST(WideString, TrimRightCopies) {
{
// With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
+ WideString fred(L" FRED ");
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
@@ -600,8 +600,8 @@
}
{
// With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
+ WideString fred(L" FRED ");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
@@ -610,8 +610,8 @@
}
{
// With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
+ WideString fred(L"FRED");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L"FRED", fred);
@@ -620,8 +620,8 @@
}
}
-TEST(fxcrt, WideStringTrimLeft) {
- CFX_WideString fred(L" FRED ");
+TEST(WideString, TrimLeft) {
+ WideString fred(L" FRED ");
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
fred.TrimLeft(L'E');
@@ -631,7 +631,7 @@
fred.TrimLeft(L"ERP");
EXPECT_EQ(L"D ", fred);
- CFX_WideString blank(L" ");
+ WideString blank(L" ");
blank.TrimLeft(L"ERP");
EXPECT_EQ(L" ", blank);
blank.TrimLeft(L'E');
@@ -639,7 +639,7 @@
blank.TrimLeft();
EXPECT_EQ(L"", blank);
- CFX_WideString empty;
+ WideString empty;
empty.TrimLeft(L"ERP");
EXPECT_EQ(L"", empty);
empty.TrimLeft(L'E');
@@ -648,10 +648,10 @@
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimLeftCopies) {
+TEST(WideString, TrimLeftCopies) {
{
// With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
+ WideString fred(L" FRED ");
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
@@ -659,8 +659,8 @@
}
{
// With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
+ WideString fred(L" FRED ");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
@@ -669,8 +669,8 @@
}
{
// With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
+ WideString fred(L"FRED");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED", fred);
@@ -679,9 +679,9 @@
}
}
-TEST(fxcrt, WideStringReserve) {
+TEST(WideString, Reserve) {
{
- CFX_WideString str;
+ WideString str;
str.Reserve(6);
const wchar_t* old_buffer = str.c_str();
str += L"ABCDEF";
@@ -690,7 +690,7 @@
EXPECT_NE(old_buffer, str.c_str());
}
{
- CFX_WideString str(L"A");
+ WideString str(L"A");
str.Reserve(6);
const wchar_t* old_buffer = str.c_str();
str += L"BCDEF";
@@ -700,16 +700,16 @@
}
}
-TEST(fxcrt, WideStringGetBuffer) {
+TEST(WideString, GetBuffer) {
{
- CFX_WideString str;
+ WideString str;
wchar_t* buffer = str.GetBuffer(12);
wcscpy(buffer, L"clams");
str.ReleaseBuffer(str.GetStringLength());
EXPECT_EQ(L"clams", str);
}
{
- CFX_WideString str(L"cl");
+ WideString str(L"cl");
wchar_t* buffer = str.GetBuffer(12);
wcscpy(buffer + 2, L"ams");
str.ReleaseBuffer(str.GetStringLength());
@@ -717,9 +717,9 @@
}
}
-TEST(fxcrt, WideStringReleaseBuffer) {
+TEST(WideString, ReleaseBuffer) {
{
- CFX_WideString str;
+ WideString str;
str.Reserve(12);
str += L"clams";
const wchar_t* old_buffer = str.c_str();
@@ -728,7 +728,7 @@
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str(L"c");
+ WideString str(L"c");
str.Reserve(12);
str += L"lams";
const wchar_t* old_buffer = str.c_str();
@@ -737,7 +737,7 @@
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Reserve(200);
str += L"clams";
const wchar_t* old_buffer = str.c_str();
@@ -746,7 +746,7 @@
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str(L"c");
+ WideString str(L"c");
str.Reserve(200);
str += L"lams";
const wchar_t* old_buffer = str.c_str();
@@ -756,16 +756,16 @@
}
}
-TEST(fxcrt, WideStringEmptyReverseIterator) {
- CFX_WideString empty;
+TEST(WideString, EmptyReverseIterator) {
+ WideString empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, WideStringOneCharReverseIterator) {
- CFX_WideString one_str(L"a");
+TEST(WideString, OneCharReverseIterator) {
+ WideString one_str(L"a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -778,8 +778,8 @@
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, WideStringMultiCharReverseIterator) {
- CFX_WideString multi_str(L"abcd");
+TEST(WideString, MultiCharReverseIterator) {
+ WideString multi_str(L"abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -823,17 +823,17 @@
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, WideStringUTF16LE_Encode) {
+TEST(WideString, UTF16LE_Encode) {
struct UTF16LEEncodeCase {
- CFX_WideString ws;
- CFX_ByteString bs;
+ WideString ws;
+ ByteString bs;
} utf16le_encode_cases[] = {
- {L"", CFX_ByteString("\0\0", 2)},
- {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
- {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
- {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
+ {L"", ByteString("\0\0", 2)},
+ {L"abc", ByteString("a\0b\0c\0\0\0", 8)},
+ {L"abcdef", ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
+ {L"abc\0def", ByteString("a\0b\0c\0\0\0", 8)},
+ {L"\xaabb\xccdd", ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
+ {L"\x3132\x6162", ByteString("\x32\x31\x62\x61\0\0", 6)},
};
for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
@@ -843,27 +843,27 @@
}
}
-TEST(fxcrt, WideStringCFromVector) {
- std::vector<CFX_WideStringC::UnsignedType> null_vec;
- CFX_WideStringC null_string(null_vec);
+TEST(WideStringView, FromVector) {
+ std::vector<WideStringView::UnsignedType> null_vec;
+ WideStringView null_string(null_vec);
EXPECT_EQ(0u, null_string.GetLength());
- std::vector<CFX_WideStringC::UnsignedType> lower_a_vec(
- 10, static_cast<CFX_WideStringC::UnsignedType>(L'a'));
- CFX_WideStringC lower_a_string(lower_a_vec);
+ std::vector<WideStringView::UnsignedType> lower_a_vec(
+ 10, static_cast<WideStringView::UnsignedType>(L'a'));
+ WideStringView lower_a_string(lower_a_vec);
EXPECT_EQ(10u, lower_a_string.GetLength());
EXPECT_EQ(L"aaaaaaaaaa", lower_a_string);
- std::vector<CFX_WideStringC::UnsignedType> cleared_vec;
+ std::vector<WideStringView::UnsignedType> cleared_vec;
cleared_vec.push_back(42);
cleared_vec.pop_back();
- CFX_WideStringC cleared_string(cleared_vec);
+ WideStringView cleared_string(cleared_vec);
EXPECT_EQ(0u, cleared_string.GetLength());
EXPECT_EQ(nullptr, cleared_string.raw_str());
}
-TEST(fxcrt, WideStringCElementAccess) {
- CFX_WideStringC abc(L"abc");
+TEST(WideStringView, ElementAccess) {
+ WideStringView abc(L"abc");
EXPECT_EQ(L'a', static_cast<wchar_t>(abc[0]));
EXPECT_EQ(L'b', static_cast<wchar_t>(abc[1]));
EXPECT_EQ(L'c', static_cast<wchar_t>(abc[2]));
@@ -872,11 +872,11 @@
#endif
}
-TEST(fxcrt, WideStringCOperatorLT) {
- CFX_WideStringC empty;
- CFX_WideStringC a(L"a");
- CFX_WideStringC abc(L"\x0110qq"); // Comes InsertAtFront despite endianness.
- CFX_WideStringC def(L"\x1001qq"); // Comes InsertAtBack despite endianness.
+TEST(WideStringView, OperatorLT) {
+ WideStringView empty;
+ WideStringView a(L"a");
+ WideStringView abc(L"\x0110qq"); // Comes InsertAtFront despite endianness.
+ WideStringView def(L"\x1001qq"); // Comes InsertAtBack despite endianness.
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -902,21 +902,21 @@
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, WideStringCOperatorEQ) {
- CFX_WideStringC wide_string_c(L"hello");
+TEST(WideStringView, OperatorEQ) {
+ WideStringView wide_string_c(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_c);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_c_same1);
EXPECT_TRUE(wide_string_c_same1 == wide_string_c);
- CFX_WideStringC wide_string_c_same2(wide_string_c);
+ WideStringView wide_string_c_same2(wide_string_c);
EXPECT_TRUE(wide_string_c == wide_string_c_same2);
EXPECT_TRUE(wide_string_c_same2 == wide_string_c);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_FALSE(wide_string_c == wide_string_c1);
EXPECT_FALSE(wide_string_c == wide_string_c2);
EXPECT_FALSE(wide_string_c == wide_string_c3);
@@ -924,13 +924,13 @@
EXPECT_FALSE(wide_string_c2 == wide_string_c);
EXPECT_FALSE(wide_string_c3 == wide_string_c);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_same1);
EXPECT_TRUE(wide_string_same1 == wide_string_c);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_FALSE(wide_string_c == wide_string1);
EXPECT_FALSE(wide_string_c == wide_string2);
EXPECT_FALSE(wide_string_c == wide_string3);
@@ -954,21 +954,21 @@
EXPECT_FALSE(c_string3 == wide_string_c);
}
-TEST(fxcrt, WideStringCOperatorNE) {
- CFX_WideStringC wide_string_c(L"hello");
+TEST(WideStringView, OperatorNE) {
+ WideStringView wide_string_c(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_c);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_c_same1);
EXPECT_FALSE(wide_string_c_same1 != wide_string_c);
- CFX_WideStringC wide_string_c_same2(wide_string_c);
+ WideStringView wide_string_c_same2(wide_string_c);
EXPECT_FALSE(wide_string_c != wide_string_c_same2);
EXPECT_FALSE(wide_string_c_same2 != wide_string_c);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_TRUE(wide_string_c != wide_string_c1);
EXPECT_TRUE(wide_string_c != wide_string_c2);
EXPECT_TRUE(wide_string_c != wide_string_c3);
@@ -976,13 +976,13 @@
EXPECT_TRUE(wide_string_c2 != wide_string_c);
EXPECT_TRUE(wide_string_c3 != wide_string_c);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_same1);
EXPECT_FALSE(wide_string_same1 != wide_string_c);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_TRUE(wide_string_c != wide_string1);
EXPECT_TRUE(wide_string_c != wide_string2);
EXPECT_TRUE(wide_string_c != wide_string3);
@@ -1006,24 +1006,24 @@
EXPECT_TRUE(c_string3 != wide_string_c);
}
-TEST(fxcrt, WideStringCFind) {
- CFX_WideStringC null_string;
+TEST(WideStringView, Find) {
+ WideStringView null_string;
EXPECT_FALSE(null_string.Find(L'a').has_value());
EXPECT_FALSE(null_string.Find(L'\0').has_value());
- CFX_WideStringC empty_string(L"");
+ WideStringView empty_string(L"");
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_WideStringC single_string(L"a");
+ WideStringView single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find(L'b').has_value());
EXPECT_FALSE(single_string.Find(L'\0').has_value());
- CFX_WideStringC longer_string(L"abccc");
+ WideStringView longer_string(L"abccc");
result = longer_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -1033,7 +1033,7 @@
EXPECT_FALSE(longer_string.Find(L'd').has_value());
EXPECT_FALSE(longer_string.Find(L'\0').has_value());
- CFX_WideStringC hibyte_string(
+ WideStringView hibyte_string(
L"ab\xFF8c"
L"def");
result = hibyte_string.Find(L'\xFF8c');
@@ -1041,8 +1041,8 @@
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, WideStringCNullIterator) {
- CFX_WideStringC null_str;
+TEST(WideStringView, NullIterator) {
+ WideStringView null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1053,8 +1053,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringCEmptyIterator) {
- CFX_WideStringC empty_str(L"");
+TEST(WideStringView, EmptyIterator) {
+ WideStringView empty_str(L"");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1065,8 +1065,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringCOneCharIterator) {
- CFX_WideStringC one_str(L"a");
+TEST(WideStringView, OneCharIterator) {
+ WideStringView one_str(L"a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1077,8 +1077,8 @@
EXPECT_EQ(static_cast<int32_t>(L'a'), sum);
}
-TEST(fxcrt, WideStringCMultiCharIterator) {
- CFX_WideStringC one_str(L"abc");
+TEST(WideStringView, MultiCharIterator) {
+ WideStringView one_str(L"abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1089,16 +1089,16 @@
EXPECT_EQ(static_cast<int32_t>(L'a' + L'b' + L'c'), sum);
}
-TEST(fxcrt, WideStringCEmptyReverseIterator) {
- CFX_WideStringC empty;
+TEST(WideStringView, EmptyReverseIterator) {
+ WideStringView empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, WideStringCOneCharReverseIterator) {
- CFX_WideStringC one_str(L"a");
+TEST(WideStringView, OneCharReverseIterator) {
+ WideStringView one_str(L"a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -1111,8 +1111,8 @@
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, WideStringCMultiCharReverseIterator) {
- CFX_WideStringC multi_str(L"abcd");
+TEST(WideStringView, MultiCharReverseIterator) {
+ WideStringView multi_str(L"abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -1156,8 +1156,8 @@
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, WideStringCAnyAllNoneOf) {
- CFX_WideStringC str(L"aaaaaaaaaaaaaaaaab");
+TEST(WideStringView, AnyAllNoneOf) {
+ WideStringView str(L"aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const wchar_t& c) { return c == L'a'; }));
@@ -1172,112 +1172,112 @@
EXPECT_FALSE(pdfium::ContainsValue(str, L'z'));
}
-TEST(fxcrt, WideStringCTrimmedRight) {
- CFX_WideStringC fred(L"FRED");
+TEST(WideStringView, TrimmedRight) {
+ WideStringView fred(L"FRED");
EXPECT_EQ(L"FRED", fred.TrimmedRight(L'E'));
EXPECT_EQ(L"FRE", fred.TrimmedRight(L'D'));
- CFX_WideStringC fredd(L"FREDD");
+ WideStringView fredd(L"FREDD");
EXPECT_EQ(L"FRE", fred.TrimmedRight(L'D'));
}
-TEST(fxcrt, WideStringFormatWidth) {
+TEST(WideString, FormatWidth) {
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%5d", 1);
EXPECT_EQ(L" 1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%*d", 5, 1);
EXPECT_EQ(L" 1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%-1d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%0d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%1048576d", 1);
EXPECT_EQ(L"", str);
}
}
-TEST(fxcrt, WideStringFormatPrecision) {
+TEST(WideString, FormatPrecision) {
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.2f", 1.12345);
EXPECT_EQ(L"1.12", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.*f", 3, 1.12345);
EXPECT_EQ(L"1.123", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%-1f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%0f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.1048576f", 1.2);
EXPECT_EQ(L"", str);
}
}
-TEST(fxcrt, WideStringFormatOutOfRangeChar) {
- CFX_WideString str;
+TEST(WideString, FormatOutOfRangeChar) {
+ WideString str;
str.Format(L"unsupported char '%c'", 0x00FF00FF);
}
-TEST(fxcrt, EmptyWideString) {
- CFX_WideString empty_str;
+TEST(WideString, Empty) {
+ WideString empty_str;
EXPECT_TRUE(empty_str.IsEmpty());
EXPECT_EQ(0u, empty_str.GetLength());
const wchar_t* cstr = empty_str.c_str();
EXPECT_EQ(0u, FXSYS_wcslen(cstr));
}
-TEST(fxcrt, WidStringInitializerList) {
- CFX_WideString many_str({L"clams", L" and ", L"oysters"});
+TEST(CFX_WidString, InitializerList) {
+ WideString many_str({L"clams", L" and ", L"oysters"});
EXPECT_EQ(L"clams and oysters", many_str);
many_str = {L"fish", L" and ", L"chips", L" and ", L"soda"};
EXPECT_EQ(L"fish and chips and soda", many_str);
}
-TEST(fxcrt, WideStringNullIterator) {
- CFX_WideString null_str;
+TEST(WideString, NullIterator) {
+ WideString null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1288,8 +1288,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringEmptyIterator) {
- CFX_WideString empty_str(L"");
+TEST(WideString, EmptyIterator) {
+ WideString empty_str(L"");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1300,8 +1300,8 @@
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringOneCharIterator) {
- CFX_WideString one_str(L"a");
+TEST(WideString, OneCharIterator) {
+ WideString one_str(L"a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1312,8 +1312,8 @@
EXPECT_EQ(static_cast<int32_t>(L'a'), sum);
}
-TEST(fxcrt, WideStringMultiCharIterator) {
- CFX_WideString one_str(L"abc");
+TEST(WideString, MultiCharIterator) {
+ WideString one_str(L"abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1324,8 +1324,8 @@
EXPECT_EQ(static_cast<int32_t>(L'a' + L'b' + L'c'), sum);
}
-TEST(fxcrt, WideStringAnyAllNoneOf) {
- CFX_WideString str(L"aaaaaaaaaaaaaaaaab");
+TEST(WideString, AnyAllNoneOf) {
+ WideString str(L"aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const wchar_t& c) { return c == L'a'; }));
@@ -1340,11 +1340,11 @@
EXPECT_FALSE(pdfium::ContainsValue(str, L'z'));
}
-TEST(fxcrt, OStreamWideStringOverload) {
+TEST(WideString, OStreamOverload) {
std::ostringstream stream;
// Basic case, empty string
- CFX_WideString str;
+ WideString str;
stream << str;
EXPECT_EQ("", stream.str());
@@ -1359,7 +1359,7 @@
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
- // Changing the CFX_WideString does not change the stream it was written to.
+ // Changing the WideString does not change the stream it was written to.
str = L"123";
EXPECT_EQ("abcdefghi", stream.str());
@@ -1370,35 +1370,35 @@
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_WideString with nulls and no specified length treats it as
+ // Writing a WideString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_WideString(stringWithNulls);
+ str = WideString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_WideString with nulls but specifying its length treats it as
+ // Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_WideString(stringWithNulls, 4);
+ str = WideString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_WideString str1(L"abc");
- CFX_WideString str2(L"def");
+ WideString str1(L"abc");
+ WideString str2(L"def");
stream.str("");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
-TEST(fxcrt, WideOStreamWideStringOverload) {
+TEST(WideString, WideOStreamOverload) {
std::wostringstream stream;
// Basic case, empty string
- CFX_WideString str;
+ WideString str;
stream << str;
EXPECT_EQ(L"", stream.str());
@@ -1413,7 +1413,7 @@
stream << L"abc" << str << L"ghi";
EXPECT_EQ(L"abcdefghi", stream.str());
- // Changing the CFX_WideString does not change the stream it was written to.
+ // Changing the WideString does not change the stream it was written to.
str = L"123";
EXPECT_EQ(L"abcdefghi", stream.str());
@@ -1424,35 +1424,35 @@
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_WideString with nulls and no specified length treats it as
+ // Writing a WideString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_WideString(stringWithNulls);
+ str = WideString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str(L"");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_WideString with nulls but specifying its length treats it as
+ // Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_WideString(stringWithNulls, 4);
+ str = WideString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str(L"");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_WideString str1(L"abc");
- CFX_WideString str2(L"def");
+ WideString str1(L"abc");
+ WideString str2(L"def");
stream.str(L"");
stream << str1 << str2;
EXPECT_EQ(L"abcdef", stream.str());
}
-TEST(fxcrt, OStreamWideStringCOverload) {
+TEST(WideStringView, OStreamOverload) {
// Basic case, empty string
{
std::ostringstream stream;
- CFX_WideStringC str;
+ WideStringView str;
stream << str;
EXPECT_EQ("", stream.str());
}
@@ -1460,7 +1460,7 @@
// Basic case, non-empty string
{
std::ostringstream stream;
- CFX_WideStringC str(L"def");
+ WideStringView str(L"def");
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
}
@@ -1468,15 +1468,15 @@
// Basic case, wide character
{
std::ostringstream stream;
- CFX_WideStringC str(L"\u20AC");
+ WideStringView str(L"\u20AC");
stream << str;
EXPECT_EQ("\u20AC", stream.str());
}
- // Changing the CFX_WideStringC does not change the stream it was written to.
+ // Changing the WideStringView does not change the stream it was written to.
{
std::ostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
str = L"123";
EXPECT_EQ("abc", stream.str());
@@ -1485,7 +1485,7 @@
// Writing it again to the stream will use the latest value.
{
std::ostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
stream.str("");
str = L"123";
@@ -1493,24 +1493,24 @@
EXPECT_EQ("123", stream.str());
}
- // Writing a CFX_WideStringC with nulls and no specified length treats it as
+ // Writing a WideStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::ostringstream stream;
- CFX_WideStringC str(stringWithNulls);
+ WideStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
str = L"";
}
- // Writing a CFX_WideStringC with nulls but specifying its length treats it as
+ // Writing a WideStringView with nulls but specifying its length treats it as
// a C++-style string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::ostringstream stream;
- CFX_WideStringC str(stringWithNulls, 4);
+ WideStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1520,18 +1520,18 @@
// << operators can be chained.
{
std::ostringstream stream;
- CFX_WideStringC str1(L"abc");
- CFX_WideStringC str2(L"def");
+ WideStringView str1(L"abc");
+ WideStringView str2(L"def");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
}
-TEST(fxcrt, WideOStreamWideStringCOverload) {
+TEST(WideStringView, WideOStreamOverload) {
// Basic case, empty string
{
std::wostringstream stream;
- CFX_WideStringC str;
+ WideStringView str;
stream << str;
EXPECT_EQ(L"", stream.str());
}
@@ -1539,7 +1539,7 @@
// Basic case, non-empty string
{
std::wostringstream stream;
- CFX_WideStringC str(L"def");
+ WideStringView str(L"def");
stream << "abc" << str << "ghi";
EXPECT_EQ(L"abcdefghi", stream.str());
}
@@ -1547,15 +1547,15 @@
// Basic case, wide character
{
std::wostringstream stream;
- CFX_WideStringC str(L"\u20AC");
+ WideStringView str(L"\u20AC");
stream << str;
EXPECT_EQ(L"\u20AC", stream.str());
}
- // Changing the CFX_WideStringC does not change the stream it was written to.
+ // Changing the WideStringView does not change the stream it was written to.
{
std::wostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
str = L"123";
EXPECT_EQ(L"abc", stream.str());
@@ -1564,7 +1564,7 @@
// Writing it again to the stream will use the latest value.
{
std::wostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
stream.str(L"");
str = L"123";
@@ -1572,23 +1572,23 @@
EXPECT_EQ(L"123", stream.str());
}
- // Writing a CFX_WideStringC with nulls and no specified length treats it as
+ // Writing a WideStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::wostringstream stream;
- CFX_WideStringC str(stringWithNulls);
+ WideStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
}
- // Writing a CFX_WideStringC with nulls but specifying its length treats it as
+ // Writing a WideStringView with nulls but specifying its length treats it as
// a C++-style string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::wostringstream stream;
- CFX_WideStringC str(stringWithNulls, 4);
+ WideStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1597,8 +1597,8 @@
// << operators can be chained.
{
std::wostringstream stream;
- CFX_WideStringC str1(L"abc");
- CFX_WideStringC str2(L"def");
+ WideStringView str1(L"abc");
+ WideStringView str2(L"def");
stream << str1 << str2;
EXPECT_EQ(L"abcdef", stream.str());
}
diff --git a/core/fxcrt/xml/cfx_saxcontext.h b/core/fxcrt/xml/cfx_saxcontext.h
index f66c76c..d4d74a3 100644
--- a/core/fxcrt/xml/cfx_saxcontext.h
+++ b/core/fxcrt/xml/cfx_saxcontext.h
@@ -18,7 +18,7 @@
~CFX_SAXContext();
std::ostringstream m_TextBuf;
- CFX_ByteString m_bsTagName;
+ ByteString m_bsTagName;
CFX_SAXItem::Type m_eNode;
};
diff --git a/core/fxcrt/xml/cfx_saxreader.cpp b/core/fxcrt/xml/cfx_saxreader.cpp
index 641dc08..e2c09d1 100644
--- a/core/fxcrt/xml/cfx_saxreader.cpp
+++ b/core/fxcrt/xml/cfx_saxreader.cpp
@@ -293,8 +293,8 @@
m_iEntityStart = -1;
// NOTE: Relies on negative lengths being treated as empty strings.
- CFX_ByteString csEntity(m_Data.data() + iSaveStart + 1,
- CurrentDataIndex() - iSaveStart - 1);
+ ByteString csEntity(m_Data.data() + iSaveStart + 1,
+ CurrentDataIndex() - iSaveStart - 1);
int32_t iLen = csEntity.GetLength();
if (iLen == 0)
return;
@@ -649,7 +649,7 @@
m_pHandler->OnTagData(
pItem->m_pNode,
m_bCharData ? CFX_SAXItem::Type::CharData : CFX_SAXItem::Type::Text,
- CFX_ByteStringC(m_Data), m_File.m_dwCur + m_dwDataOffset);
+ ByteStringView(m_Data), m_File.m_dwCur + m_dwDataOffset);
}
void CFX_SAXReader::NotifyEnter() {
@@ -662,7 +662,7 @@
if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- pItem->m_pNode = m_pHandler->OnTagEnter(CFX_ByteStringC(m_Data),
+ pItem->m_pNode = m_pHandler->OnTagEnter(ByteStringView(m_Data),
pItem->m_eNode, m_dwNodePos);
}
}
@@ -677,8 +677,8 @@
if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_pHandler->OnTagAttribute(pItem->m_pNode, CFX_ByteStringC(m_Name),
- CFX_ByteStringC(m_Data));
+ m_pHandler->OnTagAttribute(pItem->m_pNode, ByteStringView(m_Name),
+ ByteStringView(m_Data));
}
}
@@ -717,7 +717,7 @@
return;
if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
- m_pHandler->OnTagEnd(pItem->m_pNode, CFX_ByteStringC(m_Data), m_dwNodePos);
+ m_pHandler->OnTagEnd(pItem->m_pNode, ByteStringView(m_Data), m_dwNodePos);
}
void CFX_SAXReader::NotifyTargetData() {
@@ -730,10 +730,10 @@
if (pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_Name), m_dwNodePos);
+ ByteStringView(m_Name), m_dwNodePos);
} else if (pItem->m_eNode == CFX_SAXItem::Type::Comment) {
m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_Data), m_dwNodePos);
+ ByteStringView(m_Data), m_dwNodePos);
}
}
diff --git a/core/fxcrt/xml/cfx_saxreader.h b/core/fxcrt/xml/cfx_saxreader.h
index 3db1c7c..51d9e43 100644
--- a/core/fxcrt/xml/cfx_saxreader.h
+++ b/core/fxcrt/xml/cfx_saxreader.h
@@ -75,24 +75,24 @@
class HandlerIface {
public:
virtual ~HandlerIface() {}
- virtual CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ virtual CFX_SAXContext* OnTagEnter(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) = 0;
virtual void OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) = 0;
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) = 0;
virtual void OnTagBreak(CFX_SAXContext* pTag) = 0;
virtual void OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) = 0;
virtual void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) = 0;
virtual void OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) = 0;
virtual void OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) = 0;
};
diff --git a/core/fxcrt/xml/cfx_saxreader_unittest.cpp b/core/fxcrt/xml/cfx_saxreader_unittest.cpp
index 6282850..13d0632 100644
--- a/core/fxcrt/xml/cfx_saxreader_unittest.cpp
+++ b/core/fxcrt/xml/cfx_saxreader_unittest.cpp
@@ -17,28 +17,28 @@
class MockHandler : public CFX_SAXReader::HandlerIface {
public:
MOCK_METHOD3(OnTagEnter,
- CFX_SAXContext*(const CFX_ByteStringC& bsTagName,
+ CFX_SAXContext*(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos));
MOCK_METHOD3(OnTagAttribute,
void(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue));
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue));
MOCK_METHOD1(OnTagBreak, void(CFX_SAXContext* pTag));
MOCK_METHOD4(OnTagData,
void(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos));
MOCK_METHOD2(OnTagClose, void(CFX_SAXContext* pTag, uint32_t dwEndPos));
MOCK_METHOD3(OnTagEnd,
void(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos));
MOCK_METHOD4(OnTargetData,
void(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos));
};
diff --git a/core/fxcrt/xml/cfx_saxreaderhandler.cpp b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
index b8399ff..d255ce9 100644
--- a/core/fxcrt/xml/cfx_saxreaderhandler.cpp
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
@@ -18,7 +18,7 @@
CFX_SAXReaderHandler::~CFX_SAXReaderHandler() {}
CFX_SAXContext* CFX_SAXReaderHandler::OnTagEnter(
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) {
UpdateChecksum(true);
@@ -38,8 +38,8 @@
}
void CFX_SAXReaderHandler::OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) {
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) {
if (!pTag)
return;
pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
@@ -55,7 +55,7 @@
void CFX_SAXReaderHandler::OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) {
if (!pTag)
return;
@@ -75,13 +75,13 @@
if (pTag->m_eNode == CFX_SAXItem::Type::Instruction)
pTag->m_TextBuf << "?>";
else if (pTag->m_eNode == CFX_SAXItem::Type::Tag)
- pTag->m_TextBuf << "></" << pTag->m_bsTagName.AsStringC() << ">";
+ pTag->m_TextBuf << "></" << pTag->m_bsTagName.AsStringView() << ">";
UpdateChecksum(false);
}
void CFX_SAXReaderHandler::OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) {
if (!pTag)
return;
@@ -92,7 +92,7 @@
void CFX_SAXReaderHandler::OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) {
if (!pTag && eType != CFX_SAXItem::Type::Comment)
return;
@@ -122,7 +122,7 @@
}
}
if (bUpdata)
- m_pContext->Update(CFX_ByteStringC(pBuffer, iLength));
+ m_pContext->Update(ByteStringView(pBuffer, iLength));
m_SAXContext.m_TextBuf.str("");
}
diff --git a/core/fxcrt/xml/cfx_saxreaderhandler.h b/core/fxcrt/xml/cfx_saxreaderhandler.h
index c5e1dc2..263008f 100644
--- a/core/fxcrt/xml/cfx_saxreaderhandler.h
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.h
@@ -18,24 +18,24 @@
explicit CFX_SAXReaderHandler(CFX_ChecksumContext* pContext);
~CFX_SAXReaderHandler() override;
- CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ CFX_SAXContext* OnTagEnter(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) override;
void OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) override;
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) override;
void OnTagBreak(CFX_SAXContext* pTag) override;
void OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) override;
void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) override;
void OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) override;
void OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) override;
private:
diff --git a/core/fxcrt/xml/cfx_xmlattributenode.cpp b/core/fxcrt/xml/cfx_xmlattributenode.cpp
index 9ea6756..6104747 100644
--- a/core/fxcrt/xml/cfx_xmlattributenode.cpp
+++ b/core/fxcrt/xml/cfx_xmlattributenode.cpp
@@ -8,28 +8,27 @@
#include "core/fxcrt/fx_extension.h"
-CFX_XMLAttributeNode::CFX_XMLAttributeNode(const CFX_WideString& name)
+CFX_XMLAttributeNode::CFX_XMLAttributeNode(const WideString& name)
: CFX_XMLNode(), name_(name) {
ASSERT(name_.GetLength() > 0);
}
CFX_XMLAttributeNode::~CFX_XMLAttributeNode() {}
-bool CFX_XMLAttributeNode::HasAttribute(const CFX_WideString& name) const {
+bool CFX_XMLAttributeNode::HasAttribute(const WideString& name) const {
return attrs_.find(name) != attrs_.end();
}
-CFX_WideString CFX_XMLAttributeNode::GetString(
- const CFX_WideString& name) const {
+WideString CFX_XMLAttributeNode::GetString(const WideString& name) const {
auto it = attrs_.find(name);
- return it != attrs_.end() ? it->second : CFX_WideString();
+ return it != attrs_.end() ? it->second : WideString();
}
-void CFX_XMLAttributeNode::SetString(const CFX_WideString& name,
- const CFX_WideString& value) {
+void CFX_XMLAttributeNode::SetString(const WideString& name,
+ const WideString& value) {
attrs_[name] = value;
}
-void CFX_XMLAttributeNode::RemoveAttribute(const CFX_WideString& name) {
+void CFX_XMLAttributeNode::RemoveAttribute(const WideString& name) {
attrs_.erase(name);
}
diff --git a/core/fxcrt/xml/cfx_xmlattributenode.h b/core/fxcrt/xml/cfx_xmlattributenode.h
index e8f358e..1ac9b84 100644
--- a/core/fxcrt/xml/cfx_xmlattributenode.h
+++ b/core/fxcrt/xml/cfx_xmlattributenode.h
@@ -15,30 +15,30 @@
class CFX_XMLAttributeNode : public CFX_XMLNode {
public:
- explicit CFX_XMLAttributeNode(const CFX_WideString& name);
+ explicit CFX_XMLAttributeNode(const WideString& name);
~CFX_XMLAttributeNode() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override = 0;
std::unique_ptr<CFX_XMLNode> Clone() override = 0;
- CFX_WideString GetName() const { return name_; }
- const std::map<CFX_WideString, CFX_WideString>& GetAttributes() const {
+ WideString GetName() const { return name_; }
+ const std::map<WideString, WideString>& GetAttributes() const {
return attrs_;
}
- void SetAttributes(const std::map<CFX_WideString, CFX_WideString>& attrs) {
+ void SetAttributes(const std::map<WideString, WideString>& attrs) {
attrs_ = attrs;
}
- bool HasAttribute(const CFX_WideString& name) const;
+ bool HasAttribute(const WideString& name) const;
- void SetString(const CFX_WideString& name, const CFX_WideString& value);
- CFX_WideString GetString(const CFX_WideString& name) const;
+ void SetString(const WideString& name, const WideString& value);
+ WideString GetString(const WideString& name) const;
- void RemoveAttribute(const CFX_WideString& name);
+ void RemoveAttribute(const WideString& name);
private:
- CFX_WideString name_;
- std::map<CFX_WideString, CFX_WideString> attrs_;
+ WideString name_;
+ std::map<WideString, WideString> attrs_;
};
#endif // CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
diff --git a/core/fxcrt/xml/cfx_xmlchardata.cpp b/core/fxcrt/xml/cfx_xmlchardata.cpp
index 185bd06..902d139 100644
--- a/core/fxcrt/xml/cfx_xmlchardata.cpp
+++ b/core/fxcrt/xml/cfx_xmlchardata.cpp
@@ -8,7 +8,7 @@
#include "third_party/base/ptr_util.h"
-CFX_XMLCharData::CFX_XMLCharData(const CFX_WideString& wsCData)
+CFX_XMLCharData::CFX_XMLCharData(const WideString& wsCData)
: CFX_XMLText(wsCData) {}
CFX_XMLCharData::~CFX_XMLCharData() {}
diff --git a/core/fxcrt/xml/cfx_xmlchardata.h b/core/fxcrt/xml/cfx_xmlchardata.h
index c5c007b..9a4710f 100644
--- a/core/fxcrt/xml/cfx_xmlchardata.h
+++ b/core/fxcrt/xml/cfx_xmlchardata.h
@@ -14,7 +14,7 @@
class CFX_XMLCharData : public CFX_XMLText {
public:
- explicit CFX_XMLCharData(const CFX_WideString& wsCData);
+ explicit CFX_XMLCharData(const WideString& wsCData);
~CFX_XMLCharData() override;
FX_XMLNODETYPE GetType() const override;
diff --git a/core/fxcrt/xml/cfx_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp
index 6fce38c..e9a09b7 100644
--- a/core/fxcrt/xml/cfx_xmldoc.cpp
+++ b/core/fxcrt/xml/cfx_xmldoc.cpp
@@ -53,7 +53,7 @@
CFX_XMLNode* pNode = (CFX_XMLNode*)pINode;
switch (pNode->GetType()) {
case FX_XMLNODE_Instruction: {
- CFX_WideString ws;
+ WideString ws;
CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
@@ -66,13 +66,13 @@
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
} else {
ws.Format(L"<?%s", pInstruction->GetName().c_str());
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : pInstruction->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&");
wsValue.Replace(L"<", L"<");
wsValue.Replace(L">", L">");
@@ -84,28 +84,28 @@
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
for (auto target : pInstruction->GetTargetData()) {
ws = L" \"";
ws += target;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
ws = L"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
break;
}
case FX_XMLNODE_Element: {
- CFX_WideString ws;
+ WideString ws;
ws = L"<";
ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&");
wsValue.Replace(L"<", L"<");
wsValue.Replace(L">", L">");
@@ -117,11 +117,11 @@
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
if (pNode->m_pChild) {
ws = L"\n>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
SaveXMLNode(pXMLStream, static_cast<CFX_XMLNode*>(pChild));
@@ -133,24 +133,24 @@
} else {
ws = L"\n/>";
}
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
+ WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&");
ws.Replace(L"<", L"<");
ws.Replace(L">", L">");
ws.Replace(L"\'", L"'");
ws.Replace(L"\"", L""");
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
+ WideString ws = L"<![CDATA[";
ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Unknown:
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 5b5fe45..1317e9a 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -15,7 +15,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFX_XMLElement::CFX_XMLElement(const CFX_WideString& wsTag)
+CFX_XMLElement::CFX_XMLElement(const WideString& wsTag)
: CFX_XMLAttributeNode(wsTag) {}
CFX_XMLElement::~CFX_XMLElement() {}
@@ -28,7 +28,7 @@
auto pClone = pdfium::MakeUnique<CFX_XMLElement>(GetName());
pClone->SetAttributes(GetAttributes());
- CFX_WideString wsText;
+ WideString wsText;
CFX_XMLNode* pChild = m_pChild;
while (pChild) {
switch (pChild->GetType()) {
@@ -44,21 +44,21 @@
return std::move(pClone);
}
-CFX_WideString CFX_XMLElement::GetLocalTagName() const {
+WideString CFX_XMLElement::GetLocalTagName() const {
auto pos = GetName().Find(L':');
return pos.has_value()
? GetName().Right(GetName().GetLength() - pos.value() - 1)
: GetName();
}
-CFX_WideString CFX_XMLElement::GetNamespacePrefix() const {
+WideString CFX_XMLElement::GetNamespacePrefix() const {
auto pos = GetName().Find(L':');
- return pos.has_value() ? GetName().Left(pos.value()) : CFX_WideString();
+ return pos.has_value() ? GetName().Left(pos.value()) : WideString();
}
-CFX_WideString CFX_XMLElement::GetNamespaceURI() const {
- CFX_WideString wsAttri(L"xmlns");
- CFX_WideString wsPrefix = GetNamespacePrefix();
+WideString CFX_XMLElement::GetNamespaceURI() const {
+ WideString wsAttri(L"xmlns");
+ WideString wsPrefix = GetNamespacePrefix();
if (wsPrefix.GetLength() > 0) {
wsAttri += L":";
wsAttri += wsPrefix;
@@ -76,10 +76,10 @@
}
return pElement->GetString(wsAttri);
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CFX_XMLElement::GetTextData() const {
+WideString CFX_XMLElement::GetTextData() const {
CFX_WideTextBuf buffer;
CFX_XMLNode* pChild = m_pChild;
while (pChild) {
@@ -96,7 +96,7 @@
return buffer.MakeString();
}
-void CFX_XMLElement::SetTextData(const CFX_WideString& wsText) {
+void CFX_XMLElement::SetTextData(const WideString& wsText) {
if (wsText.GetLength() < 1)
return;
InsertChildNode(new CFX_XMLText(wsText));
diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index 2078034..59e3af6 100644
--- a/core/fxcrt/xml/cfx_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -15,19 +15,19 @@
class CFX_XMLElement : public CFX_XMLAttributeNode {
public:
- explicit CFX_XMLElement(const CFX_WideString& wsTag);
+ explicit CFX_XMLElement(const WideString& wsTag);
~CFX_XMLElement() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- CFX_WideString GetLocalTagName() const;
- CFX_WideString GetNamespacePrefix() const;
- CFX_WideString GetNamespaceURI() const;
+ WideString GetLocalTagName() const;
+ WideString GetNamespacePrefix() const;
+ WideString GetNamespaceURI() const;
- CFX_WideString GetTextData() const;
- void SetTextData(const CFX_WideString& wsText);
+ WideString GetTextData() const;
+ void SetTextData(const WideString& wsText);
};
#endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp
index 3c7deda..75a4a2e 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFX_XMLInstruction::CFX_XMLInstruction(const CFX_WideString& wsTarget)
+CFX_XMLInstruction::CFX_XMLInstruction(const WideString& wsTarget)
: CFX_XMLAttributeNode(wsTarget) {}
CFX_XMLInstruction::~CFX_XMLInstruction() {}
@@ -28,7 +28,7 @@
return std::move(pClone);
}
-void CFX_XMLInstruction::AppendData(const CFX_WideString& wsData) {
+void CFX_XMLInstruction::AppendData(const WideString& wsData) {
m_TargetData.push_back(wsData);
}
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.h b/core/fxcrt/xml/cfx_xmlinstruction.h
index 99554fc..ff27dae 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.h
+++ b/core/fxcrt/xml/cfx_xmlinstruction.h
@@ -15,21 +15,19 @@
class CFX_XMLInstruction : public CFX_XMLAttributeNode {
public:
- explicit CFX_XMLInstruction(const CFX_WideString& wsTarget);
+ explicit CFX_XMLInstruction(const WideString& wsTarget);
~CFX_XMLInstruction() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- const std::vector<CFX_WideString>& GetTargetData() const {
- return m_TargetData;
- }
- void AppendData(const CFX_WideString& wsData);
+ const std::vector<WideString>& GetTargetData() const { return m_TargetData; }
+ void AppendData(const WideString& wsData);
void RemoveData(int32_t index);
private:
- std::vector<CFX_WideString> m_TargetData;
+ std::vector<WideString> m_TargetData;
};
#endif // CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_
diff --git a/core/fxcrt/xml/cfx_xmlnode.cpp b/core/fxcrt/xml/cfx_xmlnode.cpp
index 47b3105..7a893af 100644
--- a/core/fxcrt/xml/cfx_xmlnode.cpp
+++ b/core/fxcrt/xml/cfx_xmlnode.cpp
@@ -84,7 +84,7 @@
if (iLength == 0) {
return nullptr;
}
- CFX_WideString csPath;
+ WideString csPath;
const wchar_t* pStart = pPath;
const wchar_t* pEnd = pPath + iLength;
wchar_t ch;
@@ -105,7 +105,7 @@
} else if (csPath.Compare(L".") == 0) {
pFind = (CFX_XMLNode*)this;
} else {
- CFX_WideString wsTag;
+ WideString wsTag;
CFX_XMLNode* pNode = m_pChild;
while (pNode) {
if (pNode->GetType() == FX_XMLNODE_Element) {
@@ -334,7 +334,7 @@
CFX_XMLNode* pNode = (CFX_XMLNode*)this;
switch (pNode->GetType()) {
case FX_XMLNODE_Instruction: {
- CFX_WideString ws;
+ WideString ws;
CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
@@ -347,13 +347,13 @@
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
} else {
ws.Format(L"<?%s", pInstruction->GetName().c_str());
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : pInstruction->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&");
wsValue.Replace(L"<", L"<");
wsValue.Replace(L">", L">");
@@ -365,28 +365,28 @@
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
for (auto target : pInstruction->GetTargetData()) {
ws = L" \"";
ws += target;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
ws = L"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
break;
}
case FX_XMLNODE_Element: {
- CFX_WideString ws;
+ WideString ws;
ws = L"<";
ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&");
wsValue.Replace(L"<", L"<");
wsValue.Replace(L">", L">");
@@ -398,11 +398,11 @@
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
if (pNode->m_pChild) {
ws = L"\n>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
pChild->SaveXMLNode(pXMLStream);
@@ -414,24 +414,24 @@
} else {
ws = L"\n/>";
}
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
+ WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&");
ws.Replace(L"<", L"<");
ws.Replace(L">", L">");
ws.Replace(L"\'", L"'");
ws.Replace(L"\"", L""");
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
+ WideString ws = L"<![CDATA[";
ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Unknown:
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index ce45481..280c06d 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -101,7 +101,7 @@
m_pParent = m_pChild;
if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 3) {
- CFX_WideString wsTag =
+ WideString wsTag =
static_cast<CFX_XMLElement*>(m_pChild)->GetLocalTagName();
if (wsTag == L"template") {
m_dwCheckStatus |= 0x01;
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 9746d78..f98b658 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -38,8 +38,8 @@
CFX_XMLNode* m_pParent;
CFX_XMLNode* m_pChild;
std::stack<CFX_XMLNode*> m_NodeStack;
- CFX_WideString m_ws1;
- CFX_WideString m_ws2;
+ WideString m_ws1;
+ WideString m_ws2;
FX_XmlSyntaxResult m_syntaxParserResult;
};
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index bbbc4f4..d559852 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -623,7 +623,7 @@
m_pCurrentBlock[m_iIndexInBlock++] = character;
m_BlockBuffer.IncrementDataLength();
if (m_iEntityStart > -1 && character == L';') {
- CFX_WideString csEntity = m_BlockBuffer.GetTextData(
+ WideString csEntity = m_BlockBuffer.GetTextData(
m_iEntityStart + 1,
m_BlockBuffer.GetDataLength() - 1 - m_iEntityStart - 1);
int32_t iLen = csEntity.GetLength();
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.h b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
index c59caba..d3f4bf2 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.h
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
@@ -50,27 +50,27 @@
int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; }
int32_t GetLastNodeNumber() const { return m_iLastNodeNum; }
- CFX_WideString GetTargetName() const {
+ WideString GetTargetName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTagName() const {
+ WideString GetTagName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetAttributeName() const {
+ WideString GetAttributeName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetAttributeValue() const {
+ WideString GetAttributeValue() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTextData() const {
+ WideString GetTextData() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTargetData() const {
+ WideString GetTargetData() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
diff --git a/core/fxcrt/xml/cfx_xmltext.cpp b/core/fxcrt/xml/cfx_xmltext.cpp
index 4c41fcd..83ad043 100644
--- a/core/fxcrt/xml/cfx_xmltext.cpp
+++ b/core/fxcrt/xml/cfx_xmltext.cpp
@@ -8,7 +8,7 @@
#include "third_party/base/ptr_util.h"
-CFX_XMLText::CFX_XMLText(const CFX_WideString& wsText)
+CFX_XMLText::CFX_XMLText(const WideString& wsText)
: CFX_XMLNode(), m_wsText(wsText) {}
CFX_XMLText::~CFX_XMLText() {}
diff --git a/core/fxcrt/xml/cfx_xmltext.h b/core/fxcrt/xml/cfx_xmltext.h
index 20fb858..e9f3585 100644
--- a/core/fxcrt/xml/cfx_xmltext.h
+++ b/core/fxcrt/xml/cfx_xmltext.h
@@ -14,18 +14,18 @@
class CFX_XMLText : public CFX_XMLNode {
public:
- explicit CFX_XMLText(const CFX_WideString& wsText);
+ explicit CFX_XMLText(const WideString& wsText);
~CFX_XMLText() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- CFX_WideString GetText() const { return m_wsText; }
- void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
+ WideString GetText() const { return m_wsText; }
+ void SetText(const WideString& wsText) { m_wsText = wsText; }
private:
- CFX_WideString m_wsText;
+ WideString m_wsText;
};
#endif // CORE_FXCRT_XML_CFX_XMLTEXT_H_
diff --git a/core/fxcrt/xml/cxml_attritem.cpp b/core/fxcrt/xml/cxml_attritem.cpp
index 8e55799..cbbf3f6 100644
--- a/core/fxcrt/xml/cxml_attritem.cpp
+++ b/core/fxcrt/xml/cxml_attritem.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/xml/cxml_attritem.h"
-bool CXML_AttrItem::Matches(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
+bool CXML_AttrItem::Matches(const ByteString& space,
+ const ByteString& name) const {
return (space.IsEmpty() || m_QSpaceName == space) && m_AttrName == name;
}
diff --git a/core/fxcrt/xml/cxml_attritem.h b/core/fxcrt/xml/cxml_attritem.h
index 63305e8..84d8295 100644
--- a/core/fxcrt/xml/cxml_attritem.h
+++ b/core/fxcrt/xml/cxml_attritem.h
@@ -11,11 +11,11 @@
class CXML_AttrItem {
public:
- bool Matches(const CFX_ByteString& space, const CFX_ByteString& name) const;
+ bool Matches(const ByteString& space, const ByteString& name) const;
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_AttrName;
- CFX_WideString m_Value;
+ ByteString m_QSpaceName;
+ ByteString m_AttrName;
+ WideString m_Value;
};
#endif // CORE_FXCRT_XML_CXML_ATTRITEM_H_
diff --git a/core/fxcrt/xml/cxml_attrmap.cpp b/core/fxcrt/xml/cxml_attrmap.cpp
index 8d226fe..733bbea 100644
--- a/core/fxcrt/xml/cxml_attrmap.cpp
+++ b/core/fxcrt/xml/cxml_attrmap.cpp
@@ -13,8 +13,8 @@
CXML_AttrMap::~CXML_AttrMap() {}
-const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
+const WideString* CXML_AttrMap::Lookup(const ByteString& space,
+ const ByteString& name) const {
if (!m_pMap)
return nullptr;
@@ -25,9 +25,9 @@
return nullptr;
}
-void CXML_AttrMap::SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value) {
+void CXML_AttrMap::SetAt(const ByteString& space,
+ const ByteString& name,
+ const WideString& value) {
if (!m_pMap)
m_pMap = pdfium::MakeUnique<std::vector<CXML_AttrItem>>();
@@ -38,7 +38,7 @@
}
}
- m_pMap->push_back({space, name, CFX_WideString(value)});
+ m_pMap->push_back({space, name, WideString(value)});
}
int CXML_AttrMap::GetSize() const {
diff --git a/core/fxcrt/xml/cxml_attrmap.h b/core/fxcrt/xml/cxml_attrmap.h
index 0a026d3..a09522b 100644
--- a/core/fxcrt/xml/cxml_attrmap.h
+++ b/core/fxcrt/xml/cxml_attrmap.h
@@ -18,14 +18,14 @@
CXML_AttrMap();
~CXML_AttrMap();
- const CFX_WideString* Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const;
+ const WideString* Lookup(const ByteString& space,
+ const ByteString& name) const;
int GetSize() const;
CXML_AttrItem& GetAt(int index) const;
- void SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value);
+ void SetAt(const ByteString& space,
+ const ByteString& name,
+ const WideString& value);
std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap;
};
diff --git a/core/fxcrt/xml/cxml_content.cpp b/core/fxcrt/xml/cxml_content.cpp
index fe0c185..a235009 100644
--- a/core/fxcrt/xml/cxml_content.cpp
+++ b/core/fxcrt/xml/cxml_content.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/xml/cxml_content.h"
-CXML_Content::CXML_Content(bool bCDATA, const CFX_WideStringC& content)
+CXML_Content::CXML_Content(bool bCDATA, const WideStringView& content)
: m_bCDATA(bCDATA), m_Content(content) {}
CXML_Content::~CXML_Content() {}
diff --git a/core/fxcrt/xml/cxml_content.h b/core/fxcrt/xml/cxml_content.h
index 641efe6..97c1abf 100644
--- a/core/fxcrt/xml/cxml_content.h
+++ b/core/fxcrt/xml/cxml_content.h
@@ -12,7 +12,7 @@
class CXML_Content : public CXML_Object {
public:
- CXML_Content(bool bCDATA, const CFX_WideStringC& content);
+ CXML_Content(bool bCDATA, const WideStringView& content);
~CXML_Content() override;
// CXML_Object:
@@ -20,7 +20,7 @@
const CXML_Content* AsContent() const override;
bool m_bCDATA;
- CFX_WideString m_Content;
+ WideString m_Content;
};
#endif // CORE_FXCRT_XML_CXML_CONTENT_H_
diff --git a/core/fxcrt/xml/cxml_element.cpp b/core/fxcrt/xml/cxml_element.cpp
index ec0a73b..42cbdec 100644
--- a/core/fxcrt/xml/cxml_element.cpp
+++ b/core/fxcrt/xml/cxml_element.cpp
@@ -19,8 +19,8 @@
}
CXML_Element::CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname)
+ const ByteStringView& qSpace,
+ const ByteStringView& tagname)
: m_pParent(pParent), m_QSpaceName(qSpace), m_TagName(tagname) {}
CXML_Element::~CXML_Element() {}
@@ -33,23 +33,22 @@
return this;
}
-CFX_ByteString CXML_Element::GetTagName(bool bQualified) const {
+ByteString CXML_Element::GetTagName(bool bQualified) const {
if (!bQualified || m_QSpaceName.IsEmpty()) {
return m_TagName;
}
- CFX_ByteString bsTag = m_QSpaceName;
+ ByteString bsTag = m_QSpaceName;
bsTag += ":";
bsTag += m_TagName;
return bsTag;
}
-CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const {
+ByteString CXML_Element::GetNamespace(bool bQualified) const {
return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName);
}
-CFX_ByteString CXML_Element::GetNamespaceURI(
- const CFX_ByteString& qName) const {
- const CFX_WideString* pwsSpace;
+ByteString CXML_Element::GetNamespaceURI(const ByteString& qName) const {
+ const WideString* pwsSpace;
const CXML_Element* pElement = this;
do {
if (qName.IsEmpty())
@@ -61,13 +60,13 @@
pElement = pElement->GetParent();
} while (pElement);
- return pwsSpace ? pwsSpace->UTF8Encode() : CFX_ByteString();
+ return pwsSpace ? pwsSpace->UTF8Encode() : ByteString();
}
void CXML_Element::GetAttrByIndex(int index,
- CFX_ByteString* space,
- CFX_ByteString* name,
- CFX_WideString* value) const {
+ ByteString* space,
+ ByteString* name,
+ WideString* value) const {
if (index < 0 || index >= m_AttrMap.GetSize())
return;
@@ -77,26 +76,26 @@
*value = item.m_Value;
}
-bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+bool CXML_Element::HasAttr(const ByteStringView& name) const {
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+ return !!m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName));
}
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+bool CXML_Element::GetAttrValue(const ByteStringView& name,
+ WideString& attribute) const {
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrValue(bsSpace, bsName, attribute);
}
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+bool CXML_Element::GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name,
+ WideString& attribute) const {
+ const WideString* pValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pValue)
return false;
@@ -104,13 +103,13 @@
return true;
}
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrInteger(const ByteStringView& name,
int& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+ const WideString* pwsValue =
+ m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName));
if (!pwsValue)
return false;
@@ -118,11 +117,11 @@
return true;
}
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name,
int& attribute) const {
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ const WideString* pwsValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pwsValue)
return false;
@@ -130,19 +129,19 @@
return true;
}
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrFloat(const ByteStringView& name,
float& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrFloat(bsSpace, bsName, attribute);
}
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name,
float& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ const WideString* pValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pValue)
return false;
@@ -150,8 +149,8 @@
return true;
}
-uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const {
+uint32_t CXML_Element::CountElements(const ByteStringView& space,
+ const ByteStringView& tag) const {
int count = 0;
for (const auto& pChild : m_Children) {
const CXML_Element* pKid = pChild->AsElement();
@@ -167,8 +166,8 @@
return index < m_Children.size() ? m_Children[index].get() : nullptr;
}
-CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
+CXML_Element* CXML_Element::GetElement(const ByteStringView& space,
+ const ByteStringView& tag,
int nth) const {
if (nth < 0)
return nullptr;
@@ -196,10 +195,10 @@
return 0xFFFFFFFF;
}
-void CXML_Element::SetTag(const CFX_ByteStringC& qTagName) {
+void CXML_Element::SetTag(const ByteStringView& qTagName) {
ASSERT(!qTagName.IsEmpty());
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
m_QSpaceName = bsSpace;
m_TagName = bsName;
diff --git a/core/fxcrt/xml/cxml_element.h b/core/fxcrt/xml/cxml_element.h
index a4b4b14..91ac731 100644
--- a/core/fxcrt/xml/cxml_element.h
+++ b/core/fxcrt/xml/cxml_element.h
@@ -18,85 +18,84 @@
static std::unique_ptr<CXML_Element> Parse(const void* pBuffer, size_t size);
CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname);
+ const ByteStringView& qSpace,
+ const ByteStringView& tagname);
~CXML_Element() override;
// CXML_Object:
CXML_Element* AsElement() override;
const CXML_Element* AsElement() const override;
- CFX_ByteString GetTagName(bool bQualified = false) const;
- CFX_ByteString GetNamespace(bool bQualified = false) const;
- CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const;
+ ByteString GetTagName(bool bQualified = false) const;
+ ByteString GetNamespace(bool bQualified = false) const;
+ ByteString GetNamespaceURI(const ByteString& qName) const;
const CXML_Element* GetParent() const { return m_pParent.Get(); }
uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
void GetAttrByIndex(int index,
- CFX_ByteString* space,
- CFX_ByteString* name,
- CFX_WideString* value) const;
- bool HasAttr(const CFX_ByteStringC& qName) const;
- bool GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const {
- CFX_WideString attr;
+ ByteString* space,
+ ByteString* name,
+ WideString* value) const;
+ bool HasAttr(const ByteStringView& qName) const;
+ bool GetAttrValue(const ByteStringView& name, WideString& attribute) const;
+ WideString GetAttrValue(const ByteStringView& name) const {
+ WideString attr;
GetAttrValue(name, attr);
return attr;
}
- bool GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
- CFX_WideString attr;
+ bool GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name,
+ WideString& attribute) const;
+ WideString GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name) const {
+ WideString attr;
GetAttrValue(space, name, attr);
return attr;
}
- bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& name) const {
+ bool GetAttrInteger(const ByteStringView& name, int& attribute) const;
+ int GetAttrInteger(const ByteStringView& name) const {
int attr = 0;
GetAttrInteger(name, attr);
return attr;
}
- bool GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+ bool GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name,
int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
+ int GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name) const {
int attr = 0;
GetAttrInteger(space, name, attr);
return attr;
}
- bool GetAttrFloat(const CFX_ByteStringC& name, float& attribute) const;
- float GetAttrFloat(const CFX_ByteStringC& name) const {
+ bool GetAttrFloat(const ByteStringView& name, float& attribute) const;
+ float GetAttrFloat(const ByteStringView& name) const {
float attr = 0;
GetAttrFloat(name, attr);
return attr;
}
- bool GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+ bool GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name,
float& attribute) const;
- float GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
+ float GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name) const {
float attr = 0;
GetAttrFloat(space, name, attr);
return attr;
}
uint32_t CountChildren() const { return m_Children.size(); }
- uint32_t CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const;
+ uint32_t CountElements(const ByteStringView& space,
+ const ByteStringView& tag) const;
CXML_Object* GetChild(uint32_t index) const;
- CXML_Element* GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
+ CXML_Element* GetElement(const ByteStringView& space,
+ const ByteStringView& tag,
int nth) const;
uint32_t FindElement(CXML_Element* pElement) const;
- void SetTag(const CFX_ByteStringC& qTagName);
+ void SetTag(const ByteStringView& qTagName);
void RemoveChild(uint32_t index);
private:
@@ -104,8 +103,8 @@
friend class CXML_Composer;
CFX_UnownedPtr<const CXML_Element> const m_pParent;
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_TagName;
+ ByteString m_QSpaceName;
+ ByteString m_TagName;
CXML_AttrMap m_AttrMap;
std::vector<std::unique_ptr<CXML_Object>> m_Children;
};
diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp
index 9679e2c..adf83c7 100644
--- a/core/fxcrt/xml/cxml_parser.cpp
+++ b/core/fxcrt/xml/cxml_parser.cpp
@@ -78,9 +78,9 @@
} // namespace
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName) {
+void FX_XML_SplitQualifiedName(const ByteStringView& bsFullName,
+ ByteStringView& bsSpace,
+ ByteStringView& bsName) {
if (bsFullName.IsEmpty())
return;
@@ -139,7 +139,7 @@
} while (ReadNextBlock());
}
-void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
+void CXML_Parser::GetName(ByteString* space, ByteString* name) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -149,7 +149,7 @@
while (m_dwIndex < m_dwBufferSize) {
uint8_t ch = m_pBuffer[m_dwIndex];
if (ch == ':') {
- *space = CFX_ByteString(buf);
+ *space = ByteString(buf);
buf.str("");
} else if (g_FXCRT_XML_IsNameChar(ch)) {
buf << static_cast<char>(ch);
@@ -162,10 +162,10 @@
if (m_dwIndex < m_dwBufferSize || IsEOF())
break;
} while (ReadNextBlock());
- *name = CFX_ByteString(buf);
+ *name = ByteString(buf);
}
-void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) {
+void CXML_Parser::SkipLiterals(const ByteStringView& str) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF()) {
return;
@@ -281,7 +281,7 @@
return code;
}
-void CXML_Parser::GetAttrValue(CFX_WideString& value) {
+void CXML_Parser::GetAttrValue(WideString& value) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -323,8 +323,8 @@
void CXML_Parser::GetTagName(bool bStartTag,
bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name) {
+ ByteString* space,
+ ByteString* name) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -389,18 +389,18 @@
if (IsEOF())
return nullptr;
- CFX_ByteString tag_name;
- CFX_ByteString tag_space;
+ ByteString tag_name;
+ ByteString tag_space;
bool bEndTag;
GetTagName(bStartTag, &bEndTag, &tag_space, &tag_name);
if (tag_name.IsEmpty() || bEndTag)
return nullptr;
auto pElement = pdfium::MakeUnique<CXML_Element>(
- pParent, tag_space.AsStringC(), tag_name.AsStringC());
+ pParent, tag_space.AsStringView(), tag_name.AsStringView());
do {
- CFX_ByteString attr_space;
- CFX_ByteString attr_name;
+ ByteString attr_space;
+ ByteString attr_name;
while (m_dwIndex < m_dwBufferSize) {
SkipWhiteSpaces();
if (IsEOF())
@@ -422,7 +422,7 @@
if (IsEOF())
break;
- CFX_WideString attr_value;
+ WideString attr_value;
GetAttrValue(attr_value);
pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value);
}
@@ -474,19 +474,20 @@
SkipWhiteSpaces();
iState = 0;
} else if (ch == '/') {
- CFX_ByteString space;
- CFX_ByteString name;
+ ByteString space;
+ ByteString name;
GetName(&space, &name);
SkipWhiteSpaces();
m_dwIndex++;
iState = 10;
} else {
content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
+ WideString dataStr = content.MakeString();
if (!bCDATA)
dataStr.TrimRight(L" \t\r\n");
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ InsertContentSegment(bCDATA, dataStr.AsStringView(),
+ pElement.get());
content.Clear();
decoder.Clear();
bCDATA = false;
@@ -524,10 +525,10 @@
break;
} while (ReadNextBlock());
content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
+ WideString dataStr = content.MakeString();
dataStr.TrimRight(L" \t\r\n");
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ InsertContentSegment(bCDATA, dataStr.AsStringView(), pElement.get());
content.Clear();
decoder.Clear();
bCDATA = false;
@@ -535,7 +536,7 @@
}
void CXML_Parser::InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
+ const WideStringView& content,
CXML_Element* pElement) {
if (content.IsEmpty())
return;
diff --git a/core/fxcrt/xml/cxml_parser.h b/core/fxcrt/xml/cxml_parser.h
index 33bd711..ee5a1b6 100644
--- a/core/fxcrt/xml/cxml_parser.h
+++ b/core/fxcrt/xml/cxml_parser.h
@@ -26,18 +26,18 @@
bool IsEOF();
bool HaveAvailData();
void SkipWhiteSpaces();
- void GetName(CFX_ByteString* space, CFX_ByteString* name);
- void GetAttrValue(CFX_WideString& value);
+ void GetName(ByteString* space, ByteString* name);
+ void GetAttrValue(WideString& value);
uint32_t GetCharRef();
void GetTagName(bool bStartTag,
bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name);
- void SkipLiterals(const CFX_ByteStringC& str);
+ ByteString* space,
+ ByteString* name);
+ void SkipLiterals(const ByteStringView& str);
std::unique_ptr<CXML_Element> ParseElement(CXML_Element* pParent,
bool bStartTag);
void InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
+ const WideStringView& content,
CXML_Element* pElement);
void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
@@ -54,8 +54,8 @@
size_t m_dwIndex;
};
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName);
+void FX_XML_SplitQualifiedName(const ByteStringView& bsFullName,
+ ByteStringView& bsSpace,
+ ByteStringView& bsName);
#endif // CORE_FXCRT_XML_CXML_PARSER_H_
diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index e00aa84..1ca0f57 100644
--- a/core/fxge/android/cfpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -41,15 +41,15 @@
return this;
}
-CFX_ByteString CFPF_SkiaFont::GetFamilyName() {
+ByteString CFPF_SkiaFont::GetFamilyName() {
if (!m_Face)
- return CFX_ByteString();
- return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
+ return ByteString();
+ return ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
-CFX_ByteString CFPF_SkiaFont::GetPsName() {
+ByteString CFPF_SkiaFont::GetPsName() {
if (!m_Face)
- return CFX_ByteString();
+ return ByteString();
return FXFT_Get_Postscript_Name(m_Face);
}
@@ -181,7 +181,7 @@
bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
+ const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset) {
if (!pFontMgr || !pFontDes)
diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index 5686e9e..c842d5a 100644
--- a/core/fxge/android/cfpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -22,8 +22,8 @@
void Release();
CFPF_SkiaFont* Retain();
- CFX_ByteString GetFamilyName();
- CFX_ByteString GetPsName();
+ ByteString GetFamilyName();
+ ByteString GetPsName();
uint32_t GetFontStyle() const { return m_dwStyle; }
uint8_t GetCharset() const { return m_uCharset; }
int32_t GetGlyphIndex(wchar_t wUnicode);
@@ -38,7 +38,7 @@
bool InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
+ const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset);
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 16a6df5..a50b9ea 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -158,7 +158,7 @@
return FPF_SKIACHARSET_Default;
}
-uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
+uint32_t FPF_SKIANormalizeFontName(const ByteStringView& bsfamily) {
uint32_t dwHash = 0;
int32_t iLength = bsfamily.GetLength();
const char* pBuffer = bsfamily.unterminated_c_str();
@@ -171,10 +171,10 @@
return dwHash;
}
-uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily,
+uint32_t FPF_SKIAGetFamilyHash(const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset) {
- CFX_ByteString bsFont(bsFamily);
+ ByteString bsFont(bsFamily);
if (dwStyle & FXFONT_BOLD)
bsFont += "Bold";
if (dwStyle & FXFONT_ITALIC)
@@ -191,14 +191,14 @@
(uCharset == FX_CHARSET_Hangul) || (uCharset == FX_CHARSET_ShiftJIS);
}
-bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) {
- CFX_ByteString bsName(bsFacename);
+bool FPF_SkiaMaybeSymbol(const ByteStringView& bsFacename) {
+ ByteString bsName(bsFacename);
bsName.MakeLower();
return bsName.Contains("symbol");
}
-bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) {
- CFX_ByteString bsName(bsFacename);
+bool FPF_SkiaMaybeArabic(const ByteStringView& bsFacename) {
+ ByteString bsName(bsFacename);
bsName.MakeLower();
return bsName.Contains("arabic");
}
@@ -280,7 +280,7 @@
m_bLoaded = true;
}
-CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
+CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle,
uint32_t dwMatch) {
@@ -387,7 +387,7 @@
return face;
}
-FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile,
+FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const ByteStringView& bsFile,
int32_t iFaceIndex) {
if (bsFile.IsEmpty())
return nullptr;
@@ -421,23 +421,23 @@
return face;
}
-void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteString& path) {
+void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) {
DIR* handle = FX_OpenFolder(path.c_str());
if (!handle)
return;
- CFX_ByteString filename;
+ ByteString filename;
bool bFolder = false;
while (FX_GetNextFile(handle, &filename, &bFolder)) {
if (bFolder) {
if (filename == "." || filename == "..")
continue;
} else {
- CFX_ByteString ext = filename.Right(4);
+ ByteString ext = filename.Right(4);
ext.MakeLower();
if (ext != ".ttf" && ext != ".ttc" && ext != ".otf")
continue;
}
- CFX_ByteString fullpath(path);
+ ByteString fullpath(path);
fullpath += "/";
fullpath += filename;
if (bFolder)
@@ -448,8 +448,8 @@
FX_CloseFolder(handle);
}
-void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteString& file) {
- FXFT_Face face = GetFontFace(file.AsStringC());
+void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) {
+ FXFT_Face face = GetFontFace(file.AsStringView());
if (!face)
return;
CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont;
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 4d0ea0e..78d0171 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -25,7 +25,7 @@
~CFPF_SkiaFontMgr();
void LoadSystemFonts();
- CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname,
+ CFPF_SkiaFont* CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle,
uint32_t dwMatch = 0);
@@ -33,14 +33,14 @@
bool InitFTLibrary();
FXFT_Face GetFontFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
int32_t iFaceIndex = 0);
- FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0);
+ FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0);
FXFT_Face GetFontFace(const uint8_t* pBuffer,
size_t szBuffer,
int32_t iFaceIndex = 0);
private:
- void ScanPath(const CFX_ByteString& path);
- void ScanFile(const CFX_ByteString& file);
+ void ScanPath(const ByteString& path);
+ void ScanFile(const ByteString& file);
void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
bool m_bLoaded;
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 1183cde..c6c3e61 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -63,7 +63,7 @@
return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
-bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_AndroidFontInfo::GetFaceName(void* hFont, ByteString* name) {
if (!hFont)
return false;
diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h
index 17bbf89..3fde349 100644
--- a/core/fxge/android/cfx_androidfontinfo.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -35,7 +35,7 @@
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 2eee8e2..6379847 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -51,7 +51,7 @@
const char JAPAN_GOTHIC[] = "Hiragino Kaku Gothic Pro W6";
const char JAPAN_MINCHO[] = "Hiragino Mincho Pro W6";
-void GetJapanesePreference(CFX_ByteString* face, int weight, int pitch_family) {
+void GetJapanesePreference(ByteString* face, int weight, int pitch_family) {
if (face->Contains("Gothic")) {
*face = JAPAN_GOTHIC;
return;
@@ -66,9 +66,9 @@
int pitch_family,
const char* cstr_face,
int& iExact) {
- CFX_ByteString face = cstr_face;
+ ByteString face = cstr_face;
for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) {
- if (face == CFX_ByteStringC(g_Base14Substs[i].m_pName)) {
+ if (face == ByteStringView(g_Base14Substs[i].m_pName)) {
face = g_Base14Substs[i].m_pSubstName;
iExact = true;
return GetFont(face.c_str());
@@ -83,7 +83,7 @@
// fonts in |m_FontList| with |face| in the name, and examine the fonts to
// see which best matches the requested characteristics.
if (!face.Contains("Bold") && !face.Contains("Italic")) {
- CFX_ByteString new_face = face;
+ ByteString new_face = face;
if (weight > 400)
new_face += " Bold";
if (bItalic)
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index eac2807..74b38ef 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -299,7 +299,7 @@
}
}
#endif
- CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \
defined _SKIA_SUPPORT_PATHS_
return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index,
@@ -344,7 +344,7 @@
keygen.Generate(6, nMatrixA, nMatrixB, nMatrixC, nMatrixD, dest_width,
anti_alias);
}
- CFX_ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
text_flags |= FXTEXT_NO_NATIVETEXT;
return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index,
bFontStyle, dest_width, anti_alias);
@@ -375,7 +375,7 @@
CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(
const CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& FaceGlyphsKey,
+ const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
int dest_width,
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index 076ba1f..58b08ed 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -52,7 +52,7 @@
int anti_alias);
CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& FaceGlyphsKey,
+ const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
int dest_width,
@@ -61,7 +61,7 @@
void DestroyPlatform();
FXFT_Face const m_Face;
- std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap;
+ std::map<ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap;
std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap;
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
sk_sp<SkTypeface> m_pTypeface;
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index f4f57e4..0dc61c9 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -36,18 +36,18 @@
{"Times-Italic", "Times New Roman Italic"},
};
-CFX_ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
- CFX_ByteString buffer;
+ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
+ ByteString buffer;
if (!fread(buffer.GetBuffer(size), size, 1, pFile))
- return CFX_ByteString();
+ return ByteString();
buffer.ReleaseBuffer(size);
return buffer;
}
-CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
- const uint8_t* pTables,
- uint32_t nTables,
- uint32_t tag) {
+ByteString FPDF_LoadTableFromTT(FILE* pFile,
+ const uint8_t* pTables,
+ uint32_t nTables,
+ uint32_t tag) {
for (uint32_t i = 0; i < nTables; i++) {
const uint8_t* p = pTables + i * 16;
if (GET_TT_LONG(p) == tag) {
@@ -57,7 +57,7 @@
return FPDF_ReadStringFromFile(pFile, size);
}
}
- return CFX_ByteString();
+ return ByteString();
}
uint32_t GetCharset(int charset) {
@@ -106,7 +106,7 @@
CFX_FolderFontInfo::~CFX_FolderFontInfo() {}
-void CFX_FolderFontInfo::AddPath(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::AddPath(const ByteString& path) {
m_PathList.push_back(path);
}
@@ -117,25 +117,25 @@
return true;
}
-void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::ScanPath(const ByteString& path) {
FX_FileHandle* handle = FX_OpenFolder(path.c_str());
if (!handle)
return;
- CFX_ByteString filename;
+ ByteString filename;
bool bFolder;
while (FX_GetNextFile(handle, &filename, &bFolder)) {
if (bFolder) {
if (filename == "." || filename == "..")
continue;
} else {
- CFX_ByteString ext = filename.Right(4);
+ ByteString ext = filename.Right(4);
ext.MakeUpper();
if (ext != ".TTF" && ext != ".OTF" && ext != ".TTC")
continue;
}
- CFX_ByteString fullpath = path;
+ ByteString fullpath = path;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
fullpath += "\\";
#else
@@ -148,7 +148,7 @@
FX_CloseFolder(handle);
}
-void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::ScanFile(const ByteString& path) {
FILE* pFile = fopen(path.c_str(), "rb");
if (!pFile)
return;
@@ -190,7 +190,7 @@
fclose(pFile);
}
-void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
+void CFX_FolderFontInfo::ReportFace(const ByteString& path,
FILE* pFile,
uint32_t filesize,
uint32_t offset) {
@@ -200,21 +200,20 @@
return;
uint32_t nTables = GET_TT_SHORT(buffer + 4);
- CFX_ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16);
+ ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16);
if (tables.IsEmpty())
return;
- CFX_ByteString names =
+ ByteString names =
FPDF_LoadTableFromTT(pFile, tables.raw_str(), nTables, 0x6e616d65);
if (names.IsEmpty())
return;
- CFX_ByteString facename =
- GetNameFromTT(names.raw_str(), names.GetLength(), 1);
+ ByteString facename = GetNameFromTT(names.raw_str(), names.GetLength(), 1);
if (facename.IsEmpty())
return;
- CFX_ByteString style = GetNameFromTT(names.raw_str(), names.GetLength(), 2);
+ ByteString style = GetNameFromTT(names.raw_str(), names.GetLength(), 2);
if (style != "Regular")
facename += " " + style;
@@ -223,7 +222,7 @@
auto pInfo = pdfium::MakeUnique<CFX_FontFaceInfo>(path, facename, tables,
offset, filesize);
- CFX_ByteString os2 =
+ ByteString os2 =
FPDF_LoadTableFromTT(pFile, tables.raw_str(), nTables, 0x4f532f32);
if (os2.GetLength() >= 86) {
const uint8_t* p = os2.raw_str() + 78;
@@ -262,7 +261,7 @@
m_FontList[facename] = std::move(pInfo);
}
-void* CFX_FolderFontInfo::GetSubstFont(const CFX_ByteString& face) {
+void* CFX_FolderFontInfo::GetSubstFont(const ByteString& face) {
for (size_t iBaseFont = 0; iBaseFont < FX_ArraySize(Base14Substs);
iBaseFont++) {
if (face == Base14Substs[iBaseFont].m_pName)
@@ -284,7 +283,7 @@
uint32_t charset_flag = GetCharset(charset);
int32_t iBestSimilar = 0;
for (const auto& it : m_FontList) {
- const CFX_ByteString& bsName = it.first;
+ const ByteString& bsName = it.first;
CFX_FontFaceInfo* pFont = it.second.get();
if (!(pFont->m_Charsets & charset_flag) && charset != FX_CHARSET_Default)
continue;
@@ -367,7 +366,7 @@
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
-bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_FolderFontInfo::GetFaceName(void* hFont, ByteString* name) {
if (!hFont)
return false;
*name = static_cast<CFX_FontFaceInfo*>(hFont)->m_FaceName;
diff --git a/core/fxge/cfx_folderfontinfo.h b/core/fxge/cfx_folderfontinfo.h
index 82ed902..e7c3f21 100644
--- a/core/fxge/cfx_folderfontinfo.h
+++ b/core/fxge/cfx_folderfontinfo.h
@@ -21,7 +21,7 @@
CFX_FolderFontInfo();
~CFX_FolderFontInfo() override;
- void AddPath(const CFX_ByteString& path);
+ void AddPath(const ByteString& path);
// IFX_SytemFontInfo:
bool EnumFontList(CFX_FontMapper* pMapper) override;
@@ -43,17 +43,17 @@
uint8_t* buffer,
uint32_t size) override;
void DeleteFont(void* hFont) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
protected:
- void ScanPath(const CFX_ByteString& path);
- void ScanFile(const CFX_ByteString& path);
- void ReportFace(const CFX_ByteString& path,
+ void ScanPath(const ByteString& path);
+ void ScanFile(const ByteString& path);
+ void ReportFace(const ByteString& path,
FILE* pFile,
uint32_t filesize,
uint32_t offset);
- void* GetSubstFont(const CFX_ByteString& face);
+ void* GetSubstFont(const ByteString& face);
void* FindFont(int weight,
bool bItalic,
int charset,
@@ -61,8 +61,8 @@
const char* family,
bool bMatchName);
- std::map<CFX_ByteString, std::unique_ptr<CFX_FontFaceInfo>> m_FontList;
- std::vector<CFX_ByteString> m_PathList;
+ std::map<ByteString, std::unique_ptr<CFX_FontFaceInfo>> m_FontList;
+ std::vector<ByteString> m_PathList;
CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
};
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 7a51df1..017b120 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -291,7 +291,7 @@
m_Face = nullptr;
}
-void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
+void CFX_Font::LoadSubst(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -446,7 +446,7 @@
if (FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC)
return true;
- CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face));
+ ByteString str(FXFT_Get_Face_Style_Name(m_Face));
str.MakeLower();
return str.Contains("italic");
}
@@ -459,31 +459,31 @@
return m_Face && FXFT_Is_Face_fixedwidth(m_Face) != 0;
}
-CFX_ByteString CFX_Font::GetPsName() const {
+ByteString CFX_Font::GetPsName() const {
if (!m_Face)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString psName = FXFT_Get_Postscript_Name(m_Face);
+ ByteString psName = FXFT_Get_Postscript_Name(m_Face);
if (psName.IsEmpty())
psName = "Untitled";
return psName;
}
-CFX_ByteString CFX_Font::GetFamilyName() const {
+ByteString CFX_Font::GetFamilyName() const {
if (!m_Face && !m_pSubstFont)
- return CFX_ByteString();
+ return ByteString();
if (m_Face)
- return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
+ return ByteString(FXFT_Get_Face_Family_Name(m_Face));
return m_pSubstFont->m_Family;
}
-CFX_ByteString CFX_Font::GetFaceName() const {
+ByteString CFX_Font::GetFaceName() const {
if (!m_Face && !m_pSubstFont)
- return CFX_ByteString();
+ return ByteString();
if (m_Face) {
- CFX_ByteString style = CFX_ByteString(FXFT_Get_Face_Style_Name(m_Face));
- CFX_ByteString facename = GetFamilyName();
+ ByteString style = ByteString(FXFT_Get_Face_Style_Name(m_Face));
+ ByteString facename = GetFamilyName();
if (facename.IsEmpty())
facename = "Untitled";
if (!style.IsEmpty() && style != "Regular")
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index bff9fad..4e26c62 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -170,7 +170,7 @@
};
int CompareFontFamilyString(const void* key, const void* element) {
- CFX_ByteString str_key((const char*)key);
+ ByteString str_key((const char*)key);
const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element);
if (str_key.Contains(family->m_pFontName))
return 0;
@@ -182,8 +182,8 @@
reinterpret_cast<const AltFontName*>(element)->m_pName);
}
-CFX_ByteString TT_NormalizeName(const char* family) {
- CFX_ByteString norm(family);
+ByteString TT_NormalizeName(const char* family) {
+ ByteString norm(family);
norm.Remove(' ');
norm.Remove('-');
norm.Remove(',');
@@ -207,7 +207,7 @@
return FX_CHARSET_Default;
}
-CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
+ByteString GetFontFamily(ByteString fontName, int nStyle) {
if (fontName.Contains("Script")) {
if ((nStyle & FX_FONT_STYLE_Bold) == FX_FONT_STYLE_Bold)
fontName = "ScriptMTBold";
@@ -222,23 +222,23 @@
AltFontFamily* found = reinterpret_cast<AltFontFamily*>(bsearch(
fontName.c_str(), g_AltFontFamilies, FX_ArraySize(g_AltFontFamilies),
sizeof(AltFontFamily), CompareFontFamilyString));
- return found ? CFX_ByteString(found->m_pFontFamily) : fontName;
+ return found ? ByteString(found->m_pFontFamily) : fontName;
}
-CFX_ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) {
+ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) {
std::ostringstream buf;
if (!iLen || iLen <= iIndex)
- return CFX_ByteString(buf);
+ return ByteString(buf);
while (iIndex < iLen) {
if (pStyle[iIndex] == ',')
break;
buf << pStyle[iIndex];
++iIndex;
}
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-int32_t GetStyleType(const CFX_ByteString& bsStyle, bool bReverse) {
+int32_t GetStyleType(const ByteString& bsStyle, bool bReverse) {
int32_t iLen = bsStyle.GetLength();
if (!iLen)
return -1;
@@ -260,7 +260,7 @@
return -1;
}
-bool CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
+bool CheckSupportThirdPartFont(ByteString name, int& PitchFamily) {
if (name == "MyriadPro") {
PitchFamily &= ~FXFONT_FF_ROMAN;
return true;
@@ -305,23 +305,23 @@
m_pFontInfo = std::move(pFontInfo);
}
-CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
+ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
if (!m_pFontInfo)
- return CFX_ByteString();
+ return ByteString();
uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0);
if (!size)
- return CFX_ByteString();
+ return ByteString();
std::vector<uint8_t> buffer(size);
uint8_t* buffer_ptr = buffer.data();
uint32_t bytes_read =
m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size);
return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6)
- : CFX_ByteString();
+ : ByteString();
}
-void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
+void CFX_FontMapper::AddInstalledFont(const ByteString& name, int charset) {
if (!m_pFontInfo)
return;
@@ -343,7 +343,7 @@
return;
}
- CFX_ByteString new_name = GetPSNameFromTT(hFont);
+ ByteString new_name = GetPSNameFromTT(hFont);
if (!new_name.IsEmpty())
m_LocalizedTTFonts.push_back(std::make_pair(new_name, name));
m_pFontInfo->DeleteFont(hFont);
@@ -360,22 +360,20 @@
m_bListLoaded = true;
}
-CFX_ByteString CFX_FontMapper::MatchInstalledFonts(
- const CFX_ByteString& norm_name) {
+ByteString CFX_FontMapper::MatchInstalledFonts(const ByteString& norm_name) {
LoadInstalledFonts();
int i;
for (i = pdfium::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) {
- CFX_ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
+ ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
if (norm1 == norm_name)
return m_InstalledTTFonts[i];
}
for (i = pdfium::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) {
- CFX_ByteString norm1 =
- TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
+ ByteString norm1 = TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
if (norm1 == norm_name)
return m_LocalizedTTFonts[i].second;
}
- return CFX_ByteString();
+ return ByteString();
}
FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
@@ -418,7 +416,7 @@
return m_MMFaces[0];
}
-FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
+FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -429,7 +427,7 @@
weight = FXFONT_FW_NORMAL;
italic_angle = 0;
}
- CFX_ByteString SubstName = name;
+ ByteString SubstName = name;
SubstName.Remove(' ');
if (bTrueType && name.GetLength() > 0 && name[0] == '@')
SubstName = name.Right(name.GetLength() - 1);
@@ -445,8 +443,8 @@
return UseInternalSubst(pSubstFont, 13, italic_angle, weight, 0);
}
int iBaseFont = 0;
- CFX_ByteString family;
- CFX_ByteString style;
+ ByteString family;
+ ByteString style;
bool bHasComma = false;
bool bHasHyphen = false;
auto pos = SubstName.Find(",", 0);
@@ -459,7 +457,7 @@
family = SubstName;
}
for (; iBaseFont < 12; iBaseFont++) {
- if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont]))
+ if (family == ByteStringView(g_Base14FontNames[iBaseFont]))
break;
}
int PitchFamily = 0;
@@ -505,7 +503,7 @@
const char* pStyle = style.c_str();
int i = 0;
bool bFirstItem = true;
- CFX_ByteString buf;
+ ByteString buf;
while (i < nLen) {
buf = ParseStyle(pStyle, nLen, i);
int32_t nRet = GetStyleType(buf, false);
@@ -568,7 +566,7 @@
PitchFamily);
}
family = GetFontFamily(family, nStyle);
- CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str()));
+ ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str()));
if (match.IsEmpty() && family != SubstName &&
(!bHasComma && (!bHasHyphen || (bHasHyphen && !bStyleAvail)))) {
match = MatchInstalledFonts(TT_NormalizeName(SubstName.c_str()));
@@ -742,7 +740,7 @@
if (ttc_size) {
face = GetCachedTTCFace(hFont, 0x74746366, ttc_size, font_size);
} else {
- CFX_ByteString SubstName;
+ ByteString SubstName;
m_pFontInfo->GetFaceName(hFont, &SubstName);
face = GetCachedFace(hFont, SubstName, weight, bItalic, font_size);
}
@@ -791,7 +789,7 @@
}
FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
- CFX_ByteString SubstName,
+ ByteString SubstName,
int weight,
bool bItalic,
uint32_t font_size) {
@@ -808,7 +806,7 @@
return face;
}
-int PDF_GetStandardFontName(CFX_ByteString* name) {
+int PDF_GetStandardFontName(ByteString* name) {
AltFontName* found = static_cast<AltFontName*>(
bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
sizeof(AltFontName), CompareString));
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index 1b262bf..3f28c73 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -23,10 +23,10 @@
void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); }
- void AddInstalledFont(const CFX_ByteString& name, int charset);
+ void AddInstalledFont(const ByteString& name, int charset);
void LoadInstalledFonts();
- FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
+ FXFT_Face FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -41,19 +41,17 @@
#endif // PDF_ENABLE_XFA
bool IsBuiltinFace(const FXFT_Face face) const;
int GetFaceSize() const;
- CFX_ByteString GetFaceName(int index) const {
- return m_FaceArray[index].name;
- }
+ ByteString GetFaceName(int index) const { return m_FaceArray[index].name; }
- std::vector<CFX_ByteString> m_InstalledTTFonts;
- std::vector<std::pair<CFX_ByteString, CFX_ByteString>> m_LocalizedTTFonts;
+ std::vector<ByteString> m_InstalledTTFonts;
+ std::vector<std::pair<ByteString, ByteString>> m_LocalizedTTFonts;
private:
static const size_t MM_FACE_COUNT = 2;
static const size_t FOXIT_FACE_COUNT = 14;
- CFX_ByteString GetPSNameFromTT(void* hFont);
- CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name);
+ ByteString GetPSNameFromTT(void* hFont);
+ ByteString MatchInstalledFonts(const ByteString& norm_name);
FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont,
int iBaseFont,
int italic_angle,
@@ -64,19 +62,19 @@
uint32_t ttc_size,
uint32_t font_size);
FXFT_Face GetCachedFace(void* hFont,
- CFX_ByteString SubstName,
+ ByteString SubstName,
int weight,
bool bItalic,
uint32_t font_size);
struct FaceData {
- CFX_ByteString name;
+ ByteString name;
uint32_t charset;
};
bool m_bListLoaded;
FXFT_Face m_MMFaces[MM_FACE_COUNT];
- CFX_ByteString m_LastFamily;
+ ByteString m_LastFamily;
std::vector<FaceData> m_FaceArray;
std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo;
FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT];
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index c8beb51..f68598e 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -46,18 +46,18 @@
{g_FoxitSansMMFontData, 66919},
};
-CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name,
- int weight,
- bool bItalic) {
- CFX_ByteString key(face_name);
+ByteString KeyNameFromFace(const ByteString& face_name,
+ int weight,
+ bool bItalic) {
+ ByteString key(face_name);
key += ',';
- key += CFX_ByteString::FormatInteger(weight);
+ key += ByteString::FormatInteger(weight);
key += bItalic ? 'I' : 'N';
return key;
}
-CFX_ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) {
- CFX_ByteString key;
+ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) {
+ ByteString key;
key.Format("%d:%d", ttc_size, checksum);
return key;
}
@@ -110,7 +110,7 @@
m_pBuiltinMapper->SetSystemFontInfo(std::move(pFontInfo));
}
-FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -122,7 +122,7 @@
italic_angle, CharsetCP, pSubstFont);
}
-FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::GetCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t*& pFontData) {
@@ -136,7 +136,7 @@
return pFontDesc->m_SingleFace;
}
-FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::AddCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t* pData,
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 7ccad80..eddb1ef 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -24,11 +24,11 @@
void InitFTLibrary();
- FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
+ FXFT_Face GetCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t*& pFontData);
- FXFT_Face AddCachedFace(const CFX_ByteString& face_name,
+ FXFT_Face AddCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t* pData,
@@ -47,7 +47,7 @@
FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index);
void ReleaseFace(FXFT_Face face);
void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
- FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
+ FXFT_Face FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -61,7 +61,7 @@
private:
std::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
- std::map<CFX_ByteString, std::unique_ptr<CTTFontDesc>> m_FaceMap;
+ std::map<ByteString, std::unique_ptr<CTTFontDesc>> m_FaceMap;
FXFT_Library m_FTLibrary;
bool m_FTLibrarySupportsHinting;
};
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 959c909..5e9f5ae 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -336,7 +336,7 @@
if (text_flags & FXFONT_CIDFONT)
return false;
- const CFX_ByteString bsPsName = pFont->GetPsName();
+ const ByteString bsPsName = pFont->GetPsName();
if (bsPsName.Contains("+ZJHL"))
return false;
diff --git a/core/fxge/cfx_substfont.h b/core/fxge/cfx_substfont.h
index 01196d4..5225bd3 100644
--- a/core/fxge/cfx_substfont.h
+++ b/core/fxge/cfx_substfont.h
@@ -16,7 +16,7 @@
public:
CFX_SubstFont();
- CFX_ByteString m_Family;
+ ByteString m_Family;
int m_Charset;
uint32_t m_SubstFlags;
int m_Weight;
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 57fdb54..021efee 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -87,7 +87,7 @@
CFX_Font();
~CFX_Font();
- void LoadSubst(const CFX_ByteString& face_name,
+ void LoadSubst(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -130,9 +130,9 @@
bool IsBold() const;
bool IsFixedWidth() const;
bool IsVertical() const { return m_bVertical; }
- CFX_ByteString GetPsName() const;
- CFX_ByteString GetFamilyName() const;
- CFX_ByteString GetFaceName() const;
+ ByteString GetPsName() const;
+ ByteString GetFamilyName() const;
+ ByteString GetFaceName() const;
bool IsTTFont() const;
bool GetBBox(FX_RECT& bbox);
bool IsEmbedded() const { return m_bEmbedded; }
@@ -183,15 +183,15 @@
class CFX_FontFaceInfo {
public:
- CFX_FontFaceInfo(CFX_ByteString filePath,
- CFX_ByteString faceName,
- CFX_ByteString fontTables,
+ CFX_FontFaceInfo(ByteString filePath,
+ ByteString faceName,
+ ByteString fontTables,
uint32_t fontOffset,
uint32_t fileSize);
- const CFX_ByteString m_FilePath;
- const CFX_ByteString m_FaceName;
- const CFX_ByteString m_FontTables;
+ const ByteString m_FilePath;
+ const ByteString m_FaceName;
+ const ByteString m_FontTables;
const uint32_t m_FontOffset;
const uint32_t m_FileSize;
uint32_t m_Styles;
@@ -229,10 +229,10 @@
float retinaScaleX,
float retinaScaleY);
-CFX_ByteString GetNameFromTT(const uint8_t* name_table,
- uint32_t name_table_size,
- uint32_t name);
+ByteString GetNameFromTT(const uint8_t* name_table,
+ uint32_t name_table_size,
+ uint32_t name);
-int PDF_GetStandardFontName(CFX_ByteString* name);
+int PDF_GetStandardFontName(ByteString* name);
#endif // CORE_FXGE_FX_FONT_H_
diff --git a/core/fxge/fx_ge_fontmap.cpp b/core/fxge/fx_ge_fontmap.cpp
index 7ac4fad..0f27038 100644
--- a/core/fxge/fx_ge_fontmap.cpp
+++ b/core/fxge/fx_ge_fontmap.cpp
@@ -9,28 +9,28 @@
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/ifx_systemfontinfo.h"
-static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
- uint32_t string_ptr_length,
- uint16_t offset,
- uint16_t length) {
+static ByteString GetStringFromTable(const uint8_t* string_ptr,
+ uint32_t string_ptr_length,
+ uint16_t offset,
+ uint16_t length) {
if (string_ptr_length < static_cast<uint32_t>(offset + length)) {
- return CFX_ByteString();
+ return ByteString();
}
- return CFX_ByteString(string_ptr + offset, length);
+ return ByteString(string_ptr + offset, length);
}
-CFX_ByteString GetNameFromTT(const uint8_t* name_table,
- uint32_t name_table_size,
- uint32_t name_id) {
+ByteString GetNameFromTT(const uint8_t* name_table,
+ uint32_t name_table_size,
+ uint32_t name_id) {
if (!name_table || name_table_size < 6) {
- return CFX_ByteString();
+ return ByteString();
}
uint32_t name_count = GET_TT_SHORT(name_table + 2);
uint32_t string_offset = GET_TT_SHORT(name_table + 4);
// We will ignore the possibility of overlap of structures and
// string table as if it's all corrupt there's not a lot we can do.
if (name_table_size < string_offset) {
- return CFX_ByteString();
+ return ByteString();
}
const uint8_t* string_ptr = name_table + string_offset;
@@ -38,7 +38,7 @@
name_table += 6;
name_table_size -= 6;
if (name_table_size < name_count * 12) {
- return CFX_ByteString();
+ return ByteString();
}
for (uint32_t i = 0; i < name_count; i++, name_table += 12) {
@@ -49,7 +49,7 @@
GET_TT_SHORT(name_table + 8));
}
}
- return CFX_ByteString();
+ return ByteString();
}
#ifdef PDF_ENABLE_XFA
void* IFX_SystemFontInfo::MapFontByUnicode(uint32_t dwUnicode,
@@ -79,9 +79,9 @@
}
#endif
-CFX_FontFaceInfo::CFX_FontFaceInfo(CFX_ByteString filePath,
- CFX_ByteString faceName,
- CFX_ByteString fontTables,
+CFX_FontFaceInfo::CFX_FontFaceInfo(ByteString filePath,
+ ByteString faceName,
+ ByteString fontTables,
uint32_t fontOffset,
uint32_t fileSize)
: m_FilePath(filePath),
diff --git a/core/fxge/fx_ge_linux.cpp b/core/fxge/fx_ge_linux.cpp
index d17ddf2..650510f 100644
--- a/core/fxge/fx_ge_linux.cpp
+++ b/core/fxge/fx_ge_linux.cpp
@@ -44,7 +44,7 @@
size_t GetJapanesePreference(const char* facearr,
int weight,
int pitch_family) {
- CFX_ByteString face = facearr;
+ ByteString face = facearr;
if (face.Contains("Gothic") ||
face.Contains("\x83\x53\x83\x56\x83\x62\x83\x4e")) {
if (face.Contains("PGothic") ||
diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h
index ca7ca2c..cb85f7f 100644
--- a/core/fxge/ifx_systemfontinfo.h
+++ b/core/fxge/ifx_systemfontinfo.h
@@ -42,7 +42,7 @@
uint32_t table,
uint8_t* buffer,
uint32_t size) = 0;
- virtual bool GetFaceName(void* hFont, CFX_ByteString* name) = 0;
+ virtual bool GetFaceName(void* hFont, ByteString* name) = 0;
virtual bool GetFontCharset(void* hFont, int* charset) = 0;
virtual int GetFaceIndex(void* hFont);
virtual void DeleteFont(void* hFont) = 0;
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index c02058d..5586d9f 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -669,9 +669,9 @@
last_fontnum = ps_fontnum;
}
buf << pCharPos[i].m_Origin.x << " " << pCharPos[i].m_Origin.y << " m";
- CFX_ByteString hex;
+ ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex.AsStringC() << "Tj\n";
+ buf << hex.AsStringView() << "Tj\n";
}
buf << "Q\n";
m_pStream->WriteBlock(buf.str().c_str(), buf.tellp());
diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h
index 3ecbb58..28f152a 100644
--- a/core/fxge/win32/cfx_windowsdib.h
+++ b/core/fxge/win32/cfx_windowsdib.h
@@ -33,8 +33,7 @@
~CFX_WindowsDIB() override;
- static CFX_ByteString GetBitmapInfo(
- const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
+ static ByteString GetBitmapInfo(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
HDC hDC);
diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp
index 1af6dbd..83f2fc0 100644
--- a/core/fxge/win32/cpsoutput.cpp
+++ b/core/fxge/win32/cpsoutput.cpp
@@ -31,6 +31,6 @@
return true;
}
-bool CPSOutput::WriteString(const CFX_ByteStringC& str) {
+bool CPSOutput::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
diff --git a/core/fxge/win32/cpsoutput.h b/core/fxge/win32/cpsoutput.h
index 42ad109..d140de9 100644
--- a/core/fxge/win32/cpsoutput.h
+++ b/core/fxge/win32/cpsoutput.h
@@ -19,7 +19,7 @@
// IFX_Writestream
bool WriteBlock(const void* str, size_t len) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
private:
HDC m_hDC;
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9c8da59..bb7bf6f 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -73,7 +73,7 @@
{"MS Gothic", "Jun101-Light"},
};
-bool GetSubFontName(CFX_ByteString* name) {
+bool GetSubFontName(ByteString* name) {
for (size_t i = 0; i < FX_ArraySize(g_JpFontNameMap); ++i) {
if (!FXSYS_stricmp(name->c_str(), g_JpFontNameMap[i].m_pSrcFontName)) {
*name = g_JpFontNameMap[i].m_pSubFontName;
@@ -349,23 +349,21 @@
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
bool IsOpenTypeFromDiv(const LOGFONTA* plf);
bool IsSupportFontFormDiv(const LOGFONTA* plf);
void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType);
- void GetGBPreference(CFX_ByteString& face, int weight, int picth_family);
- void GetJapanesePreference(CFX_ByteString& face,
- int weight,
- int picth_family);
- CFX_ByteString FindFont(const CFX_ByteString& name);
+ void GetGBPreference(ByteString& face, int weight, int picth_family);
+ void GetJapanesePreference(ByteString& face, int weight, int picth_family);
+ ByteString FindFont(const ByteString& name);
HDC m_hDC;
CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
- CFX_ByteString m_LastFamily;
- CFX_ByteString m_KaiTi, m_FangSong;
+ ByteString m_LastFamily;
+ ByteString m_KaiTi, m_FangSong;
};
int CALLBACK FontEnumProc(const LOGFONTA* plf,
@@ -429,7 +427,7 @@
void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
uint32_t FontType) {
- CFX_ByteString name(plf->lfFaceName);
+ ByteString name(plf->lfFaceName);
if (name.GetLength() > 0 && name[0] == '@')
return;
@@ -458,21 +456,21 @@
return true;
}
-CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) {
+ByteString CFX_Win32FontInfo::FindFont(const ByteString& name) {
if (!m_pMapper)
return name;
for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) {
- CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
+ ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
if (thisname.Left(name.GetLength()) == name)
return m_pMapper->m_InstalledTTFonts[i];
}
for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) {
- CFX_ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
+ ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
if (thisname.Left(name.GetLength()) == name)
return m_pMapper->m_LocalizedTTFonts[i].second;
}
- return CFX_ByteString();
+ return ByteString();
}
void* CFX_Win32FallbackFontInfo::MapFont(int weight,
@@ -500,7 +498,7 @@
return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK);
}
-void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face,
+void CFX_Win32FontInfo::GetGBPreference(ByteString& face,
int weight,
int picth_family) {
if (face.Contains("KaiTi") || face.Contains("\xbf\xac")) {
@@ -530,7 +528,7 @@
}
}
-void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face,
+void CFX_Win32FontInfo::GetJapanesePreference(ByteString& face,
int weight,
int picth_family) {
if (face.Contains("Gothic") ||
@@ -573,10 +571,10 @@
int pitch_family,
const char* cstr_face,
int& iExact) {
- CFX_ByteString face = cstr_face;
+ ByteString face = cstr_face;
int iBaseFont;
for (iBaseFont = 0; iBaseFont < 12; iBaseFont++)
- if (face == CFX_ByteStringC(g_Base14Substs[iBaseFont].m_pName)) {
+ if (face == ByteStringView(g_Base14Substs[iBaseFont].m_pName)) {
face = g_Base14Substs[iBaseFont].m_pWinName;
weight = g_Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL;
bItalic = g_Base14Substs[iBaseFont].m_bItalic;
@@ -607,15 +605,15 @@
if (face.EqualNoCase(facebuf))
return hFont;
- CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf);
+ WideString wsFace = WideString::FromLocal(facebuf);
for (size_t i = 0; i < FX_ArraySize(g_VariantNames); ++i) {
if (face != g_VariantNames[i].m_pFaceName)
continue;
const unsigned short* pName = reinterpret_cast<const unsigned short*>(
g_VariantNames[i].m_pVariantName);
- FX_STRSIZE len = CFX_WideString::WStringLength(pName);
- CFX_WideString wsName = CFX_WideString::FromUTF16LE(pName, len);
+ FX_STRSIZE len = WideString::WStringLength(pName);
+ WideString wsName = WideString::FromUTF16LE(pName, len);
if (wsFace == wsName)
return hFont;
}
@@ -665,7 +663,7 @@
return size;
}
-bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_Win32FontInfo::GetFaceName(void* hFont, ByteString* name) {
char facebuf[100];
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
int ret = ::GetTextFaceA(m_hDC, 100, facebuf);
@@ -702,7 +700,7 @@
CHAR windows_path[MAX_PATH] = {};
DWORD path_len = ::GetWindowsDirectoryA(windows_path, MAX_PATH);
if (path_len > 0 && path_len < MAX_PATH) {
- CFX_ByteString fonts_path(windows_path);
+ ByteString fonts_path(windows_path);
fonts_path += "\\Fonts";
pInfoFallback->AddPath(fonts_path);
}
@@ -799,7 +797,7 @@
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1;
FX_RECT dst_rect(0, 0, width, height);
dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
@@ -817,7 +815,7 @@
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left,
pBitmap->GetHeight() - pSrcRect->bottom, 0,
pBitmap->GetHeight(), pBuffer,
@@ -840,7 +838,7 @@
if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
return false;
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
if ((int64_t)abs(dest_width) * abs(dest_height) <
(int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 ||
(flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) {
@@ -854,7 +852,7 @@
(int64_t)abs(dest_width) * abs(dest_height))) {
pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height, 0, nullptr);
}
- CFX_ByteString toStrechBitmapInfo =
+ ByteString toStrechBitmapInfo =
CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap);
::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0,
pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(),
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index d1e5688..c00543b 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -11,9 +11,9 @@
#include "core/fxge/win32/cfx_windowsdib.h"
#include "core/fxge/win32/win32_int.h"
-CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(
+ByteString CFX_WindowsDIB::GetBitmapInfo(
const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
- CFX_ByteString result;
+ ByteString result;
int len = sizeof(BITMAPINFOHEADER);
if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) {
len += sizeof(DWORD) * (int)(1 << pBitmap->GetBPP());
@@ -102,7 +102,7 @@
HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
HDC hDC) {
- CFX_ByteString info = GetBitmapInfo(pBitmap);
+ ByteString info = GetBitmapInfo(pBitmap);
return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
DIB_RGB_COLORS);
@@ -139,7 +139,7 @@
DeleteDC(hDC);
return nullptr;
}
- CFX_ByteString info = GetBitmapInfo(pDIBitmap);
+ ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
DeleteDC(hDC);
@@ -149,7 +149,7 @@
}
CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) {
- return LoadFromFile(CFX_WideString::FromLocal(filename).c_str());
+ return LoadFromFile(WideString::FromLocal(filename).c_str());
}
CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(
@@ -175,7 +175,7 @@
DeleteDC(hDC);
return nullptr;
}
- CFX_ByteString info = GetBitmapInfo(pDIBitmap);
+ ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
DeleteDC(hDC);
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 04788d6..8161c5d 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -682,7 +682,7 @@
m_pGdiRemoveFontMemResourseEx = nullptr;
}
void CGdiplusExt::Load() {
- CFX_ByteString strPlusPath = "";
+ ByteString strPlusPath = "";
char buf[MAX_PATH];
GetSystemDirectoryA(buf, MAX_PATH);
strPlusPath += buf;
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index ecd7be5..fa2c8b7 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -232,7 +232,7 @@
lf.lfItalic = pFont->IsItalic();
lf.lfCharSet = DEFAULT_CHARSET;
- const CFX_WideString wsName = pFont->GetFaceName().UTF8Decode();
+ const WideString wsName = pFont->GetFaceName().UTF8Decode();
size_t iNameLen =
std::min(wsName.GetLength(), static_cast<size_t>(LF_FACESIZE - 1));
memcpy(lf.lfFaceName, wsName.c_str(), sizeof(lf.lfFaceName[0]) * iNameLen);
@@ -288,7 +288,7 @@
SetBkMode(m_hDC, TRANSPARENT);
// Text
- CFX_WideString wsText;
+ WideString wsText;
std::vector<INT> spacing(nChars);
float fPreviousOriginX = 0;
for (int i = 0; i < nChars; ++i) {
@@ -609,7 +609,7 @@
// errors below. Value chosen based on the title of https://crbug.com/18383
const double kScaleFactor = 10;
- CFX_WideString wsText;
+ WideString wsText;
int totalLength = nChars;
// Detect new lines and add clrf characters (since this is Windows only).
@@ -638,7 +638,7 @@
wsText += charpos.m_Unicode;
}
size_t len = totalLength;
- CFX_ByteString text = CFX_ByteString::FromUnicode(wsText);
+ ByteString text = ByteString::FromUnicode(wsText);
while (len > 0) {
char buffer[1026];
size_t send_len = std::min(len, static_cast<size_t>(1024));
diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp
index 3e35ff8..d1c9599 100644
--- a/fpdfsdk/cba_annotiterator.cpp
+++ b/fpdfsdk/cba_annotiterator.cpp
@@ -34,7 +34,7 @@
m_pPageView(pPageView),
m_nAnnotSubtype(nAnnotSubtype) {
CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
- CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs");
+ ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs");
if (sTabs == "R")
m_eTabOrder = ROW;
else if (sTabs == "C")
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index c8b1ef4..9534d7b 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -89,7 +89,7 @@
m_pFormFillEnv->SetCursor(nCursorType);
}
-bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) {
+bool CFX_SystemHandler::FindNativeTrueTypeFont(ByteString sFontFaceName) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
if (!pFontMgr)
return false;
@@ -102,11 +102,11 @@
pFontMapper->LoadInstalledFonts();
for (const auto& font : pFontMapper->m_InstalledTTFonts) {
- if (font.Compare(sFontFaceName.AsStringC()))
+ if (font.Compare(sFontFaceName.AsStringView()))
return true;
}
for (const auto& fontPair : pFontMapper->m_LocalizedTTFonts) {
- if (fontPair.first.Compare(sFontFaceName.AsStringC()))
+ if (fontPair.first.Compare(sFontFaceName.AsStringView()))
return true;
}
return false;
@@ -114,7 +114,7 @@
CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(
CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
+ ByteString sFontFaceName,
uint8_t nCharset) {
if (!pDoc)
return nullptr;
diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h
index c526305..a2ad024 100644
--- a/fpdfsdk/cfx_systemhandler.h
+++ b/fpdfsdk/cfx_systemhandler.h
@@ -58,9 +58,9 @@
void OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect);
bool IsSelectionImplemented() const;
void SetCursor(int32_t nCursorType);
- bool FindNativeTrueTypeFont(CFX_ByteString sFontFaceName);
+ bool FindNativeTrueTypeFont(ByteString sFontFaceName);
CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
+ ByteString sFontFaceName,
uint8_t nCharset);
int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index a1ac14c..2966b4d 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -76,14 +76,13 @@
GetAnnotHandler(pAnnot)->OnLoad(pAnnot);
}
-CFX_WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText(
+WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText(
CPDFSDK_Annot* pAnnot) {
return GetAnnotHandler(pAnnot)->GetSelectedText(pAnnot);
}
-void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(
- CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot,
+ const WideString& text) {
GetAnnotHandler(pAnnot)->ReplaceSelection(pAnnot, text);
}
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 32f8b4a..21ccb3a 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -42,9 +42,8 @@
void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
void Annot_OnLoad(CPDFSDK_Annot* pAnnot);
- CFX_WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot);
- void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text);
+ WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
void Annot_OnDraw(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 9f21d3c..711d228 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -101,7 +101,7 @@
m_pAnnot->ClearCachedAP();
}
-void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
+void CPDFSDK_BAAnnot::SetContents(const WideString& sContents) {
if (sContents.IsEmpty()) {
m_pAnnot->GetAnnotDict()->RemoveFor("Contents");
} else {
@@ -110,11 +110,11 @@
}
}
-CFX_WideString CPDFSDK_BAAnnot::GetContents() const {
+WideString CPDFSDK_BAAnnot::GetContents() const {
return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents");
}
-void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) {
+void CPDFSDK_BAAnnot::SetAnnotName(const WideString& sName) {
if (sName.IsEmpty()) {
m_pAnnot->GetAnnotDict()->RemoveFor("NM");
} else {
@@ -123,13 +123,13 @@
}
}
-CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const {
+WideString CPDFSDK_BAAnnot::GetAnnotName() const {
return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM");
}
void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) {
CPDFSDK_DateTime dt(st);
- CFX_ByteString str = dt.ToPDFDateTimeString();
+ ByteString str = dt.ToPDFDateTimeString();
if (str.IsEmpty())
m_pAnnot->GetAnnotDict()->RemoveFor("M");
else
@@ -138,7 +138,7 @@
FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
FX_SYSTEMTIME systime;
- CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
+ ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
CPDFSDK_DateTime dt(str);
dt.ToSystemTime(systime);
return systime;
@@ -153,14 +153,14 @@
return m_pAnnot->GetAnnotDict()->GetIntegerFor("F");
}
-void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) {
+void CPDFSDK_BAAnnot::SetAppState(const ByteString& str) {
if (str.IsEmpty())
m_pAnnot->GetAnnotDict()->RemoveFor("AS");
else
m_pAnnot->GetAnnotDict()->SetNewFor<CPDF_String>("AS", str, false);
}
-CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const {
+ByteString CPDFSDK_BAAnnot::GetAppState() const {
return m_pAnnot->GetAnnotDict()->GetStringFor("AS");
}
@@ -225,7 +225,7 @@
BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
if (pBSDict) {
- CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
+ ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
if (sBorderStyle == "S")
return BorderStyle::SOLID;
if (sBorderStyle == "D")
diff --git a/fpdfsdk/cpdfsdk_baannot.h b/fpdfsdk/cpdfsdk_baannot.h
index 3b60b1b..1d71585 100644
--- a/fpdfsdk/cpdfsdk_baannot.h
+++ b/fpdfsdk/cpdfsdk_baannot.h
@@ -38,11 +38,11 @@
CPDF_Dictionary* GetAPDict() const;
- void SetContents(const CFX_WideString& sContents);
- CFX_WideString GetContents() const;
+ void SetContents(const WideString& sContents);
+ WideString GetContents() const;
- void SetAnnotName(const CFX_WideString& sName);
- CFX_WideString GetAnnotName() const;
+ void SetAnnotName(const WideString& sName);
+ WideString GetAnnotName() const;
void SetModifiedDate(const FX_SYSTEMTIME& st);
FX_SYSTEMTIME GetModifiedDate() const;
@@ -50,8 +50,8 @@
void SetFlags(uint32_t nFlags);
uint32_t GetFlags() const;
- void SetAppState(const CFX_ByteString& str);
- CFX_ByteString GetAppState() const;
+ void SetAppState(const ByteString& str);
+ ByteString GetAppState() const;
void SetStructParent(int key);
int GetStructParent() const;
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 6cf399a..027527e 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -193,12 +193,12 @@
return pAnnot->GetRect();
}
-CFX_WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
- return CFX_WideString();
+WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+ return WideString();
}
void CPDFSDK_BAAnnotHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {}
+ const WideString& text) {}
bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 2ed9ed8..7bf8034 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -36,9 +36,8 @@
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
diff --git a/fpdfsdk/cpdfsdk_datetime.cpp b/fpdfsdk/cpdfsdk_datetime.cpp
index d2653fc..ce22cae 100644
--- a/fpdfsdk/cpdfsdk_datetime.cpp
+++ b/fpdfsdk/cpdfsdk_datetime.cpp
@@ -63,7 +63,7 @@
ResetDateTime();
}
-CPDFSDK_DateTime::CPDFSDK_DateTime(const CFX_ByteString& dtStr) {
+CPDFSDK_DateTime::CPDFSDK_DateTime(const ByteString& dtStr) {
ResetDateTime();
FromPDFDateTimeString(dtStr);
}
@@ -129,7 +129,7 @@
}
CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
- const CFX_ByteString& dtStr) {
+ const ByteString& dtStr) {
int strLength = dtStr.GetLength();
if (strLength <= 0)
return *this;
@@ -263,34 +263,34 @@
return *this;
}
-CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
- CFX_ByteString str1;
+ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
+ ByteString str1;
str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", m_year, m_month, m_day, m_hour,
m_minute, m_second);
if (m_tzHour < 0)
str1 += "-";
else
str1 += "+";
- CFX_ByteString str2;
+ ByteString str2;
str2.Format("%02d:%02u", std::abs(static_cast<int>(m_tzHour)), m_tzMinute);
return str1 + str2;
}
-CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
- CFX_ByteString dtStr;
+ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
+ ByteString dtStr;
char tempStr[32];
memset(tempStr, 0, sizeof(tempStr));
FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u",
m_year, m_month, m_day, m_hour, m_minute, m_second);
- dtStr = CFX_ByteString(tempStr);
+ dtStr = ByteString(tempStr);
if (m_tzHour < 0)
- dtStr += CFX_ByteString("-");
+ dtStr += ByteString("-");
else
- dtStr += CFX_ByteString("+");
+ dtStr += ByteString("+");
memset(tempStr, 0, sizeof(tempStr));
FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'",
std::abs(static_cast<int>(m_tzHour)), m_tzMinute);
- dtStr += CFX_ByteString(tempStr);
+ dtStr += ByteString(tempStr);
return dtStr;
}
diff --git a/fpdfsdk/cpdfsdk_datetime.h b/fpdfsdk/cpdfsdk_datetime.h
index 6b612b2..08d43cc 100644
--- a/fpdfsdk/cpdfsdk_datetime.h
+++ b/fpdfsdk/cpdfsdk_datetime.h
@@ -18,16 +18,16 @@
class CPDFSDK_DateTime {
public:
CPDFSDK_DateTime();
- explicit CPDFSDK_DateTime(const CFX_ByteString& dtStr);
+ explicit CPDFSDK_DateTime(const ByteString& dtStr);
explicit CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
bool operator==(const CPDFSDK_DateTime& datetime) const;
bool operator!=(const CPDFSDK_DateTime& datetime) const;
- CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
- CFX_ByteString ToCommonDateTimeString();
- CFX_ByteString ToPDFDateTimeString();
+ CPDFSDK_DateTime& FromPDFDateTimeString(const ByteString& dtStr);
+ ByteString ToCommonDateTimeString();
+ ByteString ToPDFDateTimeString();
void ToSystemTime(FX_SYSTEMTIME& st);
time_t ToTime_t() const;
CPDFSDK_DateTime ToGMT() const;
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index a258026..300a742 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -24,7 +24,7 @@
// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken
// since modifying the result would impact |bsUTF16LE|.
-FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) {
+FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE) {
return reinterpret_cast<FPDF_WIDESTRING>(
bsUTF16LE->GetBuffer(bsUTF16LE->GetLength()));
}
@@ -69,8 +69,8 @@
!m_pInfo->m_pJsPlatform->app_alert) {
return -1;
}
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
+ ByteString bsMsg = WideString(Msg).UTF16LE_Encode();
+ ByteString bsTitle = WideString(Title).UTF16LE_Encode();
return m_pInfo->m_pJsPlatform->app_alert(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg),
AsFPDFWideString(&bsTitle), Type, Icon);
@@ -87,10 +87,10 @@
!m_pInfo->m_pJsPlatform->app_response) {
return -1;
}
- CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
- CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();
- CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();
+ ByteString bsQuestion = WideString(Question).UTF16LE_Encode();
+ ByteString bsTitle = WideString(Title).UTF16LE_Encode();
+ ByteString bsDefault = WideString(Default).UTF16LE_Encode();
+ ByteString bsLabel = WideString(cLabel).UTF16LE_Encode();
return m_pInfo->m_pJsPlatform->app_response(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion),
AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault),
@@ -105,44 +105,44 @@
m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() {
+WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Field_browse) {
- return CFX_WideString();
+ return WideString();
}
const int nRequiredLen =
m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
pBuff.resize(nActualLen);
- return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff));
+ return WideString::FromLocal(ByteStringView(pBuff));
}
-CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
+WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_getFilePath) {
- return CFX_WideString();
+ return WideString();
}
const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
m_pInfo->m_pJsPlatform, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
pBuff.resize(nActualLen);
- return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff));
+ return WideString::FromLocal(ByteStringView(pBuff));
}
void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
@@ -152,7 +152,7 @@
!m_pInfo->m_pJsPlatform->Doc_submitForm) {
return;
}
- CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
+ ByteString bsDestination = WideString(URL).UTF16LE_Encode();
m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData,
length,
AsFPDFWideString(&bsDestination));
@@ -170,11 +170,11 @@
!m_pInfo->m_pJsPlatform->Doc_mail) {
return;
}
- CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
- CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
- CFX_ByteString bsCC = CFX_WideString(CC).UTF16LE_Encode();
- CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
+ ByteString bsTo = WideString(To).UTF16LE_Encode();
+ ByteString bsSubject = WideString(Subject).UTF16LE_Encode();
+ ByteString bsCC = WideString(CC).UTF16LE_Encode();
+ ByteString bsBcc = WideString(BCC).UTF16LE_Encode();
+ ByteString bsMsg = WideString(Msg).UTF16LE_Encode();
m_pInfo->m_pJsPlatform->Doc_mail(
m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo),
AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC),
@@ -350,30 +350,30 @@
m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::GetPlatform() {
+WideString CPDFSDK_FormFillEnvironment::GetPlatform() {
if (!m_pInfo || !m_pInfo->FFI_GetPlatform)
- return CFX_WideString();
+ return WideString();
int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
int nActualLen =
m_pInfo->FFI_GetPlatform(m_pInfo, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nActualLen / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nActualLen / sizeof(uint16_t));
}
void CPDFSDK_FormFillEnvironment::GotoURL(CPDFXFA_Context* document,
- const CFX_WideStringC& wsURL) {
+ const WideStringView& wsURL) {
if (!m_pInfo || !m_pInfo->FFI_GotoURL)
return;
- CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsTo = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength());
m_pInfo->FFI_GotoURL(m_pInfo, document, pTo);
bsTo.ReleaseBuffer(bsTo.GetStringLength());
@@ -446,7 +446,7 @@
if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL)
return nullptr;
- CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode();
+ ByteString bstrURL = WideString(url).UTF16LE_Encode();
FPDF_WIDESTRING wsURL =
(FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength());
@@ -454,7 +454,7 @@
return MakeSeekableStream(fileHandler);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
+WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
const wchar_t* wsURL,
const wchar_t* wsData,
const wchar_t* wsContentType,
@@ -463,21 +463,21 @@
if (!m_pInfo || !m_pInfo->FFI_PostRequestURL)
return L"";
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsURL = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ ByteString bsData = WideString(wsData).UTF16LE_Encode();
FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
- CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode();
+ ByteString bsContentType = WideString(wsContentType).UTF16LE_Encode();
FPDF_WIDESTRING contentType =
(FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength());
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode();
FPDF_WIDESTRING encode =
(FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
- CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode();
+ ByteString bsHeader = WideString(wsHeader).UTF16LE_Encode();
FPDF_WIDESTRING header =
(FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength());
@@ -486,7 +486,7 @@
m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header,
&response);
- CFX_WideString wsRet = CFX_WideString::FromUTF16LE(
+ WideString wsRet = WideString::FromUTF16LE(
(FPDF_WIDESTRING)response.str, response.len / sizeof(FPDF_WIDESTRING));
FPDF_BStr_Clear(&response);
@@ -499,35 +499,35 @@
if (!m_pInfo || !m_pInfo->FFI_PutRequestURL)
return false;
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsURL = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ ByteString bsData = WideString(wsData).UTF16LE_Encode();
FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode();
FPDF_WIDESTRING encode =
(FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::GetLanguage() {
+WideString CPDFSDK_FormFillEnvironment::GetLanguage() {
if (!m_pInfo || !m_pInfo->FFI_GetLanguage)
- return CFX_WideString();
+ return WideString();
int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
int nActualLen =
m_pInfo->FFI_GetLanguage(m_pInfo, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nActualLen / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nActualLen / sizeof(uint16_t));
}
void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount,
@@ -583,7 +583,7 @@
CPDF_DocJSActions docJS(pPDFDoc);
int iCount = docJS.CountJSActions();
for (int i = 0; i < iCount; i++) {
- CFX_WideString csJSName;
+ WideString csJSName;
CPDF_Action jsAction = docJS.GetJSActionAndName(i, &csJSName);
GetActionHandler()->DoAction_JavaScript(jsAction, csJSName, this);
}
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index c993740..9e3c925 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -133,10 +133,10 @@
void SetCurrentPage(CPDFXFA_Context* document, int iCurPage);
// TODO(dsinclair): This should probably change to PDFium?
- CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }
+ WideString FFI_GetAppName() const { return WideString(L"Acrobat"); }
- CFX_WideString GetPlatform();
- void GotoURL(CPDFXFA_Context* document, const CFX_WideStringC& wsURL);
+ WideString GetPlatform();
+ void GotoURL(CPDFXFA_Context* document, const WideStringView& wsURL);
void GetPageViewRect(CPDFXFA_Page* page, FS_RECTF& dstRect);
bool PopupMenu(CPDFXFA_Page* page,
FPDF_WIDGET hWidget,
@@ -157,15 +157,15 @@
FPDF_WIDESTRING wsURL,
const char* mode);
CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const wchar_t* url);
- CFX_WideString PostRequestURL(const wchar_t* wsURL,
- const wchar_t* wsData,
- const wchar_t* wsContentType,
- const wchar_t* wsEncode,
- const wchar_t* wsHeader);
+ WideString PostRequestURL(const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsContentType,
+ const wchar_t* wsEncode,
+ const wchar_t* wsHeader);
FPDF_BOOL PutRequestURL(const wchar_t* wsURL,
const wchar_t* wsData,
const wchar_t* wsEncode);
- CFX_WideString GetLanguage();
+ WideString GetLanguage();
void PageEvent(int iPageCount, uint32_t dwEventType) const;
#else // PDF_ENABLE_XFA
@@ -184,8 +184,8 @@
void* response,
int length);
void JS_appBeep(int nType);
- CFX_WideString JS_fieldBrowse();
- CFX_WideString JS_docGetFilePath();
+ WideString JS_fieldBrowse();
+ WideString JS_docGetFilePath();
void JS_docSubmitForm(void* formData, int length, const wchar_t* URL);
void JS_docmailForm(void* mailData,
int length,
@@ -206,7 +206,7 @@
void JS_docgotoPage(int nPageNum);
bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; }
- CFX_ByteString GetAppName() const { return ""; }
+ ByteString GetAppName() const { return ""; }
CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); }
FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index b60529d..fd0dffa 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -117,7 +117,7 @@
}
void CPDFSDK_InterForm::GetWidgets(
- const CFX_WideString& sFieldName,
+ const WideString& sFieldName,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) {
CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName);
@@ -250,17 +250,17 @@
if (!action.GetDict())
continue;
- CFX_WideString csJS = action.GetJavaScript();
+ WideString csJS = action.GetJavaScript();
if (csJS.IsEmpty())
continue;
IJS_EventContext* pContext = pRuntime->NewEventContext();
- CFX_WideString sOldValue = pField->GetValue();
- CFX_WideString sValue = sOldValue;
+ WideString sOldValue = pField->GetValue();
+ WideString sValue = sOldValue;
bool bRC = true;
pContext->OnField_Calculate(pFormField, pField, sValue, bRC);
- CFX_WideString sInfo;
+ WideString sInfo;
bool bRet = pContext->RunScript(csJS, &sInfo);
pRuntime->ReleaseEventContext(pContext);
if (bRet && bRC && sValue.Compare(sOldValue) != 0)
@@ -269,9 +269,9 @@
m_bBusy = false;
}
-CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
- bool& bFormatted) {
- CFX_WideString sValue = pFormField->GetValue();
+WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
+ bool& bFormatted) {
+ WideString sValue = pFormField->GetValue();
if (!m_pFormFillEnv->IsJSInitiated()) {
bFormatted = false;
return sValue;
@@ -291,13 +291,13 @@
if (aAction.GetDict() && aAction.ActionExist(CPDF_AAction::Format)) {
CPDF_Action action = aAction.GetAction(CPDF_AAction::Format);
if (action.GetDict()) {
- CFX_WideString script = action.GetJavaScript();
+ WideString script = action.GetJavaScript();
if (!script.IsEmpty()) {
- CFX_WideString Value = sValue;
+ WideString Value = sValue;
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnField_Format(pFormField, Value, true);
- CFX_WideString sInfo;
+ WideString sInfo;
bool bRet = pContext->RunScript(script, &sInfo);
pRuntime->ReleaseEventContext(pContext);
if (bRet) {
@@ -311,7 +311,7 @@
}
void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
- const CFX_WideString* sValue,
+ const WideString* sValue,
bool bValueChanged) {
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
@@ -339,7 +339,7 @@
}
bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
CPDF_AAction aAction = pFormField->GetAdditionalAction();
if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::KeyStroke))
return true;
@@ -359,7 +359,7 @@
}
bool CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
CPDF_AAction aAction = pFormField->GetAdditionalAction();
if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::Validate))
return true;
@@ -412,7 +412,7 @@
}
bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
- CFX_WideString sDestination = action.GetFilePath();
+ WideString sDestination = action.GetFilePath();
if (sDestination.IsEmpty())
return false;
@@ -436,11 +436,11 @@
return SubmitForm(sDestination, false);
}
-bool CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination,
+bool CPDFSDK_InterForm::SubmitFields(const WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bUrlEncoded) {
- CFX_ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
+ ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
FX_STRSIZE nBufSize = textBuf.GetLength();
if (nBufSize == 0)
@@ -485,12 +485,12 @@
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField)
continue;
- CFX_WideString name;
+ WideString name;
name = pField->GetUnicodeTextFor("T");
- CFX_ByteString name_b = CFX_ByteString::FromUnicode(name);
- CFX_ByteString csBValue = pField->GetStringFor("V");
- CFX_WideString csWValue = PDF_DecodeText(csBValue);
- CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue);
+ ByteString name_b = ByteString::FromUnicode(name);
+ ByteString csBValue = pField->GetStringFor("V");
+ WideString csWValue = PDF_DecodeText(csBValue);
+ ByteString csValue_b = ByteString::FromUnicode(csWValue);
fdfEncodedData << name_b.GetBuffer(name_b.GetLength());
name_b.ReleaseBuffer(name_b.GetStringLength());
@@ -510,21 +510,20 @@
return true;
}
-CFX_ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
+ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude) {
std::unique_ptr<CFDF_Document> pFDF = m_pInterForm->ExportToFDF(
m_pFormFillEnv->JS_docGetFilePath(), fields, bIncludeOrExclude, false);
- return pFDF ? pFDF->WriteToString() : CFX_ByteString();
+ return pFDF ? pFDF->WriteToString() : ByteString();
}
-CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(
- const CFX_WideString& sFileExt) {
+WideString CPDFSDK_InterForm::GetTemporaryFileName(const WideString& sFileExt) {
return L"";
}
-bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
+bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination,
bool bUrlEncoded) {
if (sDestination.IsEmpty())
return false;
@@ -537,7 +536,7 @@
if (!pFDFDoc)
return false;
- CFX_ByteString fdfBuffer = pFDFDoc->WriteToString();
+ ByteString fdfBuffer = pFDFDoc->WriteToString();
FX_STRSIZE nBufSize = fdfBuffer.GetLength();
if (nBufSize == 0)
@@ -562,11 +561,11 @@
return true;
}
-CFX_ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() {
+ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() {
std::unique_ptr<CFDF_Document> pFDF =
m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false);
- return pFDF ? pFDF->WriteToString() : CFX_ByteString();
+ return pFDF ? pFDF->WriteToString() : ByteString();
}
bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) {
@@ -593,7 +592,7 @@
std::vector<CPDF_FormField*> fields;
for (CPDF_Object* pObject : objects) {
if (pObject && pObject->IsString()) {
- CFX_WideString csName = pObject->GetUnicodeText();
+ WideString csName = pObject->GetUnicodeText();
CPDF_FormField* pField = m_pInterForm->GetField(0, csName);
if (pField)
fields.push_back(pField);
@@ -603,7 +602,7 @@
}
int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
int nType = pField->GetFieldType();
if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD)
return 0;
@@ -625,14 +624,14 @@
if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) {
OnCalculate(pField);
bool bFormatted = false;
- CFX_WideString sValue = OnFormat(pField, bFormatted);
+ WideString sValue = OnFormat(pField, bFormatted);
ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true);
UpdateField(pField);
}
}
int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
if (pField->GetFieldType() != FIELDTYPE_LISTBOX)
return 0;
diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h
index b031345..e14589e 100644
--- a/fpdfsdk/cpdfsdk_interform.h
+++ b/fpdfsdk/cpdfsdk_interform.h
@@ -43,7 +43,7 @@
CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, bool bNext) const;
CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
- void GetWidgets(const CFX_WideString& sFieldName,
+ void GetWidgets(const WideString& sFieldName,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
void GetWidgets(CPDF_FormField* pField,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
@@ -65,14 +65,13 @@
void SynchronizeField(CPDF_FormField* pFormField, bool bSynchronizeElse);
#endif // PDF_ENABLE_XFA
- bool OnKeyStrokeCommit(CPDF_FormField* pFormField,
- const CFX_WideString& csValue);
- bool OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue);
+ bool OnKeyStrokeCommit(CPDF_FormField* pFormField, const WideString& csValue);
+ bool OnValidate(CPDF_FormField* pFormField, const WideString& csValue);
void OnCalculate(CPDF_FormField* pFormField = nullptr);
- CFX_WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted);
+ WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted);
void ResetFieldAppearance(CPDF_FormField* pFormField,
- const CFX_WideString* sValue,
+ const WideString* sValue,
bool bValueChanged);
void UpdateField(CPDF_FormField* pFormField);
@@ -84,16 +83,16 @@
std::vector<CPDF_FormField*> GetFieldFromObjects(
const std::vector<CPDF_Object*>& objects) const;
bool IsValidField(CPDF_Dictionary* pFieldDict);
- bool SubmitFields(const CFX_WideString& csDestination,
+ bool SubmitFields(const WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bUrlEncoded);
- bool SubmitForm(const CFX_WideString& sDestination, bool bUrlEncoded);
- CFX_ByteString ExportFormToFDFTextBuf();
- CFX_ByteString ExportFieldsToFDFTextBuf(
+ bool SubmitForm(const WideString& sDestination, bool bUrlEncoded);
+ ByteString ExportFormToFDFTextBuf();
+ ByteString ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude);
- CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
+ WideString GetTemporaryFileName(const WideString& sFileExt);
bool IsNeedHighLight(int nFieldType);
void RemoveAllHighLight();
@@ -105,10 +104,10 @@
private:
// IPDF_FormNotify:
int BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) override;
+ const WideString& csValue) override;
void AfterValueChange(CPDF_FormField* pField) override;
int BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) override;
+ const WideString& csValue) override;
void AfterSelectionChange(CPDF_FormField* pField) override;
void AfterCheckedStatusChange(CPDF_FormField* pField) override;
int BeforeFormReset(CPDF_InterForm* pForm) override;
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 5bdd720..f22d575 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -241,17 +241,17 @@
}
#endif // PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_PageView::GetSelectedText() {
+WideString CPDFSDK_PageView::GetSelectedText() {
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();
return pAnnotHandlerMgr->Annot_GetSelectedText(pAnnot);
}
- return CFX_WideString();
+ return WideString();
}
-void CPDFSDK_PageView::ReplaceSelection(const CFX_WideString& text) {
+void CPDFSDK_PageView::ReplaceSelection(const WideString& text) {
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index 00e90d7..b86f305 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -61,8 +61,8 @@
return m_pFormFillEnv.Get();
}
- CFX_WideString GetSelectedText();
- void ReplaceSelection(const CFX_WideString& text);
+ WideString GetSelectedText();
+ void ReplaceSelection(const WideString& text);
bool OnFocus(const CFX_PointF& point, uint32_t nFlag);
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 0183f58..a859dcd 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -75,7 +75,7 @@
if (pContext->GetDocType() == XFA_DocType::Static) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
- CFX_WideString sName;
+ WideString sName;
if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
sName = GetAnnotName();
if (sName.IsEmpty())
@@ -102,7 +102,7 @@
if (!pDocView)
return nullptr;
- CFX_WideString sName = GetName();
+ WideString sName = GetName();
return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr;
}
@@ -377,7 +377,7 @@
}
case FIELDTYPE_TEXTFIELD: {
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
pFormField->SetValue(sValue, true);
}
@@ -409,7 +409,7 @@
}
}
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
pFormField->SetValue(sValue, true);
}
@@ -432,7 +432,7 @@
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
i++) {
- CFX_WideString swText;
+ WideString swText;
pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, true);
@@ -447,7 +447,7 @@
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
i++) {
- CFX_WideString swText;
+ WideString swText;
pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, false);
@@ -552,7 +552,7 @@
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_Widget::GetName() const {
+WideString CPDFSDK_Widget::GetName() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetFullName();
}
@@ -607,28 +607,28 @@
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_Widget::GetValue(bool bDisplay) const {
+WideString CPDFSDK_Widget::GetValue(bool bDisplay) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(
sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit);
return sValue;
}
}
#else
-CFX_WideString CPDFSDK_Widget::GetValue() const {
+WideString CPDFSDK_Widget::GetValue() const {
#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetValue();
}
-CFX_WideString CPDFSDK_Widget::GetDefaultValue() const {
+WideString CPDFSDK_Widget::GetDefaultValue() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetDefaultValue();
}
-CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
+WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetOptionLabel(nIndex);
}
@@ -692,7 +692,7 @@
#endif // PDF_ENABLE_XFA
}
-void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) {
+void CPDFSDK_Widget::SetValue(const WideString& sValue, bool bNotify) {
CPDF_FormField* pFormField = GetFormField();
pFormField->SetValue(sValue, bNotify);
#ifdef PDF_ENABLE_XFA
@@ -701,7 +701,7 @@
#endif // PDF_ENABLE_XFA
}
-void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {}
+void CPDFSDK_Widget::SetDefaultValue(const WideString& sValue) {}
void CPDFSDK_Widget::SetOptionSelection(int index,
bool bSelected,
bool bNotify) {
@@ -742,7 +742,7 @@
case FIELDTYPE_TEXTFIELD:
case FIELDTYPE_COMBOBOX: {
bool bFormatted = false;
- CFX_WideString sValue = OnFormat(bFormatted);
+ WideString sValue = OnFormat(bFormatted);
ResetAppearance(bFormatted ? &sValue : nullptr, true);
break;
}
@@ -753,7 +753,7 @@
}
#endif // PDF_ENABLE_XFA
-void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue,
+void CPDFSDK_Widget::ResetAppearance(const WideString* sValue,
bool bValueChanged) {
SetAppModified();
@@ -786,7 +786,7 @@
m_pAnnot->ClearCachedAP();
}
-CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) {
+WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) {
CPDF_FormField* pFormField = GetFormField();
ASSERT(pFormField);
return m_pInterForm->OnFormat(pFormField, bFormatted);
@@ -1042,7 +1042,7 @@
return CPDF_Action();
}
-CFX_WideString CPDFSDK_Widget::GetAlternateName() const {
+WideString CPDFSDK_Widget::GetAlternateName() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetAlternateName();
}
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index d33413a..5b2411e 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -82,12 +82,12 @@
int GetSelectedIndex(int nIndex) const;
#ifndef PDF_ENABLE_XFA
- CFX_WideString GetValue() const;
+ WideString GetValue() const;
#else
- CFX_WideString GetValue(bool bDisplay = true) const;
+ WideString GetValue(bool bDisplay = true) const;
#endif // PDF_ENABLE_XFA
- CFX_WideString GetDefaultValue() const;
- CFX_WideString GetOptionLabel(int nIndex) const;
+ WideString GetDefaultValue() const;
+ WideString GetOptionLabel(int nIndex) const;
int CountOptions() const;
bool IsOptionSelected(int nIndex) const;
int GetTopVisibleIndex() const;
@@ -95,13 +95,13 @@
int GetAlignment() const;
int GetMaxLen() const;
#ifdef PDF_ENABLE_XFA
- CFX_WideString GetName() const;
+ WideString GetName() const;
#endif // PDF_ENABLE_XFA
- CFX_WideString GetAlternateName() const;
+ WideString GetAlternateName() const;
void SetCheck(bool bChecked, bool bNotify);
- void SetValue(const CFX_WideString& sValue, bool bNotify);
- void SetDefaultValue(const CFX_WideString& sValue);
+ void SetValue(const WideString& sValue, bool bNotify);
+ void SetDefaultValue(const WideString& sValue);
void SetOptionSelection(int index, bool bSelected, bool bNotify);
void ClearSelection(bool bNotify);
void SetTopVisibleIndex(int index);
@@ -109,10 +109,10 @@
#ifdef PDF_ENABLE_XFA
void ResetAppearance(bool bValueChanged);
#endif // PDF_ENABLE_XFA
- void ResetAppearance(const CFX_WideString* sValue, bool bValueChanged);
+ void ResetAppearance(const WideString* sValue, bool bValueChanged);
void ResetFieldAppearance(bool bValueChanged);
void UpdateField();
- CFX_WideString OnFormat(bool& bFormatted);
+ WideString OnFormat(bool& bFormatted);
bool OnAAction(CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index d20d29a..ab37141 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -231,7 +231,7 @@
if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
bool bFormatted = false;
CPDFSDK_Annot::ObservedPtr pObserved(pWidget);
- CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ WideString sValue = pWidget->OnFormat(bFormatted);
if (!pObserved)
return;
@@ -280,15 +280,15 @@
return CFX_FloatRect();
}
-CFX_WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->GetSelectedText(pAnnot);
- return CFX_WideString();
+ return WideString();
}
void CPDFSDK_WidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
m_pFormFiller->ReplaceSelection(pAnnot, text);
}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 82a9380..d83c98f 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -37,9 +37,8 @@
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index e9c9972..b5c52a8 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -99,15 +99,14 @@
// TODO(bug 840): Implement so selected text can be obtained from XFA
// fields.
-CFX_WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(
- CPDFSDK_Annot* pAnnot) {
- return CFX_WideString();
+WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+ return WideString();
}
// TODO(bug 840): Implement so text can be inserted into and deleted from XFA
// fields.
void CPDFSDK_XFAWidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {}
+ const WideString& text) {}
bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h
index e1f7661..e26472d 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h
@@ -32,9 +32,8 @@
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
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,
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 676f701..1e39f2b 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -52,7 +52,7 @@
FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
} else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
+ ByteString cbString;
if (pAnnotDict->KeyExist("IT"))
cbString = pAnnotDict->GetStringFor("IT");
if (cbString.Compare("Img") != 0)
@@ -67,7 +67,7 @@
FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
} else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
+ ByteString cbString;
if (pAnnotDict->KeyExist("FT"))
cbString = pAnnotDict->GetStringFor("FT");
if (cbString.Compare("Sig") == 0)
@@ -75,18 +75,18 @@
}
}
-bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
+bool CheckSharedForm(const CXML_Element* pElement, ByteString cbName) {
int count = pElement->CountAttrs();
int i = 0;
for (i = 0; i < count; i++) {
- CFX_ByteString space;
- CFX_ByteString name;
- CFX_WideString value;
+ ByteString space;
+ ByteString name;
+ WideString value;
pElement->GetAttrByIndex(i, &space, &name, &value);
if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
CXML_Element* pVersion =
- pElement->GetElement("adhocwf", cbName.AsStringC(), 0);
+ pElement->GetElement("adhocwf", cbName.AsStringView(), 0);
if (!pVersion)
continue;
CXML_Content* pContent = ToContent(pVersion->GetChild(0));
@@ -127,7 +127,7 @@
// Portfolios and Packages
const CPDF_Dictionary* pRootDict = pDoc->GetRoot();
if (pRootDict) {
- CFX_ByteString cbString;
+ ByteString cbString;
if (pRootDict->KeyExist("Collection")) {
FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION);
return;
@@ -143,7 +143,7 @@
CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr;
if (pArray) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString cbStr = pArray->GetStringAt(i);
+ ByteString cbStr = pArray->GetStringAt(i);
if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) {
FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
return;
@@ -181,7 +181,7 @@
if (!pName)
return PAGEMODE_USENONE;
- CFX_ByteString strPageMode = pName->GetString();
+ ByteString strPageMode = pName->GetString();
if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone"))
return PAGEMODE_USENONE;
if (strPageMode.EqualNoCase("UseOutlines"))
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index b8e84c8..a276e3a 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -97,7 +97,7 @@
if (!pAnnotDic)
continue;
- CFX_ByteString sSubtype = pAnnotDic->GetStringFor("Subtype");
+ ByteString sSubtype = pAnnotDic->GetStringFor("Subtype");
if (sSubtype == "Popup")
continue;
@@ -168,18 +168,18 @@
return rcRet;
}
-uint32_t NewIndirectContentsStream(const CFX_ByteString& key,
+uint32_t NewIndirectContentsStream(const ByteString& key,
CPDF_Document* pDocument) {
CPDF_Stream* pNewContents = pDocument->NewIndirect<CPDF_Stream>(
nullptr, 0,
pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool()));
- CFX_ByteString sStream;
+ ByteString sStream;
sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
return pNewContents->GetObjNum();
}
-void SetPageContents(const CFX_ByteString& key,
+void SetPageContents(const ByteString& key,
CPDF_Dictionary* pPage,
CPDF_Document* pDocument) {
CPDF_Array* pContentsArray = nullptr;
@@ -199,9 +199,9 @@
pContentsArray = pDocument->NewIndirect<CPDF_Array>();
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pContentsStream);
pAcc->LoadAllData();
- CFX_ByteString sStream = "q\n";
- CFX_ByteString sBody =
- CFX_ByteString((const char*)pAcc->GetData(), pAcc->GetSize());
+ ByteString sStream = "q\n";
+ ByteString sBody =
+ ByteString((const char*)pAcc->GetData(), pAcc->GetSize());
sStream = sStream + sBody + "\nQ";
pContentsStream->SetDataAndRemoveFilter(sStream.raw_str(),
sStream.GetLength());
@@ -299,10 +299,10 @@
if (!pPageXObject)
pPageXObject = pRes->SetNewFor<CPDF_Dictionary>("XObject");
- CFX_ByteString key;
+ ByteString key;
int nStreams = pdfium::CollectionSize<int>(ObjectArray);
if (nStreams > 0) {
- CFX_ByteString sKey;
+ ByteString sKey;
int i = 0;
while (i < INT_MAX) {
sKey.Format("FFT%d", i);
@@ -336,7 +336,7 @@
CFX_FloatRect rcAnnot = pAnnotDic->GetRectFor("Rect");
rcAnnot.Normalize();
- CFX_ByteString sAnnotState = pAnnotDic->GetStringFor("AS");
+ ByteString sAnnotState = pAnnotDic->GetStringFor("AS");
CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDictFor("AP");
if (!pAnnotAP)
continue;
@@ -392,17 +392,17 @@
if (!pXObject)
pXObject = pNewXORes->SetNewFor<CPDF_Dictionary>("XObject");
- CFX_ByteString sFormName;
+ ByteString sFormName;
sFormName.Format("F%d", i);
pXObject->SetNewFor<CPDF_Reference>(sFormName, pDocument,
pObj->GetObjNum());
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pNewXObject);
pAcc->LoadAllData();
- CFX_ByteString sStream(pAcc->GetData(), pAcc->GetSize());
+ ByteString sStream(pAcc->GetData(), pAcc->GetSize());
CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix);
- CFX_ByteString sTemp;
+ ByteString sTemp;
sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
sFormName.c_str());
sStream += sTemp;
diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp
index a6bf60d..b1fca65 100644
--- a/fpdfsdk/fpdf_structtree.cpp
+++ b/fpdfsdk/fpdf_structtree.cpp
@@ -22,13 +22,13 @@
return static_cast<CPDF_StructElement*>(struct_element);
}
-unsigned long WideStringToBuffer(const CFX_WideString& str,
+unsigned long WideStringToBuffer(const WideString& str,
void* buffer,
unsigned long buflen) {
if (str.IsEmpty())
return 0;
- CFX_ByteString encodedStr = str.UTF16LE_Encode();
+ ByteString encodedStr = str.UTF16LE_Encode();
const unsigned long len = encodedStr.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encodedStr.c_str(), len);
diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp
index 43a4d01..05b77fc 100644
--- a/fpdfsdk/fpdf_structtree_embeddertest.cpp
+++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp
@@ -57,8 +57,8 @@
ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer,
sizeof(buffer)));
const wchar_t kExpected[] = L"Black Image";
- EXPECT_EQ(CFX_WideString(kExpected),
- CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
+ EXPECT_EQ(WideString(kExpected),
+ WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
ASSERT_EQ(1, FPDF_StructElement_CountChildren(gchild_element));
FPDF_STRUCTELEMENT ggchild_element =
@@ -91,8 +91,8 @@
ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer)));
const wchar_t kExpected[] = L"Document";
- EXPECT_EQ(CFX_WideString(kExpected),
- CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
+ EXPECT_EQ(WideString(kExpected),
+ WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
FPDF_StructTree_Close(struct_tree);
FPDF_ClosePage(page);
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 92c9937..875f3fd 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -73,7 +73,7 @@
return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
}
- bool GetFaceName(void* hFont, CFX_ByteString* name) override {
+ bool GetFaceName(void* hFont, ByteString* name) override {
if (!m_pInfo->GetFaceName)
return false;
uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
@@ -81,7 +81,7 @@
return false;
char* buffer = FX_Alloc(char, size);
size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size);
- *name = CFX_ByteString(buffer, size);
+ *name = ByteString(buffer, size);
FX_Free(buffer);
return true;
}
@@ -167,7 +167,7 @@
void* hFont,
char* buffer,
unsigned long buf_size) {
- CFX_ByteString name;
+ ByteString name;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name))
return 0;
@@ -175,7 +175,7 @@
return name.GetLength() + 1;
strncpy(buffer, name.c_str(),
- (name.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
+ (name.GetLength() + 1) * sizeof(ByteString::CharType));
return name.GetLength() + 1;
}
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 93df594..9480771 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -25,7 +25,7 @@
namespace {
void SetBoundingBox(CPDF_Page* page,
- const CFX_ByteString& key,
+ const ByteString& key,
float left,
float bottom,
float right,
@@ -38,7 +38,7 @@
}
bool GetBoundingBox(CPDF_Page* page,
- const CFX_ByteString& key,
+ const ByteString& key,
float* left,
float* bottom,
float* right,
@@ -111,12 +111,12 @@
CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right,
clipRect->top);
rect.Normalize();
- CFX_ByteString bsClipping;
+ ByteString bsClipping;
bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom,
rect.Width(), rect.Height());
textBuf << bsClipping;
- CFX_ByteString bsMatix;
+ ByteString bsMatix;
bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c,
matrix->d, matrix->e, matrix->f);
textBuf << bsMatix;
@@ -248,7 +248,7 @@
return;
}
- CFX_ByteString temp;
+ ByteString temp;
for (size_t i = 0; i < pPoints.size(); i++) {
buf << pPoints[i].m_Point.x << " " << pPoints[i].m_Point.y;
FXPT_TYPE point_type = pPoints[i].m_Type;
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 95f0f44..e08a3bf 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -483,7 +483,7 @@
pAnnotDict->SetNewFor<CPDF_Number>("CA", A / 255.f);
// Set the color of the annotation.
- CFX_ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C";
+ ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C";
CPDF_Array* pColor = pAnnotDict->GetArrayFor(key);
if (pColor)
pColor->Clear();
diff --git a/fpdfsdk/fpdfattachment.cpp b/fpdfsdk/fpdfattachment.cpp
index d984cf8..7402114 100644
--- a/fpdfsdk/fpdfattachment.cpp
+++ b/fpdfsdk/fpdfattachment.cpp
@@ -25,24 +25,23 @@
constexpr char kChecksumKey[] = "CheckSum";
-CFX_ByteString CFXByteStringHexDecode(const CFX_ByteString& bsHex) {
+ByteString CFXByteStringHexDecode(const ByteString& bsHex) {
uint8_t* result = nullptr;
uint32_t size = 0;
HexDecode(bsHex.raw_str(), bsHex.GetLength(), &result, &size);
- CFX_ByteString bsDecoded(result, size);
+ ByteString bsDecoded(result, size);
FX_Free(result);
return bsDecoded;
}
-CFX_ByteString GenerateMD5Base16(const void* contents,
- const unsigned long len) {
+ByteString GenerateMD5Base16(const void* contents, const unsigned long len) {
uint8_t digest[16];
CRYPT_MD5Generate(reinterpret_cast<const uint8_t*>(contents), len, digest);
char buf[32];
for (int i = 0; i < 16; ++i)
FXSYS_IntToTwoHexChars(digest[i], &buf[i * 2]);
- return CFX_ByteString(buf, 32);
+ return ByteString(buf, 32);
}
} // namespace
@@ -59,8 +58,8 @@
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- CFX_WideString wsName =
- CFX_WideString::FromUTF16LE(name, CFX_WideString::WStringLength(name));
+ WideString wsName =
+ WideString::FromUTF16LE(name, WideString::WStringLength(name));
if (!pDoc || wsName.IsEmpty())
return nullptr;
@@ -110,7 +109,7 @@
if (static_cast<size_t>(index) >= nameTree.GetCount())
return nullptr;
- CFX_WideString csName;
+ WideString csName;
return nameTree.LookupValueAndName(index, &csName);
}
@@ -171,8 +170,8 @@
if (!pParamsDict)
return false;
- CFX_ByteString bsKey = key;
- CFX_ByteString bsValue = CFXByteStringFromFPDFWideString(value);
+ ByteString bsKey = key;
+ ByteString bsValue = CFXByteStringFromFPDFWideString(value);
bool bEncodedAsHex = bsKey == kChecksumKey;
if (bEncodedAsHex)
bsValue = CFXByteStringHexDecode(bsValue);
@@ -194,12 +193,12 @@
if (!pParamsDict)
return 0;
- CFX_ByteString bsKey = key;
- CFX_WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
+ ByteString bsKey = key;
+ WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
if (bsKey == kChecksumKey && !value.IsEmpty()) {
CPDF_String* stringValue = pParamsDict->GetObjectFor(bsKey)->AsString();
if (stringValue->IsHex()) {
- CFX_ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
+ ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
value = CPDF_String(nullptr, encoded, false).GetUnicodeText();
}
}
@@ -233,7 +232,7 @@
// Set the creation date of the new attachment in the dictionary.
CFX_DateTime dateTime;
dateTime.Now();
- CFX_ByteString bsDateTime;
+ ByteString bsDateTime;
bsDateTime.Format("D:%d%02d%02d%02d%02d%02d", dateTime.GetYear(),
dateTime.GetMonth(), dateTime.GetDay(), dateTime.GetHour(),
dateTime.GetMinute(), dateTime.GetSecond());
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index f73336a..c3910b2 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -24,7 +24,7 @@
CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree,
CPDF_Bookmark bookmark,
- const CFX_WideString& title,
+ const WideString& title,
std::set<CPDF_Dictionary*>* visited) {
// Return if already checked to avoid circular calling.
if (pdfium::ContainsKey(*visited, bookmark.GetDict()))
@@ -91,7 +91,7 @@
if (!pDict)
return 0;
CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_WideString title = bookmark.GetTitle();
+ WideString title = bookmark.GetTitle();
return Utf16EncodeMaybeCopyAndReturnLength(title, buffer, buflen);
}
@@ -103,8 +103,8 @@
if (!pDoc)
return nullptr;
CPDF_BookmarkTree tree(pDoc);
- FX_STRSIZE len = CFX_WideString::WStringLength(title);
- CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len);
+ FX_STRSIZE len = WideString::WStringLength(title);
+ WideString encodedTitle = WideString::FromUTF16LE(title, len);
std::set<CPDF_Dictionary*> visited;
return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict();
}
@@ -174,7 +174,7 @@
return 0;
CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_ByteString path = action.GetFilePath().UTF8Encode();
+ ByteString path = action.GetFilePath().UTF8Encode();
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
memcpy(buffer, path.c_str(), len);
@@ -192,7 +192,7 @@
if (!pDoc)
return 0;
CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_ByteString path = action.GetURI(pDoc);
+ ByteString path = action.GetURI(pDoc);
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
memcpy(buffer, path.c_str(), len);
@@ -390,7 +390,7 @@
const CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (!pInfo)
return 0;
- CFX_WideString text = pInfo->GetUnicodeTextFor(tag);
+ WideString text = pInfo->GetUnicodeTextFor(tag);
return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen);
}
@@ -404,7 +404,7 @@
// CPDF_PageLabel can deal with NULL |document|.
CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document));
- CFX_WideString str;
+ WideString str;
if (!label.GetLabel(page_index, &str))
return 0;
return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen);
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index b44a8ec..5db610e 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -125,16 +125,14 @@
FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
EXPECT_TRUE(child);
EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
- CFX_WideString::FromUTF16LE(buf, 16));
+ EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16));
EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), child));
FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child);
EXPECT_TRUE(sibling);
EXPECT_EQ(28u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Ending"),
- CFX_WideString::FromUTF16LE(buf, 13));
+ EXPECT_EQ(WideString(L"A Good Ending"), WideString::FromUTF16LE(buf, 13));
EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), sibling));
}
@@ -152,8 +150,7 @@
// Check that the string matches.
unsigned short buf[128];
EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
- CFX_WideString::FromUTF16LE(buf, 16));
+ EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16));
// Check that it is them same as the one returned by GetFirstChild.
EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr));
@@ -201,19 +198,19 @@
constexpr wchar_t kExpectedCreator[] = L"Microsoft Word";
ASSERT_EQ(30u, FPDF_GetMetaText(document(), "Creator", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedCreator),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator)));
+ EXPECT_EQ(WideString(kExpectedCreator),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator)));
constexpr wchar_t kExpectedCreationDate[] = L"D:20160411190039+00'00'";
ASSERT_EQ(48u,
FPDF_GetMetaText(document(), "CreationDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedCreationDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate)));
+ EXPECT_EQ(WideString(kExpectedCreationDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate)));
constexpr wchar_t kExpectedModDate[] = L"D:20160411190039+00'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, GetMetaTextSameObjectNumber) {
@@ -225,8 +222,8 @@
unsigned short buf[128];
constexpr wchar_t kExpectedModDate[] = L"D:20170612232940-04'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) {
@@ -236,8 +233,8 @@
unsigned short buf[128];
constexpr wchar_t kExpectedModDate[] = L"D:20170712214448-07'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, NoPageLabels) {
@@ -257,38 +254,38 @@
const wchar_t kExpectedPageLabel0[] = L"i";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel0),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0)));
+ EXPECT_EQ(WideString(kExpectedPageLabel0),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0)));
const wchar_t kExpectedPageLabel1[] = L"ii";
ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel1),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1)));
+ EXPECT_EQ(WideString(kExpectedPageLabel1),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1)));
const wchar_t kExpectedPageLabel2[] = L"1";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel2),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2)));
+ EXPECT_EQ(WideString(kExpectedPageLabel2),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2)));
const wchar_t kExpectedPageLabel3[] = L"2";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel3),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3)));
+ EXPECT_EQ(WideString(kExpectedPageLabel3),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3)));
const wchar_t kExpectedPageLabel4[] = L"zzA";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel4),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4)));
+ EXPECT_EQ(WideString(kExpectedPageLabel4),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4)));
const wchar_t kExpectedPageLabel5[] = L"zzB";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel5),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5)));
+ EXPECT_EQ(WideString(kExpectedPageLabel5),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5)));
const wchar_t kExpectedPageLabel6[] = L"";
ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel6),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6)));
+ EXPECT_EQ(WideString(kExpectedPageLabel6),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6)));
ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 7, buf, sizeof(buf)));
ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 8, buf, sizeof(buf)));
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index faf6d97..ca2a457 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -64,8 +64,8 @@
EXPECT_TRUE(font_desc->KeyExist("Descent"));
EXPECT_TRUE(font_desc->KeyExist("CapHeight"));
EXPECT_TRUE(font_desc->KeyExist("StemV"));
- CFX_ByteString present("FontFile");
- CFX_ByteString absent("FontFile2");
+ ByteString present("FontFile");
+ ByteString absent("FontFile2");
if (font_type == FPDF_FONT_TRUETYPE)
std::swap(present, absent);
EXPECT_TRUE(font_desc->KeyExist(present));
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 5e31916..7036aa2 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -244,7 +244,7 @@
CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
CPDF_Object* pFilter =
pObj->AsImage()->GetImage()->GetDict()->GetDirectObjectFor("Filter");
- CFX_ByteString bsFilter;
+ ByteString bsFilter;
if (pFilter->IsName())
bsFilter = pFilter->AsName()->GetString();
else
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 79155e5..26f4424 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -100,7 +100,7 @@
pDoc->CreateNewDoc();
time_t currentTime;
- CFX_ByteString DateStr;
+ ByteString DateStr;
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) {
if (time(¤tTime) != -1) {
tm* pTM = localtime(¤tTime);
diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp
index 38f7cc2..2ac32b8 100644
--- a/fpdfsdk/fpdfedittext.cpp
+++ b/fpdfsdk/fpdfedittext.cpp
@@ -28,7 +28,7 @@
namespace {
CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
- const CFX_ByteString& font_name,
+ const ByteString& font_name,
CFX_Font* pFont,
const uint8_t* data,
uint32_t size,
@@ -71,8 +71,7 @@
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
pStream->SetData(data, size);
- CFX_ByteString fontFile =
- font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
+ ByteString fontFile = font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
fontDesc->SetNewFor<CPDF_Reference>(fontFile, pDoc, pStream->GetObjNum());
return fontDesc;
}
@@ -243,7 +242,7 @@
fontDict->SetNewFor<CPDF_Name>("Type", "Font");
fontDict->SetNewFor<CPDF_Name>(
"Subtype", font_type == FPDF_FONT_TYPE1 ? "Type1" : "TrueType");
- CFX_ByteString name = pFont->GetFaceName();
+ ByteString name = pFont->GetFaceName();
if (name.IsEmpty())
name = "Unnamed";
fontDict->SetNewFor<CPDF_Name>("BaseFont", name);
@@ -286,9 +285,9 @@
fontDict->SetNewFor<CPDF_Name>("Type", "Font");
fontDict->SetNewFor<CPDF_Name>("Subtype", "Type0");
// TODO(npm): Get the correct encoding, if it's not identity.
- CFX_ByteString encoding = "Identity-H";
+ ByteString encoding = "Identity-H";
fontDict->SetNewFor<CPDF_Name>("Encoding", encoding);
- CFX_ByteString name = pFont->GetFaceName();
+ ByteString name = pFont->GetFaceName();
if (name.IsEmpty())
name = "Unnamed";
fontDict->SetNewFor<CPDF_Name>(
@@ -404,7 +403,7 @@
if (!pDoc)
return nullptr;
- CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, CFX_ByteStringC(font));
+ CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, ByteStringView(font));
if (!pFont)
return nullptr;
@@ -421,9 +420,9 @@
if (!pTextObj)
return false;
- FX_STRSIZE len = CFX_WideString::WStringLength(text);
- CFX_WideString encodedText = CFX_WideString::FromUTF16LE(text, len);
- CFX_ByteString byteText;
+ FX_STRSIZE len = WideString::WStringLength(text);
+ WideString encodedText = WideString::FromUTF16LE(text, len);
+ ByteString byteText;
for (wchar_t wc : encodedText) {
pTextObj->GetFont()->AppendChar(
&byteText, pTextObj->GetFont()->CharCodeFromUnicode(wc));
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 1b5cc48..77cba50 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -66,11 +66,11 @@
}
#ifdef PDF_ENABLE_XFA
-std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) {
- return static_cast<std::vector<CFX_ByteString>*>(handle);
+std::vector<ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) {
+ return static_cast<std::vector<ByteString>*>(handle);
}
-FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) {
+FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<ByteString>* strings) {
return static_cast<FPDF_STRINGHANDLE>(strings);
}
#endif // PDF_ENABLE_XFA
@@ -387,8 +387,8 @@
if (!pPageView)
return 0;
- CFX_WideString wide_str_form_text = pPageView->GetSelectedText();
- CFX_ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode();
+ WideString wide_str_form_text = pPageView->GetSelectedText();
+ ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode();
unsigned long form_text_len = encoded_form_text.GetLength();
if (buffer && buflen >= form_text_len)
@@ -404,8 +404,8 @@
if (!pPageView)
return;
- FX_STRSIZE len = CFX_WideString::WStringLength(wsText);
- CFX_WideString wide_str_text = CFX_WideString::FromUTF16LE(wsText, len);
+ FX_STRSIZE len = WideString::WStringLength(wsText);
+ WideString wide_str_text = WideString::FromUTF16LE(wsText, len);
pPageView->ReplaceSelection(wide_str_text);
}
@@ -500,10 +500,10 @@
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wsCpText;
+ WideString wsCpText;
static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsCpText);
- CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
+ ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
if (!wsText) {
*size = len;
@@ -532,10 +532,10 @@
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wsCpText;
+ WideString wsCpText;
static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText);
- CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
+ ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
if (!wsText) {
*size = len;
@@ -564,7 +564,7 @@
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size);
+ WideString wstr = WideString::FromUTF16LE(wsText, size);
static_cast<CXFA_FFWidget*>(hWidget)->Paste(wstr);
}
@@ -585,7 +585,7 @@
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
- CFX_ByteStringC bs(bsText);
+ ByteStringView bs(bsText);
static_cast<CXFA_FFWidget*>(hWidget)->ReplaceSpellCheckWord(ptPopup, bs);
}
@@ -606,7 +606,7 @@
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
- auto sSuggestWords = pdfium::MakeUnique<std::vector<CFX_ByteString>>();
+ auto sSuggestWords = pdfium::MakeUnique<std::vector<ByteString>>();
static_cast<CXFA_FFWidget*>(hWidget)->GetSuggestWords(ptPopup,
sSuggestWords.get());
@@ -616,7 +616,7 @@
FPDF_EXPORT int FPDF_CALLCONV
FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) {
- std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
+ std::vector<ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
return sSuggestWords ? pdfium::CollectionSize<int>(*sSuggestWords) : -1;
}
@@ -632,7 +632,7 @@
if (index < 0 || index >= count)
return false;
- std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
+ std::vector<ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
uint32_t len = (*sSuggestWords)[index].GetLength();
if (!bsText) {
*size = len;
@@ -658,7 +658,7 @@
if (!stringHandle || !bsText || size == 0)
return false;
- FromFPDFStringHandle(stringHandle)->push_back(CFX_ByteString(bsText, size));
+ FromFPDFStringHandle(stringHandle)->push_back(ByteString(bsText, size));
return true;
}
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp
index 56e1662..2597b37 100644
--- a/fpdfsdk/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/fpdfformfill_embeddertest.cpp
@@ -106,7 +106,7 @@
FORM_OnLButtonUp(form_handle(), page_, 0, end.x, end.y);
}
- void CheckSelection(const CFX_WideStringC& expected_string) {
+ void CheckSelection(const WideStringView& expected_string) {
// Calculate expected length for selected text.
int num_chars = expected_string.GetLength();
@@ -121,8 +121,7 @@
EXPECT_EQ(expected_length, FORM_GetSelectedText(form_handle(), page_,
buf.data(), sel_text_len));
- EXPECT_EQ(expected_string,
- CFX_WideString::FromUTF16LE(buf.data(), num_chars));
+ EXPECT_EQ(expected_string, WideString::FromUTF16LE(buf.data(), num_chars));
}
private:
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index d08de02..230fd14 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -26,7 +26,7 @@
namespace {
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
- const CFX_ByteString& bsSrcTag) {
+ const ByteString& bsSrcTag) {
if (!pDict || bsSrcTag.IsEmpty())
return nullptr;
if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
@@ -58,7 +58,7 @@
bool CopyInheritable(CPDF_Dictionary* pCurPageDict,
CPDF_Dictionary* pSrcPageDict,
- const CFX_ByteString& key) {
+ const ByteString& key) {
if (pCurPageDict->KeyExist(key))
return true;
@@ -70,7 +70,7 @@
return true;
}
-bool ParserPageRangeString(CFX_ByteString rangstring,
+bool ParserPageRangeString(ByteString rangstring,
std::vector<uint16_t>* pageArray,
int nCount) {
if (rangstring.IsEmpty())
@@ -78,13 +78,13 @@
rangstring.Remove(' ');
FX_STRSIZE nLength = rangstring.GetLength();
- CFX_ByteString cbCompareString("0123456789-,");
+ ByteString cbCompareString("0123456789-,");
for (FX_STRSIZE i = 0; i < nLength; ++i) {
if (!cbCompareString.Contains(rangstring[i]))
return false;
}
- CFX_ByteString cbMidRange;
+ ByteString cbMidRange;
FX_STRSIZE nStringFrom = 0;
pdfium::Optional<FX_STRSIZE> nStringTo = 0;
while (nStringTo < nLength) {
@@ -165,7 +165,7 @@
pDocInfoDict->SetNewFor<CPDF_String>("Producer", "PDFium", false);
- CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
+ ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
pNewRoot->SetNewFor<CPDF_Name>("Type", "Catalog");
@@ -178,7 +178,7 @@
pNewPages->GetObjNum());
}
- CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
+ ByteString cbPageType = pNewPages->GetStringFor("Type", "");
if (cbPageType.IsEmpty())
pNewPages->SetNewFor<CPDF_Name>("Type", "Pages");
@@ -205,7 +205,7 @@
// Clone the page dictionary
for (const auto& it : *pSrcPageDict) {
- const CFX_ByteString& cbSrcKeyStr = it.first;
+ const ByteString& cbSrcKeyStr = it.first;
if (cbSrcKeyStr == "Type" || cbSrcKeyStr == "Parent")
continue;
@@ -271,7 +271,7 @@
CPDF_Dictionary* pDict = pObj->AsDictionary();
auto it = pDict->begin();
while (it != pDict->end()) {
- const CFX_ByteString& key = it->first;
+ const ByteString& key = it->first;
CPDF_Object* pNextObj = it->second.get();
++it;
if (key == "Parent" || key == "Prev" || key == "First")
@@ -330,7 +330,7 @@
std::unique_ptr<CPDF_Object> pClone = pDirect->Clone();
if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) {
if (pDictClone->KeyExist("Type")) {
- CFX_ByteString strType = pDictClone->GetStringFor("Type");
+ ByteString strType = pDictClone->GetStringFor("Type");
if (!FXSYS_stricmp(strType.c_str(), "Pages"))
return 4;
if (!FXSYS_stricmp(strType.c_str(), "Page"))
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 5b68da4..9742974 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -171,7 +171,7 @@
if (start >= textpage->CountChars())
return 0;
- CFX_WideString str = textpage->GetPageText(start, count - 1);
+ WideString str = textpage->GetPageText(start, count - 1);
if (str.GetLength() <= 0)
return 0;
@@ -180,7 +180,7 @@
// UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
// the number of items to stay the same.
- CFX_ByteString cbUTF16str = str.UTF16LE_Encode();
+ ByteString cbUTF16str = str.UTF16LE_Encode();
ASSERT(cbUTF16str.GetLength() / kBytesPerCharacter <=
static_cast<size_t>(count));
memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()),
@@ -229,12 +229,12 @@
CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
CFX_FloatRect rect((float)left, (float)bottom, (float)right, (float)top);
- CFX_WideString str = textpage->GetTextByRect(rect);
+ WideString str = textpage->GetTextByRect(rect);
if (buflen <= 0 || !buffer)
return str.GetLength();
- CFX_ByteString cbUTF16Str = str.UTF16LE_Encode();
+ ByteString cbUTF16Str = str.UTF16LE_Encode();
int len = cbUTF16Str.GetLength() / sizeof(unsigned short);
int size = buflen > len ? len : buflen;
memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)),
@@ -256,8 +256,8 @@
CPDF_TextPageFind* textpageFind =
new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
- FX_STRSIZE len = CFX_WideString::WStringLength(findwhat);
- textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags,
+ FX_STRSIZE len = WideString::WStringLength(findwhat);
+ textpageFind->FindFirst(WideString::FromUTF16LE(findwhat, len), flags,
start_index >= 0
? pdfium::Optional<FX_STRSIZE>(start_index)
: pdfium::Optional<FX_STRSIZE>());
@@ -330,12 +330,12 @@
int link_index,
unsigned short* buffer,
int buflen) {
- CFX_WideString wsUrl(L"");
+ WideString wsUrl(L"");
if (link_page && link_index >= 0) {
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
wsUrl = pageLink->GetURL(link_index);
}
- CFX_ByteString cbUTF16URL = wsUrl.UTF16LE_Encode();
+ ByteString cbUTF16URL = wsUrl.UTF16LE_Encode();
int required = cbUTF16URL.GetLength() / sizeof(unsigned short);
if (!buffer || buflen <= 0)
return required;
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 0aaafe8..8bca376 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -348,9 +348,9 @@
return static_cast<CPDF_Object*>(attachment);
}
-CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
- return CFX_WideString::FromUTF16LE(wide_string,
- CFX_WideString::WStringLength(wide_string))
+ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
+ return WideString::FromUTF16LE(wide_string,
+ WideString::WStringLength(wide_string))
.UTF8Encode();
}
@@ -358,10 +358,10 @@
return static_cast<CFX_DIBitmap*>(bitmap);
}
-unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
+unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text,
void* buffer,
unsigned long buflen) {
- CFX_ByteString encoded_text = text.UTF16LE_Encode();
+ ByteString encoded_text = text.UTF16LE_Encode();
unsigned long len = encoded_text.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encoded_text.c_str(), len);
@@ -380,7 +380,7 @@
// Decode the stream if one or more stream filters are specified.
uint8_t* decoded_data = nullptr;
uint32_t decoded_len = 0;
- CFX_ByteString dummy_last_decoder;
+ ByteString dummy_last_decoder;
CPDF_Dictionary* dummy_last_param;
if (PDF_DataDecode(data, len, dict, dict->GetIntegerFor("DL"), false,
&decoded_data, &decoded_len, &dummy_last_decoder,
@@ -1313,7 +1313,7 @@
if (!pDoc)
return DuplexUndefined;
CPDF_ViewerPreferences viewRef(pDoc);
- CFX_ByteString duplex = viewRef.Duplex();
+ ByteString duplex = viewRef.Duplex();
if ("Simplex" == duplex)
return Simplex;
if ("DuplexFlipShortEdge" == duplex)
@@ -1333,7 +1333,7 @@
return 0;
CPDF_ViewerPreferences viewRef(pDoc);
- CFX_ByteString bsVal;
+ ByteString bsVal;
if (!viewRef.GenericName(key, &bsVal))
return 0;
@@ -1375,7 +1375,7 @@
return nullptr;
CPDF_NameTree name_tree(pDoc, "Dests");
- return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(CFX_ByteString(name)));
+ return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(ByteString(name)));
}
#ifdef PDF_ENABLE_XFA
@@ -1450,7 +1450,7 @@
return nullptr;
CPDF_Object* pDestObj = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
CPDF_NameTree nameTree(pDoc, "Dests");
int count = nameTree.GetCount();
if (index >= count) {
@@ -1465,7 +1465,7 @@
index -= count;
int i = 0;
- CFX_ByteString bsName;
+ ByteString bsName;
for (const auto& it : *pDest) {
bsName = it.first;
pDestObj = it.second.get();
@@ -1489,7 +1489,7 @@
if (!pDestObj->IsArray())
return nullptr;
- CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
+ ByteString utf16Name = wsName.UTF16LE_Encode();
int len = utf16Name.GetLength();
if (!buffer) {
*buflen = len;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 1032d49..8779c44 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -219,19 +219,19 @@
return runtime->GetIsolate();
}
-CFX_WideString CPDFXFA_Context::GetAppTitle() const {
+WideString CPDFXFA_Context::GetAppTitle() const {
return L"PDFium";
}
-CFX_WideString CPDFXFA_Context::GetAppName() {
+WideString CPDFXFA_Context::GetAppName() {
return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : L"";
}
-CFX_WideString CPDFXFA_Context::GetLanguage() {
+WideString CPDFXFA_Context::GetLanguage() {
return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : L"";
}
-CFX_WideString CPDFXFA_Context::GetPlatform() {
+WideString CPDFXFA_Context::GetPlatform() {
return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : L"";
}
@@ -240,8 +240,8 @@
m_pFormFillEnv->JS_appBeep(dwType);
}
-int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle,
+int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage,
+ const WideString& wsTitle,
uint32_t dwIconType,
uint32_t dwButtonType) {
if (!m_pFormFillEnv)
@@ -292,12 +292,12 @@
return XFA_IDYes;
}
-CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle,
- const CFX_WideString& wsDefaultAnswer,
- bool bMark) {
+WideString CPDFXFA_Context::Response(const WideString& wsQuestion,
+ const WideString& wsTitle,
+ const WideString& wsDefaultAnswer,
+ bool bMark) {
if (!m_pFormFillEnv)
- return CFX_WideString();
+ return WideString();
int nLength = 2048;
std::vector<uint8_t> pBuff(nLength);
@@ -305,27 +305,27 @@
wsDefaultAnswer.c_str(), nullptr,
bMark, pBuff.data(), nLength);
if (nLength <= 0)
- return CFX_WideString();
+ return WideString();
nLength = std::min(2046, nLength);
pBuff[nLength] = 0;
pBuff[nLength + 1] = 0;
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nLength / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nLength / sizeof(uint16_t));
}
CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_Context::DownloadURL(
- const CFX_WideString& wsURL) {
+ const WideString& wsURL) {
return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str())
: nullptr;
}
-bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) {
+bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsContentType,
+ const WideString& wsEncode,
+ const WideString& wsHeader,
+ WideString& wsResponse) {
if (!m_pFormFillEnv)
return false;
@@ -335,9 +335,9 @@
return true;
}
-bool CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) {
+bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsEncode) {
return m_pFormFillEnv &&
m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(),
wsEncode.c_str());
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 586e12d..a0f90ab 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -56,31 +56,31 @@
void ClearChangeMark();
// IFXA_AppProvider:
- CFX_WideString GetLanguage() override;
- CFX_WideString GetPlatform() override;
- CFX_WideString GetAppName() override;
- CFX_WideString GetAppTitle() const override;
+ WideString GetLanguage() override;
+ WideString GetPlatform() override;
+ WideString GetAppName() override;
+ WideString GetAppTitle() const override;
void Beep(uint32_t dwType) override;
- int32_t MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle,
+ int32_t MsgBox(const WideString& wsMessage,
+ const WideString& wsTitle,
uint32_t dwIconType,
uint32_t dwButtonType) override;
- CFX_WideString Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle,
- const CFX_WideString& wsDefaultAnswer,
- bool bMark) override;
+ WideString Response(const WideString& wsQuestion,
+ const WideString& wsTitle,
+ const WideString& wsDefaultAnswer,
+ bool bMark) override;
CFX_RetainPtr<IFX_SeekableReadStream> DownloadURL(
- const CFX_WideString& wsURL) override;
- bool PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) override;
- bool PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) override;
+ const WideString& wsURL) override;
+ bool PostRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsContentType,
+ const WideString& wsEncode,
+ const WideString& wsHeader,
+ WideString& wsResponse) override;
+ bool PutRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsEncode) override;
IFWL_AdapterTimerMgr* GetTimerMgr() override;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 6537925..b4dc3f1 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -379,8 +379,7 @@
}
}
-void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
- CFX_WideString& wsTitle) {
+void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
@@ -388,13 +387,13 @@
if (!pInfoDict)
return;
- CFX_ByteString csTitle = pInfoDict->GetStringFor("Title");
+ ByteString csTitle = pInfoDict->GetStringFor("Title");
wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
csTitle.ReleaseBuffer(csTitle.GetLength());
}
void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsTitle) {
+ const WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
@@ -404,7 +403,7 @@
}
void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
+ const WideString& wsFilePath,
bool bXDP) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -419,14 +418,14 @@
return;
int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML;
- CFX_ByteString bs = wsFilePath.UTF16LE_Encode();
+ ByteString bs = wsFilePath.UTF16LE_Encode();
if (wsFilePath.IsEmpty()) {
if (!pFormFillEnv->GetFormFillInfo() ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) {
return;
}
- CFX_WideString filepath = pFormFillEnv->JS_fieldBrowse();
+ WideString filepath = pFormFillEnv->JS_fieldBrowse();
bs = filepath.UTF16LE_Encode();
}
int len = bs.GetLength();
@@ -439,7 +438,7 @@
CFX_RetainPtr<IFX_SeekableStream> fileWrite =
MakeSeekableStream(pFileHandler);
- CFX_ByteString content;
+ ByteString content;
if (fileType == FXFA_SAVEAS_XML) {
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
@@ -485,10 +484,10 @@
continue;
}
if (i == size - 1) {
- CFX_WideString wPath = CFX_WideString::FromUTF16LE(
+ WideString wPath = WideString::FromUTF16LE(
reinterpret_cast<const unsigned short*>(bs.c_str()),
bs.GetLength() / sizeof(unsigned short));
- CFX_ByteString bPath = wPath.UTF8Encode();
+ ByteString bPath = wPath.UTF8Encode();
const char* szFormat =
"\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>";
content.Format(szFormat, bPath.c_str());
@@ -505,7 +504,7 @@
}
void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
- const CFX_WideString& bsURL) {
+ const WideString& bsURL) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -516,7 +515,7 @@
if (!pFormFillEnv)
return;
- CFX_WideStringC str(bsURL.c_str());
+ WideStringView str(bsURL.c_str());
pFormFillEnv->GotoURL(m_pContext.Get(), str);
}
@@ -644,9 +643,9 @@
if (!pFormFillEnv)
return false;
- CFX_WideString ws;
+ WideString ws;
ws.FromLocal(IDS_XFA_Validate_Input);
- CFX_ByteString bs = ws.UTF16LE_Encode();
+ ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 1);
@@ -700,12 +699,12 @@
CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_DocEnvironment::OpenLinkedFile(
CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) {
+ const WideString& wsLink) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return nullptr;
- CFX_ByteString bs = wsLink.UTF16LE_Encode();
+ ByteString bs = wsLink.UTF16LE_Encode();
int len = bs.GetLength();
FPDF_FILEHANDLER* pFileHandler =
pFormFillEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb");
@@ -723,7 +722,7 @@
if (!m_pContext->GetXFADocView())
return false;
- CFX_ByteString content;
+ ByteString content;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return false;
@@ -808,7 +807,7 @@
return true;
}
-void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
+void CPDFXFA_DocEnvironment::ToXFAContentFlags(WideString csSrcContent,
FPDF_DWORD& flag) {
if (csSrcContent.Contains(L" config "))
flag |= FXFA_CONFIG;
@@ -830,19 +829,19 @@
}
}
-bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg) {
- CFX_WideString srcURL = csURL;
+bool CPDFXFA_DocEnvironment::MailToInfo(WideString& csURL,
+ WideString& csToAddress,
+ WideString& csCCAddress,
+ WideString& csBCCAddress,
+ WideString& csSubject,
+ WideString& csMsg) {
+ WideString srcURL = csURL;
srcURL.TrimLeft();
if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
return false;
auto pos = srcURL.Find(L'?');
- CFX_WideString tmp;
+ WideString tmp;
if (!pos.has_value()) {
pos = srcURL.Find(L'@');
if (!pos.has_value())
@@ -903,13 +902,13 @@
if (!pFormFillEnv)
return false;
- CFX_WideStringC csURLC;
+ WideStringView csURLC;
submit.GetSubmitTarget(csURLC);
- CFX_WideString csURL(csURLC);
+ WideString csURL(csURLC);
if (csURL.IsEmpty()) {
- CFX_WideString ws;
+ WideString ws;
ws.FromLocal("Submit cancelled.");
- CFX_ByteString bs = ws.UTF16LE_Encode();
+ ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 4);
@@ -921,13 +920,13 @@
int fileFlag = -1;
switch (submit.GetSubmitFormat()) {
case XFA_ATTRIBUTEENUM_Xdp: {
- CFX_WideStringC csContentC;
+ WideStringView csContentC;
submit.GetSubmitXDPContent(csContentC);
- CFX_WideString csContent;
+ WideString csContent;
csContent = csContentC;
csContent.TrimLeft();
csContent.TrimRight();
- CFX_WideString space;
+ WideString space;
space.FromLocal(" ");
csContent = space + csContent + space;
FPDF_DWORD flag = 0;
@@ -958,20 +957,20 @@
if (!pFileHandler)
return false;
if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
- CFX_WideString csToAddress;
- CFX_WideString csCCAddress;
- CFX_WideString csBCCAddress;
- CFX_WideString csSubject;
- CFX_WideString csMsg;
+ WideString csToAddress;
+ WideString csCCAddress;
+ WideString csBCCAddress;
+ WideString csSubject;
+ WideString csMsg;
if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
csMsg)) {
return false;
}
- CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
- CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
- CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode();
- CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode();
- CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode();
+ ByteString bsTo = WideString(csToAddress).UTF16LE_Encode();
+ ByteString bsCC = WideString(csCCAddress).UTF16LE_Encode();
+ ByteString bsBcc = WideString(csBCCAddress).UTF16LE_Encode();
+ ByteString bsSubject = WideString(csSubject).UTF16LE_Encode();
+ ByteString bsMsg = WideString(csMsg).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
@@ -986,8 +985,8 @@
bsMsg.ReleaseBuffer(bsMsg.GetStringLength());
} else {
// HTTP or FTP
- CFX_WideString ws;
- CFX_ByteString bs = csURL.UTF16LE_Encode();
+ WideString ws;
+ ByteString bs = csURL.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->UploadTo(pFileHandler, fileFlag,
(FPDF_WIDESTRING)bs.GetBuffer(len));
@@ -996,10 +995,9 @@
return true;
}
-bool CPDFXFA_DocEnvironment::SetGlobalProperty(
- CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::SetGlobalProperty(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
if (!m_pContext->GetFormFillEnv() ||
@@ -1013,10 +1011,9 @@
return bRet;
}
-bool CPDFXFA_DocEnvironment::GetGlobalProperty(
- CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::GetGlobalProperty(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
if (!m_pContext->GetFormFillEnv() ||
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 90bc6de..e6a0f92 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -49,12 +49,12 @@
void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override;
bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) override;
void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
- void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override;
- void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override;
+ void GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) override;
+ void SetTitle(CXFA_FFDoc* hDoc, const WideString& wsTitle) override;
void ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
+ const WideString& wsFilePath,
bool bXDP) override;
- void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override;
+ void GotoURL(CXFA_FFDoc* hDoc, const WideString& bsURL) override;
bool IsValidationsEnabled(CXFA_FFDoc* hDoc) override;
void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override;
@@ -79,32 +79,32 @@
bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override;
bool GetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) override;
bool SetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) override;
CFX_RetainPtr<IFX_SeekableReadStream> OpenLinkedFile(
CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) override;
+ const WideString& wsLink) override;
private:
bool OnBeforeNotifySubmit();
void OnAfterNotifySubmit();
bool NotifySubmit(bool bPrevOrPost);
bool SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit);
- bool MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg);
+ bool MailToInfo(WideString& csURL,
+ WideString& csToAddress,
+ WideString& csCCAddress,
+ WideString& csBCCAddress,
+ WideString& csSubject,
+ WideString& csMsg);
bool ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
int fileType,
FPDF_DWORD encodeType,
FPDF_DWORD flag);
- void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
+ void ToXFAContentFlags(WideString csSrcContent, FPDF_DWORD& flag);
CFX_UnownedPtr<CPDFXFA_Context> const m_pContext;
};
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index 776a171..ea7d2c3 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -29,10 +29,10 @@
bool CPDFSDK_ActionHandler::DoAction_JavaScript(
const CPDF_Action& JsAction,
- CFX_WideString csJSName,
+ WideString csJSName,
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
if (JsAction.GetType() == CPDF_Action::JavaScript) {
- CFX_WideString swJS = JsAction.GetJavaScript();
+ WideString swJS = JsAction.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentOpenJavaScript(pFormFillEnv, csJSName, swJS);
return true;
@@ -51,7 +51,7 @@
ASSERT(pFormFillEnv);
if (pFormFillEnv->IsJSInitiated() &&
JsAction.GetType() == CPDF_Action::JavaScript) {
- CFX_WideString swJS = JsAction.GetJavaScript();
+ WideString swJS = JsAction.GetJavaScript();
if (!swJS.IsEmpty()) {
RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS);
return true;
@@ -125,7 +125,7 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS);
}
@@ -156,13 +156,13 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnLink_MouseUp(pFormFillEnv);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -197,7 +197,7 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentPageJavaScript(pFormFillEnv, type, swJS);
}
@@ -244,7 +244,7 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS);
if (!IsValidField(pFormFillEnv, pFormField->GetFieldDict()))
@@ -280,11 +280,11 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -319,13 +319,13 @@
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnBookmark_MouseUp(pBookmark);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -444,7 +444,7 @@
const CPDF_Action& action) {
ASSERT(action.GetDict());
- CFX_ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
+ ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
pFormFillEnv->DoURIAction(sURI.c_str());
}
@@ -453,7 +453,7 @@
const CPDF_Action& action) {
ASSERT(action.GetDict());
- CFX_ByteString csName = action.GetNamedAction();
+ ByteString csName = action.GetNamedAction();
pFormFillEnv->ExecuteNamedAction(csName.c_str());
}
@@ -466,7 +466,7 @@
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
- const CFX_WideString& script) {
+ const WideString& script) {
ASSERT(type != CPDF_AAction::Calculate);
ASSERT(type != CPDF_AAction::Format);
@@ -509,7 +509,7 @@
break;
}
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -519,13 +519,13 @@
void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& sScriptName,
- const CFX_WideString& script) {
+ const WideString& sScriptName,
+ const WideString& script) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnDoc_Open(pFormFillEnv, sScriptName);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -536,7 +536,7 @@
void CPDFSDK_ActionHandler::RunDocumentPageJavaScript(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_AAction::AActionType type,
- const CFX_WideString& script) {
+ const WideString& script) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
switch (type) {
@@ -572,7 +572,7 @@
break;
}
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h
index 1c8dede..7457b4e 100644
--- a/fpdfsdk/fsdk_actionhandler.h
+++ b/fpdfsdk/fsdk_actionhandler.h
@@ -26,7 +26,7 @@
bool DoAction_DocOpen(const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
bool DoAction_JavaScript(const CPDF_Action& JsAction,
- CFX_WideString csJSName,
+ WideString csJSName,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
bool DoAction_Page(const CPDF_Action& action,
enum CPDF_AAction::AActionType eType,
@@ -86,15 +86,15 @@
CPDFSDK_FormFillEnvironment* pFormFillEnv);
void RunDocumentPageJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_AAction::AActionType type,
- const CFX_WideString& script);
+ const WideString& script);
void RunDocumentOpenJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& sScriptName,
- const CFX_WideString& script);
+ const WideString& sScriptName,
+ const WideString& script);
void RunFieldJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
- const CFX_WideString& script);
+ const WideString& script);
bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_Dictionary* pFieldDict);
diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h
index 91efc27..e58ddb1 100644
--- a/fpdfsdk/fsdk_define.h
+++ b/fpdfsdk/fsdk_define.h
@@ -70,11 +70,11 @@
CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment);
-CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
+ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap);
-unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
+unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text,
void* buffer,
unsigned long buflen);
diff --git a/fpdfsdk/fsdk_filewriteadapter.cpp b/fpdfsdk/fsdk_filewriteadapter.cpp
index 50394c3..fad058f 100644
--- a/fpdfsdk/fsdk_filewriteadapter.cpp
+++ b/fpdfsdk/fsdk_filewriteadapter.cpp
@@ -17,6 +17,6 @@
return fileWriteStruct_->WriteBlock(fileWriteStruct_, data, size) != 0;
}
-bool FSDK_FileWriteAdapter::WriteString(const CFX_ByteStringC& str) {
+bool FSDK_FileWriteAdapter::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
diff --git a/fpdfsdk/fsdk_filewriteadapter.h b/fpdfsdk/fsdk_filewriteadapter.h
index f2c3a53..5e9eaab 100644
--- a/fpdfsdk/fsdk_filewriteadapter.h
+++ b/fpdfsdk/fsdk_filewriteadapter.h
@@ -17,7 +17,7 @@
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool WriteBlock(const void* data, size_t size) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
private:
explicit FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct);
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index b7f7cbe..bffeac6 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -35,9 +35,9 @@
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) = 0;
- virtual CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0;
+ virtual WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0;
virtual void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) = 0;
+ const WideString& text) = 0;
virtual bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) = 0;
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index 41c71ec..9cc5d0f 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -37,7 +37,7 @@
bool Annot::hidden(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -71,9 +71,7 @@
return true;
}
-bool Annot::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (vp.IsGetting()) {
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -83,7 +81,7 @@
return true;
}
- CFX_WideString annotName;
+ WideString annotName;
vp >> annotName; // May invalidate m_pAnnot.
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -94,9 +92,7 @@
return true;
}
-bool Annot::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h
index d9757fa..d70f96a 100644
--- a/fpdfsdk/javascript/Annot.h
+++ b/fpdfsdk/javascript/Annot.h
@@ -17,9 +17,9 @@
explicit Annot(CJS_Object* pJSObject);
~Annot() override;
- bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
void SetSDKAnnot(CPDFSDK_BAAnnot* annot);
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 77f67b5..0c611c1 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -164,7 +164,7 @@
// the total number of fileds in document.
bool Document::numFields(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -175,13 +175,13 @@
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
- vp << static_cast<int>(pPDFForm->CountFields(CFX_WideString()));
+ vp << static_cast<int>(pPDFForm->CountFields(WideString()));
return true;
}
bool Document::dirty(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -202,7 +202,7 @@
bool Document::ADBE(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting())
vp.GetJSValue()->SetNull(pRuntime);
@@ -211,7 +211,7 @@
bool Document::pageNum(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -237,7 +237,7 @@
bool Document::addAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -245,7 +245,7 @@
bool Document::addField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -253,7 +253,7 @@
bool Document::exportAsText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -261,7 +261,7 @@
bool Document::exportAsFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -269,7 +269,7 @@
bool Document::exportAsXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -277,7 +277,7 @@
bool Document::getField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -286,7 +286,7 @@
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wideName = params[0].ToCFXWideString(pRuntime);
+ WideString wideName = params[0].ToCFXWideString(pRuntime);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (pPDFForm->CountFields(wideName) <= 0) {
@@ -311,7 +311,7 @@
bool Document::getNthFieldName(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -327,7 +327,7 @@
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
- CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString());
+ CPDF_FormField* pField = pPDFForm->GetField(nIndex, WideString());
if (!pField)
return false;
@@ -338,7 +338,7 @@
bool Document::importAnFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -346,7 +346,7 @@
bool Document::importAnXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -354,7 +354,7 @@
bool Document::importTextData(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -365,7 +365,7 @@
bool Document::mailForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -376,14 +376,13 @@
}
int iLength = params.size();
bool bUI = iLength > 0 ? params[0].ToBool(pRuntime) : true;
- CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cSubject =
- iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L"";
+ WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L"";
+ WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L"";
+ WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L"";
+ WideString cSubject = iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L"";
+ WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L"";
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
- CFX_ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
+ ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
if (sTextBuf.GetLength() == 0)
return false;
@@ -404,7 +403,7 @@
bool Document::print(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -472,7 +471,7 @@
bool Document::removeField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -486,7 +485,7 @@
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- CFX_WideString sFieldName = params[0].ToCFXWideString(pRuntime);
+ WideString sFieldName = params[0].ToCFXWideString(pRuntime);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
pInterForm->GetWidgets(sFieldName, &widgets);
@@ -531,7 +530,7 @@
bool Document::resetForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -566,7 +565,7 @@
for (int i = 0, isz = aName.GetLength(pRuntime); i < isz; ++i) {
CJS_Value valElement(pRuntime);
aName.GetElement(pRuntime, i, valElement);
- CFX_WideString swVal = valElement.ToCFXWideString(pRuntime);
+ WideString swVal = valElement.ToCFXWideString(pRuntime);
for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j)
aFields.push_back(pPDFForm->GetField(j, swVal));
}
@@ -582,7 +581,7 @@
bool Document::saveAs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -590,14 +589,14 @@
bool Document::syncAnnotScan(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::submitForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nSize = params.size();
if (nSize < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -609,7 +608,7 @@
}
CJS_Array aFields;
- CFX_WideString strURL;
+ WideString strURL;
bool bFDF = true;
bool bEmpty = false;
CJS_Value v = params[0];
@@ -653,7 +652,7 @@
CJS_Value valName(pRuntime);
aFields.GetElement(pRuntime, i, valName);
- CFX_WideString sName = valName.ToCFXWideString(pRuntime);
+ WideString sName = valName.ToCFXWideString(pRuntime);
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) {
CPDF_FormField* pField = pPDFForm->GetField(j, sName);
@@ -678,21 +677,21 @@
bool Document::bookmarkRoot(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::mailDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// TODO(tsepez): Check maximum number of allowed params.
bool bUI = true;
- CFX_WideString cTo = L"";
- CFX_WideString cCc = L"";
- CFX_WideString cBcc = L"";
- CFX_WideString cSubject = L"";
- CFX_WideString cMsg = L"";
+ WideString cTo = L"";
+ WideString cCc = L"";
+ WideString cBcc = L"";
+ WideString cSubject = L"";
+ WideString cMsg = L"";
if (params.size() >= 1)
bUI = params[0].ToBool(pRuntime);
@@ -739,13 +738,13 @@
bool Document::author(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Author", sError);
}
bool Document::info(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -758,46 +757,46 @@
if (!pDictionary)
return false;
- CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
- CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
- CFX_WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject");
- CFX_WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords");
- CFX_WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator");
- CFX_WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer");
- CFX_WideString cwCreationDate =
- pDictionary->GetUnicodeTextFor("CreationDate");
- CFX_WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate");
- CFX_WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped");
+ WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
+ WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
+ WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject");
+ WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords");
+ WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator");
+ WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer");
+ WideString cwCreationDate = pDictionary->GetUnicodeTextFor("CreationDate");
+ WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate");
+ WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped");
v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(-1);
pRuntime->PutObjectProperty(pObj, L"Author",
- pRuntime->NewString(cwAuthor.AsStringC()));
+ pRuntime->NewString(cwAuthor.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Title",
- pRuntime->NewString(cwTitle.AsStringC()));
+ pRuntime->NewString(cwTitle.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Subject",
- pRuntime->NewString(cwSubject.AsStringC()));
+ pRuntime->NewString(cwSubject.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Keywords",
- pRuntime->NewString(cwKeywords.AsStringC()));
+ pRuntime->NewString(cwKeywords.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Creator",
- pRuntime->NewString(cwCreator.AsStringC()));
+ pRuntime->NewString(cwCreator.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Producer",
- pRuntime->NewString(cwProducer.AsStringC()));
- pRuntime->PutObjectProperty(pObj, L"CreationDate",
- pRuntime->NewString(cwCreationDate.AsStringC()));
+ pRuntime->NewString(cwProducer.AsStringView()));
+ pRuntime->PutObjectProperty(
+ pObj, L"CreationDate",
+ pRuntime->NewString(cwCreationDate.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"ModDate",
- pRuntime->NewString(cwModDate.AsStringC()));
+ pRuntime->NewString(cwModDate.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Trapped",
- pRuntime->NewString(cwTrapped.AsStringC()));
+ pRuntime->NewString(cwTrapped.AsStringView()));
// It's to be compatible to non-standard info dictionary.
for (const auto& it : *pDictionary) {
- const CFX_ByteString& bsKey = it.first;
+ const ByteString& bsKey = it.first;
CPDF_Object* pValueObj = it.second.get();
- CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsStringC());
+ WideString wsKey = WideString::FromUTF8(bsKey.AsStringView());
if (pValueObj->IsString() || pValueObj->IsName()) {
pRuntime->PutObjectProperty(
pObj, wsKey,
- pRuntime->NewString(pValueObj->GetUnicodeText().AsStringC()));
+ pRuntime->NewString(pValueObj->GetUnicodeText().AsStringView()));
} else if (pValueObj->IsNumber()) {
pRuntime->PutObjectProperty(pObj, wsKey,
pRuntime->NewNumber(pValueObj->GetNumber()));
@@ -812,8 +811,8 @@
bool Document::getPropertyInternal(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError) {
+ const ByteString& propName,
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -829,7 +828,7 @@
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- CFX_WideString csProperty;
+ WideString csProperty;
vp >> csProperty;
pDictionary->SetNewFor<CPDF_String>(propName, PDF_EncodeText(csProperty),
false);
@@ -840,19 +839,19 @@
bool Document::creationDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "CreationDate", sError);
}
bool Document::creator(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Creator", sError);
}
bool Document::delay(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -880,31 +879,31 @@
bool Document::keywords(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Keywords", sError);
}
bool Document::modDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "ModDate", sError);
}
bool Document::producer(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Producer", sError);
}
bool Document::subject(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Subject", sError);
}
bool Document::title(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -914,7 +913,7 @@
bool Document::numPages(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -929,7 +928,7 @@
bool Document::external(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
// In Chrome case, should always return true.
if (vp.IsGetting()) {
vp << true;
@@ -939,7 +938,7 @@
bool Document::filesize(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -950,19 +949,19 @@
bool Document::mouseX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::mouseY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::URL(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -977,7 +976,7 @@
bool Document::baseURL(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << m_cwBaseURL;
} else {
@@ -988,7 +987,7 @@
bool Document::calculate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1006,7 +1005,7 @@
bool Document::documentFileName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1015,7 +1014,7 @@
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
+ WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
FX_STRSIZE i = wsFilePath.GetLength();
for (; i > 0; i--) {
if (wsFilePath[i - 1] == L'\\' || wsFilePath[i - 1] == L'/')
@@ -1032,7 +1031,7 @@
bool Document::path(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1047,41 +1046,41 @@
bool Document::pageWindowRect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::layout(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::addLink(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::closeDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getPageBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1091,7 +1090,7 @@
return false;
}
int nPageNo = params[0].ToInt(pRuntime);
- CFX_WideString swAnnotName = params[1].ToCFXWideString(pRuntime);
+ WideString swAnnotName = params[1].ToCFXWideString(pRuntime);
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo);
if (!pPageView)
return false;
@@ -1125,7 +1124,7 @@
bool Document::getAnnots(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1166,7 +1165,7 @@
bool Document::getAnnot3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
vRet.SetNull(pRuntime);
return true;
}
@@ -1174,21 +1173,21 @@
bool Document::getAnnots3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getOCGs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getLinks(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
@@ -1200,13 +1199,13 @@
bool Document::addIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
+ WideString swIconName = params[0].ToCFXWideString(pRuntime);
if (params[1].GetType() != CJS_Value::VT_object) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
return false;
@@ -1229,7 +1228,7 @@
bool Document::icons(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1261,13 +1260,13 @@
bool Document::getIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
+ WideString swIconName = params[0].ToCFXWideString(pRuntime);
auto it = std::find(m_IconNames.begin(), m_IconNames.end(), swIconName);
if (it == m_IconNames.end())
return false;
@@ -1287,7 +1286,7 @@
bool Document::removeIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, no supported.
return true;
}
@@ -1295,21 +1294,21 @@
bool Document::createDataObject(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not implemented.
return true;
}
bool Document::media(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::calculateNow(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1326,14 +1325,14 @@
bool Document::Collab(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getPageNthWord(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1366,7 +1365,7 @@
page.ParseContent();
int nWords = 0;
- CFX_WideString swRet;
+ WideString swRet;
for (auto& pPageObj : *page.GetPageObjectList()) {
if (pPageObj->IsText()) {
CPDF_TextObject* pTextObj = pPageObj->AsText();
@@ -1391,7 +1390,7 @@
bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1406,7 +1405,7 @@
bool Document::getPageNumWords(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1442,7 +1441,7 @@
bool Document::getPrintParams(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
v8::Local<v8::Object> pRetObj =
pRuntime->NewFxDynamicObj(CJS_PrintParamsObj::g_nObjDefnID);
if (pRetObj.IsEmpty())
@@ -1473,7 +1472,7 @@
float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
- CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
+ WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
uint16_t unicode = 0;
if (swUnicode.GetLength() > 0)
@@ -1490,9 +1489,8 @@
return nWords;
}
-CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
- int nWordIndex) {
- CFX_WideString swRet;
+WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex) {
+ WideString swRet;
CPDF_Font* pFont = pTextObj->GetFont();
if (!pFont)
@@ -1506,7 +1504,7 @@
float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
- CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
+ WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
uint16_t unicode = 0;
if (swUnicode.GetLength() > 0)
@@ -1528,7 +1526,7 @@
bool Document::zoom(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
@@ -1544,14 +1542,14 @@
bool Document::zoomType(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::deletePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, no supported.
return true;
}
@@ -1559,7 +1557,7 @@
bool Document::extractPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1567,7 +1565,7 @@
bool Document::insertPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1575,7 +1573,7 @@
bool Document::replacePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1583,7 +1581,7 @@
bool Document::getURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1591,7 +1589,7 @@
bool Document::gotoNamedDest(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1600,7 +1598,7 @@
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wideName = params[0].ToCFXWideString(pRuntime);
+ WideString wideName = params[0].ToCFXWideString(pRuntime);
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
return false;
@@ -1629,8 +1627,7 @@
m_DelayData.push_back(std::unique_ptr<CJS_DelayData>(pData));
}
-void Document::DoFieldDelay(const CFX_WideString& sFieldName,
- int nControlIndex) {
+void Document::DoFieldDelay(const WideString& sFieldName, int nControlIndex) {
std::vector<std::unique_ptr<CJS_DelayData>> DelayDataForFieldAndControlIndex;
auto iter = m_DelayData.begin();
while (iter != m_DelayData.end()) {
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index 91ca778..3cec9fa 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -50,265 +50,239 @@
explicit Document(CJS_Object* pJSObject);
~Document() override;
- bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool baseURL(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool baseURL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool bookmarkRoot(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool calculate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool creationDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool creator(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool creator(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool documentFileName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool external(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool filesize(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool keywords(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool modDate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool numFields(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool numPages(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool pageNum(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool external(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool filesize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool keywords(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool modDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numFields(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numPages(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool pageNum(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool pageWindowRect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool producer(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool subject(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool zoomType(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool producer(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool subject(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool zoomType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool addAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addLink(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool calculateNow(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool closeDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool createDataObject(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool deletePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool extractPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnots(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnot3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnots3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getLinks(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getNthFieldName(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getOCGs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNthWord(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNthWordQuads(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNumWords(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPrintParams(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool gotoNamedDest(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importAnFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importAnXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importTextData(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool insertPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool print(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool removeField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool replacePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool resetForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool saveAs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool submitForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool syncAnnotScan(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool removeIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
- bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
return m_pFormFillEnv.Get();
}
void AddDelayData(CJS_DelayData* pData);
- void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
+ void DoFieldDelay(const WideString& sFieldName, int nControlIndex);
CJS_Document* GetCJSDoc() const;
private:
bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
int CountWords(CPDF_TextObject* pTextObj);
- CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
+ WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
bool getPropertyInternal(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError);
+ const ByteString& propName,
+ WideString& sError);
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
- CFX_WideString m_cwBaseURL;
+ WideString m_cwBaseURL;
std::list<std::unique_ptr<CJS_DelayData>> m_DelayData;
// Needs to be a std::list for iterator stability.
- std::list<CFX_WideString> m_IconNames;
+ std::list<WideString> m_IconNames;
bool m_bDelay;
};
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 32d4477..fa5d478 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -163,9 +163,7 @@
IMPLEMENT_JS_CLASS(CJS_Field, Field)
-CJS_DelayData::CJS_DelayData(FIELD_PROP prop,
- int idx,
- const CFX_WideString& name)
+CJS_DelayData::CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name)
: eProp(prop), nControlIndex(idx), sFieldName(name) {}
CJS_DelayData::~CJS_DelayData() {}
@@ -210,8 +208,7 @@
strFieldName = strFieldNameParsed.substr(0, iStart);
}
-bool Field::AttachField(Document* pDocument,
- const CFX_WideString& csFieldName) {
+bool Field::AttachField(Document* pDocument, const WideString& csFieldName) {
m_pJSDoc = pDocument;
m_pFormFillEnv.Reset(pDocument->GetFormFillEnv());
m_bCanSet = m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM) ||
@@ -220,7 +217,7 @@
CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- CFX_WideString swFieldNameTemp = csFieldName;
+ WideString swFieldNameTemp = csFieldName;
swFieldNameTemp.Replace(L"..", L".");
if (pInterForm->CountFields(swFieldNameTemp) <= 0) {
@@ -243,7 +240,7 @@
std::vector<CPDF_FormField*> Field::GetFormFields(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& csFieldName) {
+ const WideString& csFieldName) {
std::vector<CPDF_FormField*> fields;
CPDFSDK_InterForm* pReaderInterForm = pFormFillEnv->GetInterForm();
CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
@@ -255,7 +252,7 @@
}
std::vector<CPDF_FormField*> Field::GetFormFields(
- const CFX_WideString& csFieldName) const {
+ const WideString& csFieldName) const {
return Field::GetFormFields(m_pFormFillEnv.Get(), csFieldName);
}
@@ -275,8 +272,8 @@
for (auto& pObserved : widgets) {
if (pObserved) {
bool bFormatted = false;
- CFX_WideString sValue = static_cast<CPDFSDK_Widget*>(pObserved.Get())
- ->OnFormat(bFormatted);
+ WideString sValue = static_cast<CPDFSDK_Widget*>(pObserved.Get())
+ ->OnFormat(bFormatted);
if (pObserved) { // Not redundant, may be clobbered by OnFormat.
static_cast<CPDFSDK_Widget*>(pObserved.Get())
->ResetAppearance(bFormatted ? &sValue : nullptr, false);
@@ -332,7 +329,7 @@
if (nFieldType == FIELDTYPE_COMBOBOX ||
nFieldType == FIELDTYPE_TEXTFIELD) {
bool bFormatted = false;
- CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ WideString sValue = pWidget->OnFormat(bFormatted);
pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false);
} else {
pWidget->ResetAppearance(nullptr, false);
@@ -356,8 +353,7 @@
return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr;
}
-bool Field::ValueIsOccur(CPDF_FormField* pFormField,
- CFX_WideString csOptLabel) {
+bool Field::ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel) {
for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
return true;
@@ -379,14 +375,14 @@
bool Field::alignment(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString alignStr;
+ ByteString alignStr;
vp >> alignStr;
if (m_bDelay) {
@@ -427,22 +423,22 @@
}
void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::borderStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString strType = "";
+ ByteString strType = "";
vp >> strType;
if (m_bDelay) {
@@ -491,9 +487,9 @@
}
void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
ASSERT(pFormFillEnv);
BorderStyle nBorderStyle = BorderStyle::SOLID;
@@ -544,7 +540,7 @@
bool Field::buttonAlignX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -585,7 +581,7 @@
}
void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -593,7 +589,7 @@
bool Field::buttonAlignY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -634,7 +630,7 @@
}
void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -642,7 +638,7 @@
bool Field::buttonFitBounds(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -678,7 +674,7 @@
}
void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -686,7 +682,7 @@
bool Field::buttonPosition(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -721,7 +717,7 @@
}
void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -729,7 +725,7 @@
bool Field::buttonScaleHow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -769,7 +765,7 @@
}
void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -777,7 +773,7 @@
bool Field::buttonScaleWhen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -828,7 +824,7 @@
}
void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -836,7 +832,7 @@
bool Field::calcOrderIndex(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -872,7 +868,7 @@
}
void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -880,7 +876,7 @@
bool Field::charLimit(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -911,15 +907,13 @@
}
void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
}
-bool Field::comb(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -954,7 +948,7 @@
}
void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -962,7 +956,7 @@
bool Field::commitOnSelChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -999,7 +993,7 @@
}
void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1007,7 +1001,7 @@
bool Field::currentValueIndices(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1064,7 +1058,7 @@
}
void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const std::vector<uint32_t>& array) {
ASSERT(pFormFillEnv);
@@ -1091,26 +1085,26 @@
bool Field::defaultStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex) {
// Not supported.
}
bool Field::defaultValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_WideString WideStr;
+ WideString WideStr;
vp >> WideStr;
if (m_bDelay) {
@@ -1136,15 +1130,15 @@
}
void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string) {
+ const WideString& string) {
// Not supported.
}
bool Field::doNotScroll(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1179,7 +1173,7 @@
}
void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1187,7 +1181,7 @@
bool Field::doNotSpellCheck(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1227,7 +1221,7 @@
bool Field::delay(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsSetting()) {
vp << m_bDelay;
return true;
@@ -1243,7 +1237,7 @@
bool Field::display(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1288,7 +1282,7 @@
}
void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -1323,9 +1317,7 @@
}
}
-bool Field::doc(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1335,7 +1327,7 @@
bool Field::editable(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1358,7 +1350,7 @@
bool Field::exportValues(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1398,7 +1390,7 @@
bool Field::fileSelect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1421,7 +1413,7 @@
bool Field::fillColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1481,7 +1473,7 @@
}
void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -1489,7 +1481,7 @@
bool Field::hidden(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1526,7 +1518,7 @@
}
void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
int display = b ? 1 /*Hidden*/ : 0 /*Visible*/;
@@ -1535,13 +1527,13 @@
bool Field::highlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString strMode;
+ ByteString strMode;
vp >> strMode;
if (m_bDelay) {
@@ -1586,15 +1578,15 @@
}
void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::lineWidth(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1633,7 +1625,7 @@
}
void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -1673,7 +1665,7 @@
bool Field::multiline(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1708,7 +1700,7 @@
}
void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1716,7 +1708,7 @@
bool Field::multipleSelection(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1745,15 +1737,13 @@
}
void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
}
-bool Field::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1767,7 +1757,7 @@
bool Field::numItems(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1785,9 +1775,7 @@
return true;
}
-bool Field::page(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1832,7 +1820,7 @@
bool Field::password(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1863,7 +1851,7 @@
}
void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1871,7 +1859,7 @@
bool Field::print(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1942,7 +1930,7 @@
bool Field::radiosInUnison(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1965,7 +1953,7 @@
bool Field::readonly(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1982,9 +1970,7 @@
return true;
}
-bool Field::rect(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
CJS_Value Upper_Leftx(pRuntime);
CJS_Value Upper_Lefty(pRuntime);
CJS_Value Lower_Rightx(pRuntime);
@@ -2045,7 +2031,7 @@
}
void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_FloatRect& rect) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -2104,7 +2090,7 @@
bool Field::required(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2127,7 +2113,7 @@
bool Field::richText(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2156,13 +2142,13 @@
bool Field::richValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::rotation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2193,7 +2179,7 @@
}
void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -2201,7 +2187,7 @@
bool Field::strokeColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
if (vp.IsSetting()) {
@@ -2259,7 +2245,7 @@
}
void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -2267,14 +2253,14 @@
bool Field::style(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString csBCaption;
+ ByteString csBCaption;
vp >> csBCaption;
if (m_bDelay) {
@@ -2299,8 +2285,8 @@
if (!pFormControl)
return false;
- CFX_WideString csWCaption = pFormControl->GetNormalCaption();
- CFX_ByteString csBCaption;
+ WideString csWCaption = pFormControl->GetNormalCaption();
+ ByteString csBCaption;
switch (csWCaption[0]) {
case L'l':
@@ -2327,21 +2313,21 @@
}
void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::submitName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::textColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
if (vp.IsSetting()) {
@@ -2395,7 +2381,7 @@
}
void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -2403,14 +2389,14 @@
bool Field::textFont(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString csFontName;
+ ByteString csFontName;
vp >> csFontName;
if (csFontName.IsEmpty())
return false;
@@ -2447,15 +2433,15 @@
}
void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::textSize(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2490,15 +2476,13 @@
}
void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
}
-bool Field::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -2541,14 +2525,14 @@
bool Field::userName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_WideString swName;
+ WideString swName;
vp >> swName;
if (m_bDelay) {
@@ -2568,20 +2552,20 @@
}
void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string) {
+ const WideString& string) {
// Not supported.
}
bool Field::value(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- std::vector<CFX_WideString> strArray;
+ std::vector<WideString> strArray;
if (vp.GetJSValue()->IsArrayObject()) {
CJS_Array ValueArray;
vp.GetJSValue()->ConvertToArray(pRuntime, ValueArray);
@@ -2591,7 +2575,7 @@
strArray.push_back(ElementValue.ToCFXWideString(pRuntime));
}
} else {
- CFX_WideString swValue;
+ WideString swValue;
vp >> swValue;
strArray.push_back(swValue);
}
@@ -2660,9 +2644,9 @@
}
void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const std::vector<CFX_WideString>& strArray) {
+ const std::vector<WideString>& strArray) {
ASSERT(pFormFillEnv);
if (strArray.empty())
return;
@@ -2715,7 +2699,7 @@
bool Field::valueAsString(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -2758,7 +2742,7 @@
bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2766,7 +2750,7 @@
CPDF_FormField* pFormField = FieldArray[0];
if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
(pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) {
- CFX_WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
+ WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
if (!wsFileName.IsEmpty()) {
pFormField->SetValue(wsFileName);
UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
@@ -2779,7 +2763,7 @@
bool Field::buttonGetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -2812,7 +2796,7 @@
bool Field::buttonGetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() >= 1) {
int nFace = params[0].ToInt(pRuntime);
if (nFace < 0 || nFace > 2)
@@ -2844,28 +2828,28 @@
bool Field::buttonImportIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::buttonSetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::buttonSetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::checkThisBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
if (iSize < 1)
return false;
@@ -2902,14 +2886,14 @@
bool Field::clearItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_bCanSet)
return false;
@@ -2936,28 +2920,27 @@
bool Field::deleteItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::getArray(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
- std::vector<std::unique_ptr<CFX_WideString>> swSort;
+ std::vector<std::unique_ptr<WideString>> swSort;
for (CPDF_FormField* pFormField : FieldArray) {
- swSort.push_back(std::unique_ptr<CFX_WideString>(
- new CFX_WideString(pFormField->GetFullName())));
+ swSort.push_back(
+ std::unique_ptr<WideString>(new WideString(pFormField->GetFullName())));
}
- std::sort(
- swSort.begin(), swSort.end(),
- [](const std::unique_ptr<CFX_WideString>& p1,
- const std::unique_ptr<CFX_WideString>& p2) { return *p1 < *p2; });
+ std::sort(swSort.begin(), swSort.end(),
+ [](const std::unique_ptr<WideString>& p1,
+ const std::unique_ptr<WideString>& p2) { return *p1 < *p2; });
CJS_Array FormFieldArray;
@@ -2982,7 +2965,7 @@
bool Field::getItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
int nIdx = -1;
if (iSize >= 1)
@@ -3002,7 +2985,7 @@
if (nIdx == -1 || nIdx > pFormField->CountOptions())
nIdx = pFormField->CountOptions() - 1;
if (bExport) {
- CFX_WideString strval = pFormField->GetOptionValue(nIdx);
+ WideString strval = pFormField->GetOptionValue(nIdx);
if (strval.IsEmpty())
vRet = CJS_Value(pRuntime, pFormField->GetOptionLabel(nIdx).c_str());
else
@@ -3020,21 +3003,21 @@
bool Field::getLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::insertItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::isBoxChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt(pRuntime);
@@ -3058,7 +3041,7 @@
bool Field::isDefaultChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt(pRuntime);
@@ -3081,14 +3064,14 @@
bool Field::setAction(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::setFocus(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -3133,62 +3116,62 @@
bool Field::setItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::setLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureGetModifications(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureGetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureInfo(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureSetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureSign(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureValidate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::source(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << (CJS_Object*)nullptr;
}
@@ -3210,14 +3193,14 @@
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string) {
+void Field::AddDelay_String(FIELD_PROP prop, const ByteString& string) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->string = string;
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string) {
+void Field::AddDelay_WideString(FIELD_PROP prop, const WideString& string) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestring = string;
@@ -3247,7 +3230,7 @@
}
void Field::AddDelay_WideStringArray(FIELD_PROP prop,
- const std::vector<CFX_WideString>& array) {
+ const std::vector<WideString>& array) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestringarray = array;
@@ -3397,7 +3380,7 @@
void Field::AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nPageIndex,
int nFieldType,
- const CFX_WideString& sName,
+ const WideString& sName,
const CFX_FloatRect& rcCoords) {
// Not supported.
}
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index 1c8d6be..2ca1da4 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -56,20 +56,20 @@
};
struct CJS_DelayData {
- CJS_DelayData(FIELD_PROP prop, int idx, const CFX_WideString& name);
+ CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name);
~CJS_DelayData();
FIELD_PROP eProp;
int nControlIndex;
- CFX_WideString sFieldName;
+ WideString sFieldName;
int32_t num;
bool b;
- CFX_ByteString string;
- CFX_WideString widestring;
+ ByteString string;
+ WideString widestring;
CFX_FloatRect rect;
CFX_Color color;
std::vector<uint32_t> wordarray;
- std::vector<CFX_WideString> widestringarray;
+ std::vector<WideString> widestringarray;
};
class Field : public CJS_EmbedObj {
@@ -77,380 +77,338 @@
explicit Field(CJS_Object* pJSObject);
~Field() override;
- bool alignment(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool alignment(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool borderStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonAlignX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonAlignY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonFitBounds(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonPosition(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonScaleHow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonScaleWhen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool calcOrderIndex(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool charLimit(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool charLimit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool commitOnSelChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool currentValueIndices(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool doNotScroll(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool doNotSpellCheck(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool display(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool editable(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool display(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool editable(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool exportValues(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fileSelect(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fillColor(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool highlight(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool lineWidth(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool multiline(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool fileSelect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fillColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool highlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool lineWidth(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool multiline(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool multipleSelection(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool numItems(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool password(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numItems(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool password(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool radiosInUnison(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool readonly(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool required(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richText(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richValue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool rotation(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool readonly(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool required(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richText(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rotation(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool strokeColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool submitName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textColor(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textFont(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textSize(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool userName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool submitName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textFont(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textSize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool userName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool valueAsString(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool browseForFileToSubmit(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonGetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonGetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonImportIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonSetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonSetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool checkThisBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultIsChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool deleteItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getArray(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool insertItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool isBoxChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool isDefaultChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setAction(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setFocus(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureGetModifications(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureGetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureInfo(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureSetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureSign(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureValidate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const std::vector<uint32_t>& array);
static void SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex);
static void SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string);
+ const WideString& string);
static void SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_FloatRect& rect);
static void SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string);
+ const WideString& string);
static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const std::vector<CFX_WideString>& strArray);
+ const std::vector<WideString>& strArray);
static void AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nPageIndex,
int nFieldType,
- const CFX_WideString& sName,
+ const WideString& sName,
const CFX_FloatRect& rcCoords);
static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -468,12 +426,12 @@
CPDF_FormControl* pFormControl);
static std::vector<CPDF_FormField*> GetFormFields(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& csFieldName);
+ const WideString& csFieldName);
static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_DelayData* pData);
- bool AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+ bool AttachField(Document* pDocument, const WideString& csFieldName);
void SetDelay(bool bDelay);
protected:
@@ -481,26 +439,26 @@
std::wstring& strFieldName,
int& iControlNo);
std::vector<CPDF_FormField*> GetFormFields(
- const CFX_WideString& csFieldName) const;
+ const WideString& csFieldName) const;
CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- bool ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+ bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel);
void AddDelay_Int(FIELD_PROP prop, int32_t n);
void AddDelay_Bool(FIELD_PROP prop, bool b);
- void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string);
- void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string);
+ void AddDelay_String(FIELD_PROP prop, const ByteString& string);
+ void AddDelay_WideString(FIELD_PROP prop, const WideString& string);
void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color);
void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
void AddDelay_WideStringArray(FIELD_PROP prop,
- const std::vector<CFX_WideString>& array);
+ const std::vector<WideString>& array);
void DoDelay();
public:
Document* m_pJSDoc;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
- CFX_WideString m_FieldName;
+ WideString m_FieldName;
int m_nFormControlIndex;
bool m_bCanSet;
bool m_bDelay;
diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp
index fa2f92f..47781dd 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -25,9 +25,7 @@
Icon::~Icon() {}
-bool Icon::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Icon::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h
index 5580678..e856ee9 100644
--- a/fpdfsdk/javascript/Icon.h
+++ b/fpdfsdk/javascript/Icon.h
@@ -16,12 +16,12 @@
explicit Icon(CJS_Object* pJSObject);
~Icon() override;
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- CFX_WideString GetIconName() const { return m_swIconName; }
- void SetIconName(CFX_WideString name) { m_swIconName = name; }
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ WideString GetIconName() const { return m_swIconName; }
+ void SetIconName(WideString name) { m_swIconName = name; }
private:
- CFX_WideString m_swIconName;
+ WideString m_swIconName;
};
class CJS_Icon : public CJS_Object {
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index f360e8f..470a8fe 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -34,7 +34,7 @@
v8::FunctionCallback pMethodCall;
};
-template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -48,7 +48,7 @@
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_PropValue value(pRuntime);
value.StartGetting();
if (!(pObj->*M)(pRuntime, value, sError)) {
@@ -59,7 +59,7 @@
info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(pRuntime));
}
-template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -74,7 +74,7 @@
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_PropValue propValue(pRuntime, CJS_Value(pRuntime, value));
propValue.StartSetting();
if (!(pObj->*M)(pRuntime, propValue, sError)) {
@@ -101,7 +101,7 @@
bool (C::*M)(CJS_Runtime*,
const std::vector<CJS_Value>&,
CJS_Value&,
- CFX_WideString&)>
+ WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -118,7 +118,7 @@
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_Value valueRes(pRuntime);
if (!(pObj->*M)(pRuntime, parameters, valueRes, sError)) {
pRuntime->Error(
@@ -325,8 +325,8 @@
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
bool bRet = pObj->QueryProperty(propname.c_str());
info.GetReturnValue().Set(bRet ? 4 : 0);
}
@@ -347,9 +347,9 @@
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
CJS_PropValue value(pRuntime);
value.StartGetting();
if (!pObj->DoProperty(pRuntime, propname.c_str(), value, sError)) {
@@ -376,9 +376,9 @@
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
CJS_PropValue PropValue(pRuntime, CJS_Value(pRuntime, value));
PropValue.StartSetting();
if (!pObj->DoProperty(pRuntime, propname.c_str(), PropValue, sError)) {
@@ -402,20 +402,18 @@
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
if (!pObj->DelProperty(pRuntime, propname.c_str(), sError)) {
- CFX_ByteString cbName;
+ ByteString cbName;
cbName.Format("%s.%s", class_name, "DelProperty");
// Probably a missing call to JSFX_Error().
}
}
-template <bool (*F)(CJS_Runtime*,
- const std::vector<CJS_Value>&,
- CJS_Value&,
- CFX_WideString&)>
+template <bool (
+ *F)(CJS_Runtime*, const std::vector<CJS_Value>&, CJS_Value&, WideString&)>
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
CJS_Runtime* pRuntime =
@@ -427,7 +425,7 @@
parameters.push_back(CJS_Value(pRuntime, info[i]));
}
CJS_Value valueRes(pRuntime);
- CFX_WideString sError;
+ WideString sError;
if (!(*F)(pRuntime, parameters, valueRes, sError)) {
pRuntime->Error(JSFormatErrorString(func_name_string, nullptr, sError));
return;
diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp
index a63b7a8..670d43e 100644
--- a/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -43,7 +43,7 @@
}
void CJS_EventHandler::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
Initial(JET_DOC_OPEN);
m_pTargetFormFillEnv.Reset(pFormFillEnv);
m_strTargetName = strTargetName;
@@ -146,36 +146,36 @@
void CJS_EventHandler::OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
Initial(JET_FIELD_FOCUS);
m_bModifier = bModifier;
m_bShift = bShift;
m_strTargetName = pTarget->GetFullName();
- m_pValue = (CFX_WideString*)&Value;
+ m_pValue = (WideString*)&Value;
}
void CJS_EventHandler::OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
Initial(JET_FIELD_BLUR);
m_bModifier = bModifier;
m_bShift = bShift;
m_strTargetName = pTarget->GetFullName();
- m_pValue = (CFX_WideString*)&Value;
+ m_pValue = (WideString*)&Value;
}
-void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventHandler::OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) {
@@ -196,13 +196,13 @@
m_bFieldFull = bFieldFull;
}
-void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventHandler::OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
Initial(JET_FIELD_VALIDATE);
@@ -218,7 +218,7 @@
void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
Initial(JET_FIELD_CALCULATE);
@@ -230,7 +230,7 @@
}
void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) {
Initial(JET_FIELD_FORMAT);
@@ -351,7 +351,7 @@
void CJS_EventHandler::OnMenu_Exec(
CPDFSDK_FormFillEnvironment* pTargetFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
Initial(JET_MENU_EXEC);
m_pTargetFormFillEnv.Reset(pTargetFormFillEnv);
m_strTargetName = strTargetName;
@@ -408,14 +408,14 @@
return m_bValid;
}
-CFX_WideString& CJS_EventHandler::Change() {
+WideString& CJS_EventHandler::Change() {
if (m_pWideStrChange) {
return *m_pWideStrChange;
}
return m_WideStrChangeDu;
}
-CFX_WideString CJS_EventHandler::ChangeEx() {
+WideString CJS_EventHandler::ChangeEx() {
return m_WideStrChangeEx;
}
@@ -640,7 +640,7 @@
return pField;
}
-CFX_WideString& CJS_EventHandler::Value() {
+WideString& CJS_EventHandler::Value() {
return *m_pValue;
}
@@ -648,6 +648,6 @@
return m_bWillCommit;
}
-CFX_WideString CJS_EventHandler::TargetName() {
+WideString CJS_EventHandler::TargetName() {
return m_strTargetName;
}
diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h
index 82d9d6a..8273b41 100644
--- a/fpdfsdk/javascript/JS_EventHandler.h
+++ b/fpdfsdk/javascript/JS_EventHandler.h
@@ -67,7 +67,7 @@
void OnApp_Init();
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName);
+ const WideString& strTargetName);
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv);
@@ -81,30 +81,30 @@
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc);
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit);
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc);
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc);
void OnField_MouseDown(bool bModifier, bool bShift, CPDF_FormField* pTarget);
@@ -114,11 +114,11 @@
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value);
+ const WideString& Value);
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value);
+ const WideString& Value);
void OnScreen_Focus(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
void OnScreen_Blur(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
@@ -135,7 +135,7 @@
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName);
+ const WideString& strTargetName);
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnConsole_Exec();
void OnExternal_Exec();
@@ -145,8 +145,8 @@
void Destroy();
bool IsValid();
- CFX_WideString& Change();
- CFX_WideString ChangeEx();
+ WideString& Change();
+ WideString ChangeEx();
int CommitKey();
bool FieldFull();
bool KeyDown();
@@ -159,9 +159,9 @@
bool Shift();
Field* Source();
Field* Target_Field();
- CFX_WideString& Value();
+ WideString& Value();
bool WillCommit();
- CFX_WideString TargetName();
+ WideString TargetName();
JS_EVENT_T EventType() { return m_eEventType; }
@@ -170,11 +170,11 @@
JS_EVENT_T m_eEventType;
bool m_bValid;
- CFX_WideString m_strTargetName;
- CFX_WideString m_strSourceName;
- CFX_UnownedPtr<CFX_WideString> m_pWideStrChange;
- CFX_WideString m_WideStrChangeDu;
- CFX_WideString m_WideStrChangeEx;
+ WideString m_strTargetName;
+ WideString m_strSourceName;
+ CFX_UnownedPtr<WideString> m_pWideStrChange;
+ WideString m_WideStrChangeDu;
+ WideString m_WideStrChangeEx;
int m_nCommitKey;
bool m_bKeyDown;
bool m_bModifier;
@@ -184,7 +184,7 @@
int* m_pISelStart;
int m_nSelStartDu;
bool m_bWillCommit;
- CFX_UnownedPtr<CFX_WideString> m_pValue;
+ CFX_UnownedPtr<WideString> m_pValue;
bool m_bFieldFull;
bool* m_pbRc;
bool m_bRcDu;
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index 1420264..ce3ce68 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -32,7 +32,7 @@
0xf8, 0x77, 0xd5, 0xa3};
// Returns true if non-empty, setting sPropName
-bool TrimPropName(CFX_ByteString* sPropName) {
+bool TrimPropName(ByteString* sPropName) {
sPropName->TrimLeft();
sPropName->TrimRight();
return sPropName->GetLength() != 0;
@@ -69,7 +69,7 @@
}
CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable(
- const CFX_ByteString& propname) {
+ const ByteString& propname) {
for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
++it) {
if ((*it)->data.sKey == propname)
@@ -79,7 +79,7 @@
}
CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable(
- const CFX_ByteString& propname) const {
+ const ByteString& propname) const {
for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
++it) {
if ((*it)->data.sKey == propname)
@@ -89,14 +89,14 @@
}
CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable(
- const CFX_ByteString& propname) {
+ const ByteString& propname) {
auto iter = FindGlobalVariable(propname);
return iter != m_arrayGlobalData.end() ? iter->get() : nullptr;
}
-void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableNumber(const ByteString& propname,
double dData) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -112,9 +112,9 @@
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableBoolean(const ByteString& propname,
bool bData) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -130,9 +130,9 @@
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname,
- const CFX_ByteString& sData) {
- CFX_ByteString sPropName(propname);
+void CJS_GlobalData::SetGlobalVariableString(const ByteString& propname,
+ const ByteString& sData) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -149,9 +149,9 @@
}
void CJS_GlobalData::SetGlobalVariableObject(
- const CFX_ByteString& propname,
+ const ByteString& propname,
const CJS_GlobalVariableArray& array) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -167,8 +167,8 @@
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) {
- CFX_ByteString sPropName(propname);
+void CJS_GlobalData::SetGlobalVariableNull(const ByteString& propname) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -182,9 +182,9 @@
m_arrayGlobalData.push_back(std::move(pNewData));
}
-bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname,
+bool CJS_GlobalData::SetGlobalVariablePersistent(const ByteString& propname,
bool bPersistent) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return false;
@@ -196,8 +196,8 @@
return true;
}
-bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) {
- CFX_ByteString sPropName(propname);
+bool CJS_GlobalData::DeleteGlobalVariable(const ByteString& propname) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return false;
@@ -254,7 +254,7 @@
if (p + dwNameLen > pBuffer + nLength)
break;
- CFX_ByteString sEntry = CFX_ByteString(p, dwNameLen);
+ ByteString sEntry = ByteString(p, dwNameLen);
p += sizeof(char) * dwNameLen;
JS_GlobalDataType wDataType =
@@ -291,7 +291,7 @@
if (p + dwLength > pBuffer + nLength)
break;
- SetGlobalVariableString(sEntry, CFX_ByteString(p, dwLength));
+ SetGlobalVariableString(sEntry, ByteString(p, dwLength));
SetGlobalVariablePersistent(sEntry, true);
p += sizeof(char) * dwLength;
} break;
@@ -353,7 +353,7 @@
// UnSupport.
}
-void CJS_GlobalData::MakeByteString(const CFX_ByteString& name,
+void CJS_GlobalData::MakeByteString(const ByteString& name,
CJS_KeyValue* pData,
CFX_BinaryBuf& sData) {
switch (pData->nType) {
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 24e68c2..249bca6 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -29,16 +29,16 @@
static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp);
void Release();
- void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData);
- void SetGlobalVariableBoolean(const CFX_ByteString& propname, bool bData);
- void SetGlobalVariableString(const CFX_ByteString& propname,
- const CFX_ByteString& sData);
- void SetGlobalVariableObject(const CFX_ByteString& propname,
+ void SetGlobalVariableNumber(const ByteString& propname, double dData);
+ void SetGlobalVariableBoolean(const ByteString& propname, bool bData);
+ void SetGlobalVariableString(const ByteString& propname,
+ const ByteString& sData);
+ void SetGlobalVariableObject(const ByteString& propname,
const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(const CFX_ByteString& propname);
- bool SetGlobalVariablePersistent(const CFX_ByteString& propname,
+ void SetGlobalVariableNull(const ByteString& propname);
+ bool SetGlobalVariablePersistent(const ByteString& propname,
bool bPersistent);
- bool DeleteGlobalVariable(const CFX_ByteString& propname);
+ bool DeleteGlobalVariable(const ByteString& propname);
int32_t GetSize() const;
CJS_GlobalData_Element* GetAt(int index) const;
@@ -55,9 +55,9 @@
void LoadGlobalPersistentVariables();
void SaveGlobalPersisitentVariables();
- CJS_GlobalData_Element* GetGlobalVariable(const CFX_ByteString& sPropname);
- iterator FindGlobalVariable(const CFX_ByteString& sPropname);
- const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const;
+ CJS_GlobalData_Element* GetGlobalVariable(const ByteString& sPropname);
+ iterator FindGlobalVariable(const ByteString& sPropname);
+ const_iterator FindGlobalVariable(const ByteString& sPropname) const;
void LoadFileBuffer(const wchar_t* sFilePath,
uint8_t*& pBuffer,
@@ -65,13 +65,13 @@
void WriteFileBuffer(const wchar_t* sFilePath,
const char* pBuffer,
int32_t nLength);
- void MakeByteString(const CFX_ByteString& name,
+ void MakeByteString(const ByteString& name,
CJS_KeyValue* pData,
CFX_BinaryBuf& sData);
size_t m_RefCount;
std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData;
- CFX_WideString m_sFilePath;
+ WideString m_sFilePath;
};
#endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
diff --git a/fpdfsdk/javascript/JS_KeyValue.h b/fpdfsdk/javascript/JS_KeyValue.h
index 9fc7180..6366935 100644
--- a/fpdfsdk/javascript/JS_KeyValue.h
+++ b/fpdfsdk/javascript/JS_KeyValue.h
@@ -35,11 +35,11 @@
CJS_KeyValue();
~CJS_KeyValue();
- CFX_ByteString sKey;
+ ByteString sKey;
JS_GlobalDataType nType;
double dData;
bool bData;
- CFX_ByteString sData;
+ ByteString sData;
CJS_GlobalVariableArray objData;
};
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index 73a38fc..068031f 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -17,13 +17,13 @@
~CJS_EventContextStub() override {}
// IJS_EventContext:
- bool RunScript(const CFX_WideString& script, CFX_WideString* info) override {
+ bool RunScript(const WideString& script, WideString* info) override {
return false;
}
void OnApp_Init() override {}
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override {}
+ const WideString& strTargetName) override {}
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
@@ -48,37 +48,37 @@
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override {}
+ const WideString& Value) override {}
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override {}
+ const WideString& Value) override {}
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override {}
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) override {}
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) override {}
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override {}
void OnScreen_Focus(bool bModifier,
bool bShift,
@@ -113,7 +113,7 @@
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {}
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString&) override {}
+ const WideString&) override {}
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnConsole_Exec() override {}
void OnExternal_Exec() override {}
@@ -138,17 +138,16 @@
}
#ifdef PDF_ENABLE_XFA
- bool GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ bool GetValueByName(const ByteStringView&, CFXJSE_Value*) override {
return false;
}
- bool SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ bool SetValueByName(const ByteStringView&, CFXJSE_Value*) override {
return false;
}
#endif // PDF_ENABLE_XFA
- int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) override {
+ int ExecuteScript(const WideString& script, WideString* info) override {
return 0;
}
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index e52d7d1..1a27d22 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -200,7 +200,7 @@
: m_pValue(pRuntime->NewString(pWstr)) {}
CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const char* pStr)
- : m_pValue(pRuntime->NewString(CFX_WideString::FromLocal(pStr).c_str())) {}
+ : m_pValue(pRuntime->NewString(WideString::FromLocal(pStr).c_str())) {}
CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array)
: m_pValue(array.ToV8Array(pRuntime)) {}
@@ -245,12 +245,12 @@
return pRuntime->ToObject(m_pValue);
}
-CFX_WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const {
+WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const {
return pRuntime->ToWideString(m_pValue);
}
-CFX_ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const {
- return CFX_ByteString::FromUnicode(ToCFXWideString(pRuntime));
+ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const {
+ return ByteString::FromUnicode(ToCFXWideString(pRuntime));
}
v8::Local<v8::Value> CJS_Value::ToV8Value(CJS_Runtime* pRuntime) const {
@@ -268,7 +268,7 @@
void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) {
bool bAllowNaN = false;
if (GetType() == VT_string) {
- CFX_ByteString bstr = ToCFXByteString(pRuntime);
+ ByteString bstr = ToCFXByteString(pRuntime);
if (bstr.GetLength() == 0)
return;
if (bstr == "NaN")
@@ -398,12 +398,12 @@
ppObj = m_Value.ToV8Object(m_pJSRuntime.Get());
}
-void CJS_PropValue::operator<<(CFX_ByteString str) {
+void CJS_PropValue::operator<<(ByteString str) {
ASSERT(!m_bIsSetting);
m_Value = CJS_Value(m_pJSRuntime.Get(), str.c_str());
}
-void CJS_PropValue::operator>>(CFX_ByteString& str) const {
+void CJS_PropValue::operator>>(ByteString& str) const {
ASSERT(m_bIsSetting);
str = m_Value.ToCFXByteString(m_pJSRuntime.Get());
}
@@ -413,12 +413,12 @@
m_Value = CJS_Value(m_pJSRuntime.Get(), str);
}
-void CJS_PropValue::operator>>(CFX_WideString& wide_string) const {
+void CJS_PropValue::operator>>(WideString& wide_string) const {
ASSERT(m_bIsSetting);
wide_string = m_Value.ToCFXWideString(m_pJSRuntime.Get());
}
-void CJS_PropValue::operator<<(CFX_WideString wide_string) {
+void CJS_PropValue::operator<<(WideString wide_string) {
ASSERT(!m_bIsSetting);
m_Value = CJS_Value(m_pJSRuntime.Get(), wide_string.c_str());
}
@@ -588,9 +588,8 @@
return !m_pDate.IsEmpty() ? pRuntime->ToDouble(m_pDate) : 0.0;
}
-CFX_WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const {
- return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate)
- : CFX_WideString();
+WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const {
+ return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate) : WideString();
}
v8::Local<v8::Date> CJS_Date::ToV8Date(CJS_Runtime* pRuntime) const {
@@ -634,7 +633,7 @@
return (int)Mod(floor(dt / 1000), 60);
}
-double JS_DateParse(const CFX_WideString& str) {
+double JS_DateParse(const WideString& str) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope scope(pIsolate);
@@ -659,7 +658,7 @@
const int argc = 1;
v8::Local<v8::Value> timeStr =
CJS_Runtime::CurrentRuntimeFromIsolate(pIsolate)->NewString(
- str.AsStringC());
+ str.AsStringView());
v8::Local<v8::Value> argv[argc] = {timeStr};
v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked();
if (v->IsNumber()) {
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 2c0be35..1d430ee 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -59,8 +59,8 @@
double ToDouble(CJS_Runtime* pRuntime) const;
float ToFloat(CJS_Runtime* pRuntime) const;
CJS_Object* ToCJSObject(CJS_Runtime* pRuntime) const;
- CFX_WideString ToCFXWideString(CJS_Runtime* pRuntime) const;
- CFX_ByteString ToCFXByteString(CJS_Runtime* pRuntime) const;
+ WideString ToCFXWideString(CJS_Runtime* pRuntime) const;
+ ByteString ToCFXByteString(CJS_Runtime* pRuntime) const;
v8::Local<v8::Object> ToV8Object(CJS_Runtime* pRuntime) const;
v8::Local<v8::Array> ToV8Array(CJS_Runtime* pRuntime) const;
v8::Local<v8::Value> ToV8Value(CJS_Runtime* pRuntime) const;
@@ -102,10 +102,10 @@
void operator>>(CJS_Object*& ppObj) const;
void operator<<(CJS_Document* pJsDoc);
void operator>>(CJS_Document*& ppJsDoc) const;
- void operator<<(CFX_ByteString);
- void operator>>(CFX_ByteString&) const;
- void operator<<(CFX_WideString);
- void operator>>(CFX_WideString&) const;
+ void operator<<(ByteString);
+ void operator>>(ByteString&) const;
+ void operator<<(WideString);
+ void operator>>(WideString&) const;
void operator<<(const wchar_t* c_string);
void operator<<(v8::Local<v8::Object>);
void operator>>(v8::Local<v8::Object>&) const;
@@ -179,7 +179,7 @@
v8::Local<v8::Date> ToV8Date(CJS_Runtime* pRuntime) const;
double ToDouble(CJS_Runtime* pRuntime) const;
- CFX_WideString ToString(CJS_Runtime* pRuntime) const;
+ WideString ToString(CJS_Runtime* pRuntime) const;
protected:
v8::Local<v8::Date> m_pDate;
@@ -192,7 +192,7 @@
int JS_GetHourFromTime(double dt);
int JS_GetMinFromTime(double dt);
int JS_GetSecFromTime(double dt);
-double JS_DateParse(const CFX_WideString& str);
+double JS_DateParse(const WideString& str);
double JS_MakeDay(int nYear, int nMonth, int nDay);
double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
double JS_MakeDate(double day, double time);
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 970bbd2..ba42c3e 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -70,15 +70,15 @@
L"July", L"August", L"September",
L"October", L"November", L"December"};
-CFX_ByteString StrTrim(const CFX_ByteString& pStr) {
- CFX_ByteString result(pStr);
+ByteString StrTrim(const ByteString& pStr) {
+ ByteString result(pStr);
result.TrimLeft(' ');
result.TrimRight(' ');
return result;
}
-CFX_WideString StrTrim(const CFX_WideString& pStr) {
- CFX_WideString result(pStr);
+WideString StrTrim(const WideString& pStr) {
+ WideString result(pStr);
result.TrimLeft(' ');
result.TrimRight(' ');
return result;
@@ -91,10 +91,10 @@
}
#if _FX_OS_ != _FX_ANDROID_
-CFX_ByteString CalculateString(double dValue,
- int iDec,
- int* iDec2,
- bool* bNegative) {
+ByteString CalculateString(double dValue,
+ int iDec,
+ int* iDec2,
+ bool* bNegative) {
*bNegative = dValue < 0;
if (*bNegative)
dValue = -dValue;
@@ -109,14 +109,14 @@
size_t iDecimalPos = stringValue.find(".");
*iDec2 = iDecimalPos == std::string::npos ? stringValue.size()
: static_cast<int>(iDecimalPos);
- return CFX_ByteString(stringValue.c_str());
+ return ByteString(stringValue.c_str());
}
#endif
} // namespace
-bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) {
- CFX_WideString sTrim = StrTrim(str);
+bool CJS_PublicMethods::IsNumber(const WideString& str) {
+ WideString sTrim = StrTrim(str);
const wchar_t* pTrim = sTrim.c_str();
const wchar_t* p = pTrim;
bool bDot = false;
@@ -194,8 +194,8 @@
val.ConvertToArray(pRuntime, StrArray);
return StrArray;
}
- CFX_WideString wsStr = val.ToCFXWideString(pRuntime);
- CFX_ByteString t = CFX_ByteString::FromUnicode(wsStr);
+ WideString wsStr = val.ToCFXWideString(pRuntime);
+ ByteString t = ByteString::FromUnicode(wsStr);
const char* p = t.c_str();
int ch = ',';
@@ -204,9 +204,8 @@
while (*p) {
const char* pTemp = strchr(p, ch);
if (!pTemp) {
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime, StrTrim(CFX_ByteString(p)).c_str()));
+ StrArray.SetElement(pRuntime, nIndex,
+ CJS_Value(pRuntime, StrTrim(ByteString(p)).c_str()));
break;
}
@@ -214,9 +213,8 @@
strncpy(pSub, p, pTemp - p);
*(pSub + (pTemp - p)) = '\0';
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime, StrTrim(CFX_ByteString(pSub)).c_str()));
+ StrArray.SetElement(pRuntime, nIndex,
+ CJS_Value(pRuntime, StrTrim(ByteString(pSub)).c_str()));
delete[] pSub;
nIndex++;
@@ -225,7 +223,7 @@
return StrArray;
}
-int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str,
+int CJS_PublicMethods::ParseStringInteger(const WideString& str,
FX_STRSIZE nStart,
FX_STRSIZE& nSkip,
FX_STRSIZE nMaxStep) {
@@ -248,10 +246,10 @@
return nRet;
}
-CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str,
- FX_STRSIZE nStart,
- FX_STRSIZE& nSkip) {
- CFX_WideString swRet;
+WideString CJS_PublicMethods::ParseStringString(const WideString& str,
+ FX_STRSIZE nStart,
+ FX_STRSIZE& nSkip) {
+ WideString swRet;
nSkip = 0;
for (FX_STRSIZE i = nStart, sz = str.GetLength(); i < sz; i++) {
wchar_t c = str[i];
@@ -265,7 +263,7 @@
return swRet;
}
-double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value,
+double CJS_PublicMethods::ParseNormalDate(const WideString& value,
bool* bWrongFormat) {
double dt = JS_GetDateTime();
@@ -340,13 +338,13 @@
return dt;
}
- CFX_WideString swTemp;
+ WideString swTemp;
swTemp.Format(L"%d/%d/%d %d:%d:%d", nMonth, nDay, nYear, nHour, nMin, nSec);
return JS_DateParse(swTemp);
}
-double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
- const CFX_WideString& format,
+double CJS_PublicMethods::MakeRegularDate(const WideString& value,
+ const WideString& format,
bool* bWrongFormat) {
double dt = JS_GetDateTime();
@@ -485,7 +483,7 @@
} else if (remaining == 2 || format[i + 3] != c) {
switch (c) {
case 'm': {
- CFX_WideString sMonth = ParseStringString(value, j, nSkip);
+ WideString sMonth = ParseStringString(value, j, nSkip);
bool bFind = false;
for (int m = 0; m < 12; m++) {
if (sMonth.CompareNoCase(months[m]) == 0) {
@@ -520,11 +518,11 @@
case 'm': {
bool bFind = false;
- CFX_WideString sMonth = ParseStringString(value, j, nSkip);
+ WideString sMonth = ParseStringString(value, j, nSkip);
sMonth.MakeLower();
for (int m = 0; m < 12; m++) {
- CFX_WideString sFullMonths = fullmonths[m];
+ WideString sFullMonths = fullmonths[m];
sFullMonths.MakeLower();
if (sFullMonths.Contains(sMonth.c_str())) {
@@ -617,9 +615,9 @@
return dRet;
}
-CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
- const CFX_WideString& format) {
- CFX_WideString sRet = L"", sPart = L"";
+WideString CJS_PublicMethods::MakeFormatDate(double dDate,
+ const WideString& format) {
+ WideString sRet = L"", sPart = L"";
int nYear = JS_GetYearFromTime(dDate);
int nMonth = JS_GetMonthFromTime(dDate) + 1;
@@ -753,7 +751,7 @@
bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 6) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -765,8 +763,8 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& Value = pEvent->Value();
- CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
+ WideString& Value = pEvent->Value();
+ ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
return true;
@@ -774,7 +772,7 @@
int iSepStyle = params[1].ToInt(pRuntime);
int iNegStyle = params[2].ToInt(pRuntime);
// params[3] is iCurrStyle, it's not used.
- CFX_WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
+ WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
bool bCurrencyPrepend = params[5].ToBool(pRuntime);
if (iDec < 0)
@@ -825,7 +823,7 @@
}
// Processing currency string
- Value = CFX_WideString::FromLocal(strValue.AsStringC());
+ Value = WideString::FromLocal(strValue.AsStringView());
if (bCurrencyPrepend)
Value = wstrCurrency + Value;
@@ -900,7 +898,7 @@
bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
@@ -909,12 +907,12 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
- CFX_WideString& wstrChange = pEvent->Change();
- CFX_WideString wstrValue = val;
+ WideString& val = pEvent->Value();
+ WideString& wstrChange = pEvent->Change();
+ WideString wstrValue = val;
if (pEvent->WillCommit()) {
- CFX_WideString swTemp = StrTrim(wstrValue);
+ WideString swTemp = StrTrim(wstrValue);
if (swTemp.IsEmpty())
return true;
@@ -927,7 +925,7 @@
return true; // it happens after the last keystroke and before validating,
}
- CFX_WideString wstrSelected;
+ WideString wstrSelected;
if (pEvent->SelStart() != -1) {
wstrSelected = wstrValue.Mid(pEvent->SelStart(),
pEvent->SelEnd() - pEvent->SelStart());
@@ -981,8 +979,8 @@
}
}
- CFX_WideString wprefix = wstrValue.Left(pEvent->SelStart());
- CFX_WideString wpostfix;
+ WideString wprefix = wstrValue.Left(pEvent->SelStart());
+ WideString wpostfix;
if (pEvent->SelEnd() >= 0 &&
static_cast<FX_STRSIZE>(pEvent->SelEnd()) < wstrValue.GetLength())
wpostfix = wstrValue.Right(wstrValue.GetLength() -
@@ -995,7 +993,7 @@
bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -1007,8 +1005,8 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& Value = pEvent->Value();
- CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
+ WideString& Value = pEvent->Value();
+ ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
return true;
@@ -1078,7 +1076,7 @@
if (iNegative)
strValue = "-" + strValue;
strValue += "%";
- Value = CFX_WideString::FromLocal(strValue.AsStringC());
+ Value = WideString::FromLocal(strValue.AsStringView());
#endif
return true;
}
@@ -1087,7 +1085,7 @@
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFNumber_Keystroke(pRuntime, params, vRet, sError);
}
@@ -1095,7 +1093,7 @@
bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1106,12 +1104,12 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
- CFX_WideString strValue = val;
+ WideString& val = pEvent->Value();
+ WideString strValue = val;
if (strValue.IsEmpty())
return true;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
double dDate = 0.0f;
if (strValue.Contains(L"GMT")) {
@@ -1123,7 +1121,7 @@
}
if (std::isnan(dDate)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
@@ -1134,9 +1132,9 @@
return true;
}
-double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
- std::vector<CFX_WideString> wsArray;
- CFX_WideString sTemp = L"";
+double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
+ std::vector<WideString> wsArray;
+ WideString sTemp = L"";
for (const auto& c : strValue) {
if (c == L' ' || c == L':') {
wsArray.push_back(sTemp);
@@ -1176,11 +1174,11 @@
else if (sTemp.Compare(L"Dec") == 0)
nMonth = 12;
- int nDay = FX_atof(wsArray[2].AsStringC());
- int nHour = FX_atof(wsArray[3].AsStringC());
- int nMin = FX_atof(wsArray[4].AsStringC());
- int nSec = FX_atof(wsArray[5].AsStringC());
- int nYear = FX_atof(wsArray[7].AsStringC());
+ int nDay = FX_atof(wsArray[2].AsStringView());
+ int nHour = FX_atof(wsArray[3].AsStringView());
+ int nMin = FX_atof(wsArray[4].AsStringView());
+ int nSec = FX_atof(wsArray[5].AsStringView());
+ int nYear = FX_atof(wsArray[7].AsStringView());
double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay),
JS_MakeTime(nHour, nMin, nSec, 0));
if (std::isnan(dRet))
@@ -1193,7 +1191,7 @@
bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
return false;
@@ -1205,15 +1203,15 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString strValue = pEvent->Value();
+ WideString strValue = pEvent->Value();
if (strValue.IsEmpty())
return true;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
if (bWrongFormat || std::isnan(dRet)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
@@ -1227,7 +1225,7 @@
bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1261,7 +1259,7 @@
bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1295,7 +1293,7 @@
bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1316,7 +1314,7 @@
bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1337,14 +1335,14 @@
bool CJS_PublicMethods::AFTime_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFDate_FormatEx(pRuntime, params, vRet, sError);
}
bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFDate_KeystrokeEx(pRuntime, params, vRet, sError);
}
@@ -1352,7 +1350,7 @@
bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1363,8 +1361,8 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString wsSource = pEvent->Value();
- CFX_WideString wsFormat;
+ WideString wsSource = pEvent->Value();
+ WideString wsFormat;
switch (params[0].ToInt(pRuntime)) {
case 0:
wsFormat = L"99999";
@@ -1392,7 +1390,7 @@
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1403,8 +1401,8 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& valEvent = pEvent->Value();
- CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime);
+ WideString& valEvent = pEvent->Value();
+ WideString wstrMask = params[0].ToCFXWideString(pRuntime);
if (wstrMask.IsEmpty())
return true;
@@ -1427,11 +1425,11 @@
return true;
}
- CFX_WideString& wideChange = pEvent->Change();
+ WideString& wideChange = pEvent->Change();
if (wideChange.IsEmpty())
return true;
- CFX_WideString wChange = wideChange;
+ WideString wChange = wideChange;
FX_STRSIZE iIndexMask = pEvent->SelStart();
FX_STRSIZE combined_len = valEvent.GetLength() + wChange.GetLength() +
pEvent->SelStart() - pEvent->SelEnd();
@@ -1475,7 +1473,7 @@
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1513,7 +1511,7 @@
bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1522,7 +1520,7 @@
CJS_EventHandler* pEventHandler =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- CFX_WideString swValue;
+ WideString swValue;
if (pEventHandler->m_pValue)
swValue = pEventHandler->Value();
@@ -1531,7 +1529,7 @@
return true;
}
- CFX_WideString prefix, postfix;
+ WideString prefix, postfix;
if (pEventHandler->SelStart() >= 0)
prefix = swValue.Left(pEventHandler->SelStart());
@@ -1553,17 +1551,17 @@
bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString sValue = params[0].ToCFXWideString(pRuntime);
- CFX_WideString sFormat = params[1].ToCFXWideString(pRuntime);
+ WideString sValue = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[1].ToCFXWideString(pRuntime);
double dDate = MakeRegularDate(sValue, sFormat, nullptr);
if (std::isnan(dDate)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg.c_str());
@@ -1577,7 +1575,7 @@
bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 3) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1594,13 +1592,13 @@
bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString ws = params[0].ToCFXWideString(pRuntime);
+ WideString ws = params[0].ToCFXWideString(pRuntime);
ws.Replace(L",", L".");
vRet = CJS_Value(pRuntime, ws.c_str());
vRet.MaybeCoerceToNumber(pRuntime);
@@ -1612,7 +1610,7 @@
bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1628,7 +1626,7 @@
pRuntime->GetFormFillEnv()->GetInterForm();
CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
- CFX_WideString sFunction = params[0].ToCFXWideString(pRuntime);
+ WideString sFunction = params[0].ToCFXWideString(pRuntime);
double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0;
CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1);
@@ -1637,7 +1635,7 @@
for (int i = 0, isz = FieldNameArray.GetLength(pRuntime); i < isz; i++) {
CJS_Value jsValue(pRuntime);
FieldNameArray.GetElement(pRuntime, i, jsValue);
- CFX_WideString wsFieldName = jsValue.ToCFXWideString(pRuntime);
+ WideString wsFieldName = jsValue.ToCFXWideString(pRuntime);
for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) {
if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) {
@@ -1645,10 +1643,10 @@
switch (pFormField->GetFieldType()) {
case FIELDTYPE_TEXTFIELD:
case FIELDTYPE_COMBOBOX: {
- CFX_WideString trimmed = pFormField->GetValue();
+ WideString trimmed = pFormField->GetValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
} break;
case FIELDTYPE_PUSHBUTTON: {
dTemp = 0.0;
@@ -1659,10 +1657,10 @@
for (int c = 0, csz = pFormField->CountControls(); c < csz; c++) {
if (CPDF_FormControl* pFormCtrl = pFormField->GetControl(c)) {
if (pFormCtrl->IsChecked()) {
- CFX_WideString trimmed = pFormCtrl->GetExportValue();
+ WideString trimmed = pFormCtrl->GetExportValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
break;
}
}
@@ -1670,10 +1668,10 @@
} break;
case FIELDTYPE_LISTBOX: {
if (pFormField->CountSelectedItems() <= 1) {
- CFX_WideString trimmed = pFormField->GetValue();
+ WideString trimmed = pFormField->GetValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
}
} break;
default:
@@ -1711,7 +1709,7 @@
bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 4) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1724,13 +1722,12 @@
if (pEvent->Value().IsEmpty())
return true;
- double dEentValue =
- atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str());
+ double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str());
bool bGreaterThan = params[0].ToBool(pRuntime);
double dGreaterThan = params[1].ToDouble(pRuntime);
bool bLessThan = params[2].ToBool(pRuntime);
double dLessThan = params[3].ToDouble(pRuntime);
- CFX_WideString swMsg;
+ WideString swMsg;
if (bGreaterThan && bLessThan) {
if (dEentValue < dGreaterThan || dEentValue > dLessThan)
@@ -1757,17 +1754,17 @@
bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString str = params[0].ToCFXWideString(pRuntime);
+ WideString str = params[0].ToCFXWideString(pRuntime);
if (str.GetLength() > 0 && (str[0] == L'.' || str[0] == L','))
str = L"0" + str;
- CFX_WideString sPart;
+ WideString sPart;
CJS_Array nums;
int nIndex = 0;
for (const auto& wc : str) {
diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h
index c373f51..365df3e 100644
--- a/fpdfsdk/javascript/PublicMethods.h
+++ b/fpdfsdk/javascript/PublicMethods.h
@@ -21,91 +21,91 @@
static bool AFNumber_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFNumber_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFPercent_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFPercent_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError); //
+ WideString& sError); //
static bool AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError); //
+ WideString& sError); //
static bool AFSimple(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFMakeNumber(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSimple_Calculate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFRange_Validate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFMergeChange(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFParseDateEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFExtractNums(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
JS_STATIC_GLOBAL_FUN(AFNumber_Format);
JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
@@ -132,23 +132,21 @@
JS_STATIC_DECLARE_GLOBAL_FUN();
- static int ParseStringInteger(const CFX_WideString& string,
+ static int ParseStringInteger(const WideString& string,
FX_STRSIZE nStart,
FX_STRSIZE& nSkip,
FX_STRSIZE nMaxStep);
- static CFX_WideString ParseStringString(const CFX_WideString& string,
- FX_STRSIZE nStart,
- FX_STRSIZE& nSkip);
- static double MakeRegularDate(const CFX_WideString& value,
- const CFX_WideString& format,
+ static WideString ParseStringString(const WideString& string,
+ FX_STRSIZE nStart,
+ FX_STRSIZE& nSkip);
+ static double MakeRegularDate(const WideString& value,
+ const WideString& format,
bool* bWrongFormat);
- static CFX_WideString MakeFormatDate(double dDate,
- const CFX_WideString& format);
- static double ParseNormalDate(const CFX_WideString& value,
- bool* bWrongFormat);
- static double MakeInterDate(const CFX_WideString& value);
+ static WideString MakeFormatDate(double dDate, const WideString& format);
+ static double ParseNormalDate(const WideString& value, bool* bWrongFormat);
+ static double MakeInterDate(const WideString& value);
- static bool IsNumber(const CFX_WideString& str);
+ static bool IsNumber(const WideString& str);
static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
static bool isReservedMaskChar(wchar_t ch);
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 246db66..3c0f9af 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -28,7 +28,7 @@
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_Runtime* pRuntime,
int nType,
- const CFX_WideString& script,
+ const WideString& script,
uint32_t dwElapse,
uint32_t dwTimeOut);
~GlobalTimer();
@@ -40,7 +40,7 @@
uint32_t GetTimeOut() const { return m_dwTimeOut; }
int GetTimerID() const { return m_nTimerID; }
CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); }
- CFX_WideString GetJScript() const { return m_swJScript; }
+ WideString GetJScript() const { return m_swJScript; }
private:
using TimerMap = std::map<uint32_t, GlobalTimer*>;
@@ -53,7 +53,7 @@
// data
const int m_nType; // 0:Interval; 1:TimeOut
const uint32_t m_dwTimeOut;
- const CFX_WideString m_swJScript;
+ const WideString m_swJScript;
CJS_Runtime::ObservedPtr m_pRuntime;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
};
@@ -62,7 +62,7 @@
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_Runtime* pRuntime,
int nType,
- const CFX_WideString& script,
+ const WideString& script,
uint32_t dwElapse,
uint32_t dwTimeOut)
: m_nTimerID(0),
@@ -209,7 +209,7 @@
bool app::activeDocs(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -230,7 +230,7 @@
bool app::calculate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
bool bVP;
vp >> bVP;
@@ -244,7 +244,7 @@
bool app::formsVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_NUM_FORMSVERSION;
return true;
@@ -255,7 +255,7 @@
bool app::viewerType(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERTYPE;
return true;
@@ -266,7 +266,7 @@
bool app::viewerVariation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERVARIATION;
return true;
@@ -277,7 +277,7 @@
bool app::viewerVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
@@ -294,14 +294,14 @@
bool app::platform(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv)
return false;
- CFX_WideString platfrom = pFormFillEnv->GetPlatform();
+ WideString platfrom = pFormFillEnv->GetPlatform();
if (!platfrom.IsEmpty()) {
vp << platfrom;
return true;
@@ -313,14 +313,14 @@
bool app::language(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv)
return false;
- CFX_WideString language = pFormFillEnv->GetLanguage();
+ WideString language = pFormFillEnv->GetLanguage();
if (!language.IsEmpty()) {
vp << language;
return true;
@@ -337,7 +337,7 @@
bool app::newFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
// opens a specified pdf document and returns its document object
@@ -350,14 +350,14 @@
bool app::openFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool app::alert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams = JS_ExpandKeywordParams(
pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle");
@@ -372,7 +372,7 @@
return true;
}
- CFX_WideString swMsg;
+ WideString swMsg;
if (newParams[0].GetType() == CJS_Value::VT_object) {
CJS_Array carray;
if (newParams[0].ConvertToArray(pRuntime, carray)) {
@@ -400,7 +400,7 @@
if (newParams[2].GetType() != CJS_Value::VT_unknown)
iType = newParams[2].ToInt(pRuntime);
- CFX_WideString swTitle;
+ WideString swTitle;
if (newParams[3].GetType() != CJS_Value::VT_unknown)
swTitle = newParams[3].ToCFXWideString(pRuntime);
else
@@ -418,7 +418,7 @@
bool app::beep(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() == 1) {
pRuntime->GetFormFillEnv()->JS_appBeep(params[0].ToInt(pRuntime));
return true;
@@ -431,31 +431,31 @@
bool app::findComponent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool app::popUpMenuEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
-bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError) {
+bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return false;
}
bool app::setInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString script =
+ WideString script =
params.size() > 0 ? params[0].ToCFXWideString(pRuntime) : L"";
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
@@ -485,13 +485,13 @@
bool app::setTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString script = params[0].ToCFXWideString(pRuntime);
+ WideString script = params[0].ToCFXWideString(pRuntime);
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
return true;
@@ -519,7 +519,7 @@
bool app::clearTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -532,7 +532,7 @@
bool app::clearInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -564,7 +564,7 @@
bool app::execMenuItem(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
@@ -578,11 +578,11 @@
m_Timers.erase(pdfium::FakeUniquePtr<GlobalTimer>(pTimer));
}
-void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) {
+void app::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) {
if (!pRuntime->IsBlocking()) {
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnExternal_Exec();
- CFX_WideString wtInfo;
+ WideString wtInfo;
pContext->RunScript(wsScript, &wtInfo);
pRuntime->ReleaseEventContext(pContext);
}
@@ -591,7 +591,7 @@
bool app::goBack(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -599,7 +599,7 @@
bool app::goForward(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -607,7 +607,7 @@
bool app::mailMsg(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc",
L"cBcc", L"cSubject", L"cMsg");
@@ -618,7 +618,7 @@
}
bool bUI = newParams[0].ToBool(pRuntime);
- CFX_WideString cTo;
+ WideString cTo;
if (newParams[1].GetType() != CJS_Value::VT_unknown) {
cTo = newParams[1].ToCFXWideString(pRuntime);
} else {
@@ -629,19 +629,19 @@
}
}
- CFX_WideString cCc;
+ WideString cCc;
if (newParams[2].GetType() != CJS_Value::VT_unknown)
cCc = newParams[2].ToCFXWideString(pRuntime);
- CFX_WideString cBcc;
+ WideString cBcc;
if (newParams[3].GetType() != CJS_Value::VT_unknown)
cBcc = newParams[3].ToCFXWideString(pRuntime);
- CFX_WideString cSubject;
+ WideString cSubject;
if (newParams[4].GetType() != CJS_Value::VT_unknown)
cSubject = newParams[4].ToCFXWideString(pRuntime);
- CFX_WideString cMsg;
+ WideString cMsg;
if (newParams[5].GetType() != CJS_Value::VT_unknown)
cMsg = newParams[5].ToCFXWideString(pRuntime);
@@ -656,14 +656,14 @@
bool app::launchURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
bool app::runtimeHighlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
vp >> m_bRuntimeHighLight;
} else {
@@ -674,27 +674,27 @@
bool app::fullscreen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::popUpMenu(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::browseForDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
-CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) {
- CFX_WideString sRet = L"/";
+WideString app::SysPathToPDFPath(const WideString& sOldPath) {
+ WideString sRet = L"/";
for (const wchar_t& c : sOldPath) {
if (c != L':')
sRet += (c == L'\\') ? L'/' : c;
@@ -705,21 +705,21 @@
bool app::newDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::openDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::response(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle",
L"cDefault", L"bPassword", L"cLabel");
@@ -728,13 +728,13 @@
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swQuestion = newParams[0].ToCFXWideString(pRuntime);
+ WideString swQuestion = newParams[0].ToCFXWideString(pRuntime);
- CFX_WideString swTitle = L"PDF";
+ WideString swTitle = L"PDF";
if (newParams[1].GetType() != CJS_Value::VT_unknown)
swTitle = newParams[1].ToCFXWideString(pRuntime);
- CFX_WideString swDefault;
+ WideString swDefault;
if (newParams[2].GetType() != CJS_Value::VT_unknown)
swDefault = newParams[2].ToCFXWideString(pRuntime);
@@ -742,7 +742,7 @@
if (newParams[3].GetType() != CJS_Value::VT_unknown)
bPassword = newParams[3].ToBool(pRuntime);
- CFX_WideString swLabel;
+ WideString swLabel;
if (newParams[4].GetType() != CJS_Value::VT_unknown)
swLabel = newParams[4].ToCFXWideString(pRuntime);
@@ -757,7 +757,7 @@
return false;
}
- vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE(
+ vRet = CJS_Value(pRuntime, WideString::FromUTF16LE(
reinterpret_cast<uint16_t*>(pBuff.data()),
nLengthBytes / sizeof(uint16_t))
.c_str());
@@ -765,15 +765,13 @@
return true;
}
-bool app::media(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return false;
}
bool app::execDialog(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h
index 0a2cfdb..e77c8cd 100644
--- a/fpdfsdk/javascript/app.h
+++ b/fpdfsdk/javascript/app.h
@@ -41,132 +41,120 @@
explicit app(CJS_Object* pJSObject);
~app() override;
- bool activeDocs(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool calculate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool activeDocs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool formsVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool fullscreen(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool language(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool platform(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fullscreen(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool language(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool platform(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool runtimeHighlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool viewerType(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool viewerType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool viewerVariation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool viewerVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool alert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool beep(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool browseForDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool execDialog(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool execMenuItem(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool findComponent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool goBack(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool goForward(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool launchURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailMsg(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool newFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool newDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool openDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool openFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool popUpMenuEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool popUpMenu(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool response(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
void TimerProc(GlobalTimer* pTimer);
void CancelProc(GlobalTimer* pTimer);
- static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
+ static WideString SysPathToPDFPath(const WideString& sOldPath);
private:
// CJS_EmbedObj
- void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript);
+ void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript);
void ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param);
diff --git a/fpdfsdk/javascript/cjs_event_context.cpp b/fpdfsdk/javascript/cjs_event_context.cpp
index 9537ac9..b820bc3 100644
--- a/fpdfsdk/javascript/cjs_event_context.cpp
+++ b/fpdfsdk/javascript/cjs_event_context.cpp
@@ -24,8 +24,7 @@
return m_pRuntime->GetFormFillEnv();
}
-bool CJS_EventContext::RunScript(const CFX_WideString& script,
- CFX_WideString* info) {
+bool CJS_EventContext::RunScript(const WideString& script, WideString* info) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
v8::Local<v8::Context> context = m_pRuntime->NewLocalContext();
@@ -47,7 +46,7 @@
return false;
}
- CFX_WideString sErrorMessage;
+ WideString sErrorMessage;
int nRet = 0;
if (script.GetLength() > 0)
nRet = m_pRuntime->ExecuteScript(script.c_str(), &sErrorMessage);
@@ -67,7 +66,7 @@
}
void CJS_EventContext::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
m_pEventHandler->OnDoc_Open(pFormFillEnv, strTargetName);
}
@@ -141,39 +140,39 @@
void CJS_EventContext::OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value);
}
void CJS_EventContext::OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value);
}
void CJS_EventContext::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc);
}
void CJS_EventContext::OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) {
m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit);
}
-void CJS_EventContext::OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventContext::OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) {
@@ -182,13 +181,13 @@
pTarget, Value, bWillCommit, bFieldFull, bRc);
}
-void CJS_EventContext::OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventContext::OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier,
bShift, pTarget, Value, bRc);
@@ -276,6 +275,6 @@
}
void CJS_EventContext::OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
m_pEventHandler->OnMenu_Exec(pFormFillEnv, strTargetName);
}
diff --git a/fpdfsdk/javascript/cjs_event_context.h b/fpdfsdk/javascript/cjs_event_context.h
index 715bd94..a27bbd7 100644
--- a/fpdfsdk/javascript/cjs_event_context.h
+++ b/fpdfsdk/javascript/cjs_event_context.h
@@ -24,10 +24,10 @@
~CJS_EventContext() override;
// IJS_EventContext
- bool RunScript(const CFX_WideString& script, CFX_WideString* info) override;
+ bool RunScript(const WideString& script, WideString* info) override;
void OnApp_Init() override;
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override;
+ const WideString& strTargetName) override;
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
@@ -52,37 +52,37 @@
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override;
+ const WideString& Value) override;
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override;
+ const WideString& Value) override;
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override;
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) override;
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) override;
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override;
void OnScreen_Focus(bool bModifier,
bool bShift,
@@ -117,7 +117,7 @@
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override;
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override;
+ const WideString& strTargetName) override;
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnConsole_Exec() override;
void OnExternal_Exec() override;
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index 515bdcb..720a15b 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -193,8 +193,7 @@
return m_pFormFillEnv.Get();
}
-int CJS_Runtime::ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) {
+int CJS_Runtime::ExecuteScript(const WideString& script, WideString* info) {
FXJSErr error = {};
int nRet = Execute(script, &error);
if (nRet < 0) {
@@ -213,13 +212,13 @@
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString ChangeObjName(const CFX_WideString& str) {
- CFX_WideString sRet = str;
+WideString ChangeObjName(const WideString& str) {
+ WideString sRet = str;
sRet.Replace(L"_", L".");
return sRet;
}
-bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
+bool CJS_Runtime::GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
@@ -236,7 +235,7 @@
return true;
}
-bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
+bool CJS_Runtime::SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) {
if (utf8Name.IsEmpty() || !pValue)
return false;
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index bfbc52b..3991995 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -25,7 +25,7 @@
public CFXJS_Engine,
public CFX_Observable<CJS_Runtime> {
public:
- using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>;
+ using FieldEvent = std::pair<WideString, JS_EVENT_T>;
static CJS_Runtime* CurrentRuntimeFromIsolate(v8::Isolate* pIsolate);
@@ -36,8 +36,7 @@
IJS_EventContext* NewEventContext() override;
void ReleaseEventContext(IJS_EventContext* pContext) override;
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
- int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) override;
+ int ExecuteScript(const WideString& script, WideString* info) override;
CJS_EventContext* GetCurrentEventContext() const;
@@ -50,9 +49,9 @@
bool IsBlocking() const { return m_bBlocking; }
#ifdef PDF_ENABLE_XFA
- bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ bool GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) override;
- bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ bool SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) override;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 7bf3cc9..574c81a 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -91,7 +91,7 @@
CJS_Value value(pRuntime);
array.GetElement(pRuntime, 0, value);
- CFX_ByteString sSpace = value.ToCFXByteString(pRuntime);
+ ByteString sSpace = value.ToCFXByteString(pRuntime);
double d1 = 0;
double d2 = 0;
@@ -132,73 +132,65 @@
bool color::transparent(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crTransparent);
}
bool color::black(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crBlack);
}
bool color::white(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crWhite);
}
-bool color::red(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crRed);
}
bool color::green(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crGreen);
}
-bool color::blue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crBlue);
}
-bool color::cyan(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crCyan);
}
bool color::magenta(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crMagenta);
}
bool color::yellow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crYellow);
}
bool color::dkGray(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crDKGray);
}
-bool color::gray(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crGray);
}
bool color::ltGray(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crLTGray);
}
@@ -221,7 +213,7 @@
bool color::convert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
if (iSize < 2)
return false;
@@ -233,7 +225,7 @@
CFX_Color crSource;
ConvertArrayToPWLColor(pRuntime, aSource, &crSource);
- CFX_ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
+ ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
int nColorType = COLORTYPE_TRANSPARENT;
if (sDestSpace == "T") {
@@ -257,7 +249,7 @@
bool color::equal(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 5d6a657..5e1e871 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -17,31 +17,29 @@
explicit color(CJS_Object* pJSObject);
~color() override;
- bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool magenta(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool magenta(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool transparent(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool convert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool equal(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static void ConvertPWLColorToArray(CJS_Runtime* pRuntime,
const CFX_Color& color,
diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp
index e9d1308..4f0fd43 100644
--- a/fpdfsdk/javascript/console.cpp
+++ b/fpdfsdk/javascript/console.cpp
@@ -33,21 +33,21 @@
bool console::clear(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool console::hide(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool console::println(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
return false;
}
@@ -57,6 +57,6 @@
bool console::show(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h
index a7e4d8e..4680220 100644
--- a/fpdfsdk/javascript/console.h
+++ b/fpdfsdk/javascript/console.h
@@ -20,19 +20,19 @@
bool clear(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool hide(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool println(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool show(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
};
class CJS_Console : public CJS_Object {
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index 2b00cbc..efc704d 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -48,10 +48,10 @@
bool event::change(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- CFX_WideString& wChange = pEvent->Change();
+ WideString& wChange = pEvent->Change();
if (vp.IsSetting()) {
if (vp.GetJSValue()->GetType() == CJS_Value::VT_string)
vp >> wChange;
@@ -63,7 +63,7 @@
bool event::changeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -76,7 +76,7 @@
bool event::commitKey(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -89,7 +89,7 @@
bool event::fieldFull(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -103,7 +103,7 @@
bool event::keyDown(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -116,7 +116,7 @@
bool event::modifier(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -127,9 +127,7 @@
return true;
}
-bool event::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -140,9 +138,7 @@
return true;
}
-bool event::rc(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -157,25 +153,25 @@
bool event::richChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::richChangeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::richValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::selEnd(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -193,7 +189,7 @@
bool event::selStart(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -211,7 +207,7 @@
bool event::shift(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -224,7 +220,7 @@
bool event::source(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -237,7 +233,7 @@
bool event::target(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -250,7 +246,7 @@
bool event::targetName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -261,9 +257,7 @@
return true;
}
-bool event::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -276,7 +270,7 @@
bool event::value(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -286,7 +280,7 @@
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
+ WideString& val = pEvent->Value();
if (vp.IsSetting())
vp >> val;
else
@@ -297,7 +291,7 @@
bool event::willCommit(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h
index 2be8a0a..8574237 100644
--- a/fpdfsdk/javascript/event.h
+++ b/fpdfsdk/javascript/event.h
@@ -15,48 +15,28 @@
~event() override;
public:
- bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool changeEx(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool commitKey(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fieldFull(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool keyDown(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool modifier(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool richChange(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool changeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool commitKey(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fieldFull(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool keyDown(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool modifier(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool richChangeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richValue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool selStart(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool targetName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool willCommit(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool selStart(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool targetName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool willCommit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
};
class CJS_Event : public CJS_Object {
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 8dcddf4..9827b2a 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -62,13 +62,13 @@
}
bool JSGlobalAlternate::QueryProperty(const wchar_t* propname) {
- return CFX_WideString(propname) != L"setPersistent";
+ return WideString(propname) != L"setPersistent";
}
bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- CFX_WideString& sError) {
- auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname));
+ WideString& sError) {
+ auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
if (it == m_MapGlobal.end())
return false;
@@ -79,9 +79,9 @@
bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
- CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
+ ByteString sPropName = ByteString::FromUnicode(propname);
switch (vp.GetJSValue()->GetType()) {
case CJS_Value::VT_number: {
double dData;
@@ -96,7 +96,7 @@
bData, "", v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_string: {
- CFX_ByteString sData;
+ ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0,
false, sData, v8::Local<v8::Object>(), false);
@@ -119,7 +119,7 @@
break;
}
} else {
- auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname));
+ auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
if (it == m_MapGlobal.end()) {
vp.GetJSValue()->SetNull(pRuntime);
return true;
@@ -158,7 +158,7 @@
bool JSGlobalAlternate::setPersistent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -202,7 +202,7 @@
pData->bPersistent == 1);
pRuntime->PutObjectProperty(
m_pJSObject->ToV8Object(), pData->data.sKey.UTF8Decode(),
- pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringC()));
+ pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringView()));
break;
case JS_GlobalDataType::OBJECT: {
v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(-1);
@@ -229,7 +229,7 @@
void JSGlobalAlternate::CommitGlobalPersisitentVariables(
CJS_Runtime* pRuntime) {
for (const auto& iter : m_MapGlobal) {
- CFX_ByteString name = iter.first;
+ ByteString name = iter.first;
JSGlobalData* pData = iter.second.get();
if (pData->bDeleted) {
m_pGlobalData->DeleteGlobalVariable(name);
@@ -267,9 +267,9 @@
void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime,
v8::Local<v8::Object> pObj,
CJS_GlobalVariableArray& array) {
- std::vector<CFX_WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
+ std::vector<WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
for (const auto& ws : pKeyList) {
- CFX_ByteString sKey = ws.UTF8Encode();
+ ByteString sKey = ws.UTF8Encode();
v8::Local<v8::Value> v = pRuntime->GetObjectProperty(pObj, ws);
switch (CJS_Value::GetValueType(v)) {
case CJS_Value::VT_number: {
@@ -287,8 +287,7 @@
array.Add(pObjElement);
} break;
case CJS_Value::VT_string: {
- CFX_ByteString sValue =
- CJS_Value(pRuntime, v).ToCFXByteString(pRuntime);
+ ByteString sValue = CJS_Value(pRuntime, v).ToCFXByteString(pRuntime);
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GlobalDataType::STRING;
pObjElement->sKey = sKey;
@@ -333,7 +332,7 @@
case JS_GlobalDataType::STRING:
pRuntime->PutObjectProperty(
pObj, pObjData->sKey.UTF8Decode(),
- pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringC()));
+ pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringView()));
break;
case JS_GlobalDataType::OBJECT: {
v8::Local<v8::Object> pNewObj = pRuntime->NewFxDynamicObj(-1);
@@ -355,11 +354,11 @@
m_MapGlobal.clear();
}
-bool JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
+bool JSGlobalAlternate::SetGlobalVariables(const ByteString& propname,
JS_GlobalDataType nType,
double dData,
bool bData,
- const CFX_ByteString& sData,
+ const ByteString& sData,
v8::Local<v8::Object> pData,
bool bDefaultPersistent) {
if (propname.IsEmpty())
diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h
index 364313c..5005b2a 100644
--- a/fpdfsdk/javascript/global.h
+++ b/fpdfsdk/javascript/global.h
@@ -25,7 +25,7 @@
JS_GlobalDataType nType;
double dData;
bool bData;
- CFX_ByteString sData;
+ ByteString sData;
v8::Global<v8::Object> pData;
bool bPersistent;
bool bDeleted;
@@ -39,26 +39,26 @@
bool setPersistent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool QueryProperty(const wchar_t* propname);
bool DoProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool DelProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- CFX_WideString& sError);
+ WideString& sError);
void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
private:
void UpdateGlobalPersistentVariables();
void CommitGlobalPersisitentVariables(CJS_Runtime* pRuntime);
void DestroyGlobalPersisitentVariables();
- bool SetGlobalVariables(const CFX_ByteString& propname,
+ bool SetGlobalVariables(const ByteString& propname,
JS_GlobalDataType nType,
double dData,
bool bData,
- const CFX_ByteString& sData,
+ const ByteString& sData,
v8::Local<v8::Object> pData,
bool bDefaultPersistent);
void ObjectToArray(CJS_Runtime* pRuntime,
@@ -66,8 +66,8 @@
CJS_GlobalVariableArray& array);
void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
- std::map<CFX_ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
- CFX_WideString m_sFilePath;
+ std::map<ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
+ WideString m_sFilePath;
CJS_GlobalData* m_pGlobalData;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
};
diff --git a/fpdfsdk/javascript/ijs_event_context.h b/fpdfsdk/javascript/ijs_event_context.h
index 8428072..5d2d712 100644
--- a/fpdfsdk/javascript/ijs_event_context.h
+++ b/fpdfsdk/javascript/ijs_event_context.h
@@ -20,13 +20,12 @@
// may trigger new events on top of one another.
class IJS_EventContext {
public:
- virtual bool RunScript(const CFX_WideString& script,
- CFX_WideString* info) = 0;
+ virtual bool RunScript(const WideString& script, WideString* info) = 0;
virtual void OnApp_Init() = 0;
virtual void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) = 0;
+ const WideString& strTargetName) = 0;
virtual void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
@@ -53,38 +52,38 @@
virtual void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) = 0;
+ const WideString& Value) = 0;
virtual void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) = 0;
+ const WideString& Value) = 0;
virtual void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) = 0;
virtual void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) = 0;
- virtual void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ virtual void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) = 0;
- virtual void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ virtual void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) = 0;
virtual void OnScreen_Focus(bool bModifier,
@@ -122,7 +121,7 @@
virtual void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString&) = 0;
+ const WideString&) = 0;
virtual void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnConsole_Exec() = 0;
virtual void OnExternal_Exec() = 0;
diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h
index babc418..a21ce80 100644
--- a/fpdfsdk/javascript/ijs_runtime.h
+++ b/fpdfsdk/javascript/ijs_runtime.h
@@ -28,13 +28,12 @@
virtual IJS_EventContext* NewEventContext() = 0;
virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0;
virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0;
- virtual int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) = 0;
+ virtual int ExecuteScript(const WideString& script, WideString* info) = 0;
#ifdef PDF_ENABLE_XFA
- virtual bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ virtual bool GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) = 0;
- virtual bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ virtual bool SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) = 0;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp
index 2479366..f6af01f 100644
--- a/fpdfsdk/javascript/public_methods_embeddertest.cpp
+++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp
@@ -103,7 +103,7 @@
v8::Isolate::Scope isolate_scope(isolate());
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- CFX_WideString formatted_date;
+ WideString formatted_date;
// 1968-06-25
formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy");
diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp
index c9c986d..4550943 100644
--- a/fpdfsdk/javascript/report.cpp
+++ b/fpdfsdk/javascript/report.cpp
@@ -29,7 +29,7 @@
bool Report::writeText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -37,7 +37,7 @@
bool Report::save(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h
index c66db80..0f040c6 100644
--- a/fpdfsdk/javascript/report.h
+++ b/fpdfsdk/javascript/report.h
@@ -20,11 +20,11 @@
bool save(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool writeText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
};
class CJS_Report : public CJS_Object {
diff --git a/fpdfsdk/javascript/resource.cpp b/fpdfsdk/javascript/resource.cpp
index 6113c54..8ca5b2a 100644
--- a/fpdfsdk/javascript/resource.cpp
+++ b/fpdfsdk/javascript/resource.cpp
@@ -6,7 +6,7 @@
#include "fpdfsdk/javascript/resource.h"
-CFX_WideString JSGetStringFromID(uint32_t id) {
+WideString JSGetStringFromID(uint32_t id) {
switch (id) {
case IDS_STRING_JSALERT:
return L"Alert";
@@ -54,13 +54,13 @@
}
}
-CFX_WideString JSFormatErrorString(const char* class_name,
- const char* property_name,
- const CFX_WideString& details) {
- CFX_WideString result = CFX_WideString::FromLocal(class_name);
+WideString JSFormatErrorString(const char* class_name,
+ const char* property_name,
+ const WideString& details) {
+ WideString result = WideString::FromLocal(class_name);
if (property_name) {
result += L".";
- result += CFX_WideString::FromLocal(property_name);
+ result += WideString::FromLocal(property_name);
}
result += L": ";
result += details;
diff --git a/fpdfsdk/javascript/resource.h b/fpdfsdk/javascript/resource.h
index af7788f..3891918 100644
--- a/fpdfsdk/javascript/resource.h
+++ b/fpdfsdk/javascript/resource.h
@@ -32,9 +32,9 @@
#define IDS_STRING_JSNOPERMISSION 25639
#define IDS_STRING_JSBADOBJECT 25640
-CFX_WideString JSGetStringFromID(uint32_t id);
-CFX_WideString JSFormatErrorString(const char* class_name,
- const char* property_name,
- const CFX_WideString& details);
+WideString JSGetStringFromID(uint32_t id);
+WideString JSFormatErrorString(const char* class_name,
+ const char* property_name,
+ const WideString& details);
#endif // FPDFSDK_JAVASCRIPT_RESOURCE_H_
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index e00f9e1..04f1eb3 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -76,7 +76,7 @@
bool util::printf(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
const size_t iSize = params.size();
if (iSize < 1)
return false;
@@ -111,7 +111,7 @@
continue;
}
- CFX_WideString strSegment;
+ WideString strSegment;
switch (ParseDataType(&c_strFormat)) {
case UTIL_INT:
strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt(pRuntime));
@@ -139,7 +139,7 @@
bool util::printd(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
const size_t iSize = params.size();
if (iSize < 2)
return false;
@@ -158,7 +158,7 @@
}
if (p1.GetType() == CJS_Value::VT_number) {
- CFX_WideString swResult;
+ WideString swResult;
switch (p1.ToInt(pRuntime)) {
case 0:
swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(pRuntime),
@@ -231,7 +231,7 @@
};
for (size_t i = 0; i < FX_ArraySize(cTableAd); ++i) {
- CFX_WideString sValue;
+ WideString sValue;
sValue.Format(L"%d", cTableAd[i].iValue);
int iStart = 0;
@@ -271,7 +271,7 @@
bool util::printx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -294,9 +294,9 @@
return input;
}
-CFX_WideString util::printx(const CFX_WideString& wsFormat,
- const CFX_WideString& wsSource) {
- CFX_WideString wsResult;
+WideString util::printx(const WideString& wsFormat,
+ const WideString& wsSource) {
+ WideString wsResult;
FX_STRSIZE iSourceIdx = 0;
FX_STRSIZE iFormatIdx = 0;
CaseMode eCaseMode = kPreserveCase;
@@ -385,12 +385,12 @@
bool util::scand(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
- CFX_WideString sDate = params[1].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sDate = params[1].ToCFXWideString(pRuntime);
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0) {
dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);
@@ -408,7 +408,7 @@
bool util::byteToChar(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -420,7 +420,7 @@
return false;
}
- CFX_WideString wStr(static_cast<wchar_t>(arg));
+ WideString wStr(static_cast<wchar_t>(arg));
vRet = CJS_Value(pRuntime, wStr.c_str());
return true;
}
diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h
index 60fa631..ba46e4f 100644
--- a/fpdfsdk/javascript/util.h
+++ b/fpdfsdk/javascript/util.h
@@ -25,26 +25,26 @@
bool printd(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool printf(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool printx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool scand(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool byteToChar(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
- static CFX_WideString printx(const CFX_WideString& cFormat,
- const CFX_WideString& cSource);
+ static WideString printx(const WideString& cFormat,
+ const WideString& cSource);
private:
friend class CJS_Util_ParseDataType_Test;
diff --git a/fpdfsdk/pdfsdk_fieldaction.h b/fpdfsdk/pdfsdk_fieldaction.h
index 4ee56ac..aec5dca 100644
--- a/fpdfsdk/pdfsdk_fieldaction.h
+++ b/fpdfsdk/pdfsdk_fieldaction.h
@@ -25,12 +25,12 @@
bool bModifier;
bool bShift;
int nCommitKey;
- CFX_WideString sChange;
- CFX_WideString sChangeEx;
+ WideString sChange;
+ WideString sChangeEx;
bool bKeyDown;
int nSelEnd;
int nSelStart;
- CFX_WideString sValue;
+ WideString sValue;
bool bWillCommit;
bool bFieldFull;
bool bRC;
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp
index c7188ad..6a19efb 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/pwl/cpwl_appstream.cpp
@@ -79,8 +79,8 @@
class AutoClosedCommand {
public:
AutoClosedCommand(std::ostringstream* stream,
- CFX_ByteString open,
- CFX_ByteString close)
+ ByteString open,
+ ByteString close)
: stream_(stream), close_(close) {
*stream_ << open << "\n";
}
@@ -89,7 +89,7 @@
private:
std::ostringstream* stream_;
- CFX_ByteString close_;
+ ByteString close_;
};
class AutoClosedQCommand : public AutoClosedCommand {
@@ -99,8 +99,8 @@
~AutoClosedQCommand() override {}
};
-CFX_ByteString GetColorAppStream(const CFX_Color& color,
- const bool& bFillOrStroke) {
+ByteString GetColorAppStream(const CFX_Color& color,
+ const bool& bFillOrStroke) {
std::ostringstream sColorStream;
switch (color.nColorType) {
@@ -125,10 +125,10 @@
break;
}
- return CFX_ByteString(sColorStream);
+ return ByteString(sColorStream);
}
-CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Check(const CFX_FloatRect& crBBox) {
const float fWidth = crBBox.right - crBBox.left;
const float fHeight = crBBox.top - crBBox.bottom;
@@ -174,10 +174,10 @@
<< pts[nNext][0].y << " " << kCurveToOperator << "\n";
}
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -218,10 +218,10 @@
<< pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " "
<< kCurveToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n";
@@ -230,10 +230,10 @@
csAP << crBBox.left << " " << crBBox.bottom << " " << kMoveToOperator << "\n";
csAP << crBBox.right << " " << crBBox.top << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -250,10 +250,10 @@
csAP << pt4.x << " " << pt4.y << " " << kLineToOperator << "\n";
csAP << pt1.x << " " << pt1.y << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Square(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n";
@@ -263,10 +263,10 @@
csAP << crBBox.left << " " << crBBox.bottom << " " << kLineToOperator << "\n";
csAP << crBBox.left << " " << crBBox.top << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Star(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fRadius = (crBBox.top - crBBox.bottom) / (1 + (float)cos(FX_PI / 5.0f));
@@ -292,10 +292,10 @@
csAP << px[nNext] << " " << py[nNext] << " " << kLineToOperator << "\n";
}
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {
+ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -328,44 +328,44 @@
<< pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " "
<< kCurveToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Check(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Circle(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, false) << GetAP_Cross(rcBBox)
<< kStrokeOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
@@ -373,51 +373,51 @@
<< GetColorAppStream(crText, true) << GetAP_Diamond(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Square(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Star(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
- const CFX_Color& color) {
+ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
+ const CFX_Color& color) {
std::ostringstream sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color, true);
+ ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sAppStream);
sAppStream << sColor << GetAP_Circle(rect) << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
- float fWidth,
- const CFX_Color& color,
- const CFX_Color& crLeftTop,
- const CFX_Color& crRightBottom,
- BorderStyle nStyle,
- const CPWL_Dash& dash) {
+ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
+ float fWidth,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPWL_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
if (fWidth > 0.0f) {
AutoClosedQCommand q(&sAppStream);
@@ -502,12 +502,12 @@
} break;
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
- CheckStyle nStyle,
- const CFX_Color& crText) {
+ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
+ CheckStyle nStyle,
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -530,9 +530,9 @@
}
}
-CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
- CheckStyle nStyle,
- const CFX_Color& crText) {
+ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
+ CheckStyle nStyle,
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -555,33 +555,33 @@
}
}
-CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize) {
+ByteString GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize) {
if (!pFontMap)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
+ ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
if (sFontAlias.GetLength() <= 0 || fFontSize <= 0)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sRet;
sRet << "/" << sFontAlias << " " << fFontSize << " "
<< kSetTextFontAndSizeOperator << "\n";
- return CFX_ByteString(sRet);
+ return ByteString(sRet);
}
-CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) {
+ByteString GetWordRenderString(const ByteString& strWords) {
if (strWords.GetLength() > 0) {
return PDF_EncodeString(strWords, false) + " " + kShowTextOperator + "\n";
}
- return CFX_ByteString();
+ return ByteString();
}
-CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
- const CFX_PointF& ptOffset,
- bool bContinuous,
- uint16_t SubWord) {
+ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
+ const CFX_PointF& ptOffset,
+ bool bContinuous,
+ uint16_t SubWord) {
CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator();
pIterator->SetAt(0);
@@ -597,7 +597,7 @@
if (bContinuous) {
if (place.LineCmp(oldplace) != 0) {
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
@@ -624,7 +624,7 @@
if (pIterator->GetWord(word)) {
if (word.nFontIndex != nCurFontIndex) {
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex,
@@ -661,7 +661,7 @@
}
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
@@ -681,14 +681,14 @@
sAppStream << sEditStream.str();
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit,
- CPDF_Stream* pIconStream,
- const CFX_FloatRect& rcIcon) {
+ByteString GenerateIconAppStream(CPDF_IconFit& fit,
+ CPDF_Stream* pIconStream,
+ const CFX_FloatRect& rcIcon) {
if (rcIcon.IsEmpty() || !pIconStream)
- return CFX_ByteString();
+ return ByteString();
CPWL_Icon icon;
CPWL_Wnd::CreateParams cp;
@@ -698,9 +698,9 @@
icon.SetPDFStream(pIconStream);
icon.Move(rcIcon, false, false);
- CFX_ByteString sAlias = icon.GetImageAlias();
+ ByteString sAlias = icon.GetImageAlias();
if (sAlias.GetLength() <= 0)
- return CFX_ByteString();
+ return ByteString();
CFX_FloatRect rcPlate = icon.GetClientRect();
CFX_Matrix mt = icon.GetImageMatrix().GetInverse();
@@ -732,17 +732,17 @@
}
icon.Destroy();
- return CFX_ByteString(str);
+ return ByteString(str);
}
-CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
- IPVT_FontMap* pFontMap,
- CPDF_Stream* pIconStream,
- CPDF_IconFit& IconFit,
- const CFX_WideString& sLabel,
- const CFX_Color& crText,
- float fFontSize,
- ButtonStyle nLayOut) {
+ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
+ IPVT_FontMap* pFontMap,
+ CPDF_Stream* pIconStream,
+ CPDF_IconFit& IconFit,
+ const WideString& sLabel,
+ const CFX_Color& crText,
+ float fFontSize,
+ ButtonStyle nLayOut) {
const float fAutoFontScale = 1.0f / 3.0f;
auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>();
@@ -902,7 +902,7 @@
if (!rcLabel.IsEmpty()) {
pEdit->SetPlateRect(rcLabel);
- CFX_ByteString sEdit =
+ ByteString sEdit =
GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f), true, 0);
if (sEdit.GetLength() > 0) {
AutoClosedCommand bt(&sTemp, kTextBeginOperator, kTextEndOperator);
@@ -911,7 +911,7 @@
}
if (sTemp.tellp() <= 0)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
{
@@ -923,18 +923,18 @@
<< kEndPathNoFillOrStrokeOperator << "\n";
sAppStream << sTemp.str().c_str();
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
- float fWidth,
- const CFX_Color& color,
- const CFX_Color& crLeftTop,
- const CFX_Color& crRightBottom,
- BorderStyle nStyle,
- const CPWL_Dash& dash) {
+ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
+ float fWidth,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPWL_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
float fLeft = rect.left;
float fRight = rect.right;
@@ -1044,12 +1044,12 @@
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
+ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
if (rcBBox.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
{
@@ -1087,13 +1087,13 @@
<< kLineToOperator << " " << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
- const CFX_Color& color) {
+ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
+ const CFX_Color& color) {
std::ostringstream sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color, true);
+ ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sAppStream);
sAppStream << sColor << rect.left << " " << rect.bottom << " "
@@ -1101,7 +1101,7 @@
<< kAppendRectOperator << " " << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
} // namespace
@@ -1177,7 +1177,7 @@
CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
CFX_Color crText(COLORTYPE_GRAY, 0);
- CFX_ByteString csNameTag;
+ ByteString csNameTag;
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1187,10 +1187,10 @@
if (da.HasFont())
csNameTag = da.GetFont(&fFontSize);
- CFX_WideString csWCaption;
- CFX_WideString csNormalCaption;
- CFX_WideString csRolloverCaption;
- CFX_WideString csDownCaption;
+ WideString csWCaption;
+ WideString csNormalCaption;
+ WideString csRolloverCaption;
+ WideString csDownCaption;
if (pControl->HasMKEntry("CA"))
csNormalCaption = pControl->GetNormalCaption();
@@ -1240,7 +1240,7 @@
widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler());
font_map.SetAPType("N");
- CFX_ByteString csAP =
+ ByteString csAP =
GetRectFillAppStream(rcWindow, crBackground) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder) +
@@ -1359,7 +1359,7 @@
}
CheckStyle nStyle = CheckStyle::kCheck;
- CFX_WideString csWCaption = pControl->GetNormalCaption();
+ WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
case L'l':
@@ -1383,12 +1383,12 @@
}
}
- CFX_ByteString csAP_N_ON =
+ ByteString csAP_N_ON =
GetRectFillAppStream(rcWindow, crBackground) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder);
- CFX_ByteString csAP_N_OFF = csAP_N_ON;
+ ByteString csAP_N_OFF = csAP_N_ON;
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
@@ -1406,12 +1406,12 @@
break;
}
- CFX_ByteString csAP_D_ON =
+ ByteString csAP_D_ON =
GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder);
- CFX_ByteString csAP_D_OFF = csAP_D_ON;
+ ByteString csAP_D_OFF = csAP_D_ON;
csAP_N_ON += GetCheckBoxAppStream(rcClient, nStyle, crText);
csAP_D_ON += GetCheckBoxAppStream(rcClient, nStyle, crText);
@@ -1422,7 +1422,7 @@
Write("D", csAP_D_ON, pControl->GetCheckedAPState());
Write("D", csAP_D_OFF, "Off");
- CFX_ByteString csAS = widget_->GetAppState();
+ ByteString csAS = widget_->GetAppState();
if (csAS.IsEmpty())
widget_->SetAppState("Off");
}
@@ -1475,7 +1475,7 @@
}
CheckStyle nStyle = CheckStyle::kCircle;
- CFX_WideString csWCaption = pControl->GetNormalCaption();
+ WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
case L'8':
@@ -1499,7 +1499,7 @@
}
}
- CFX_ByteString csAP_N_ON;
+ ByteString csAP_N_ON;
CFX_FloatRect rcCenter = rcWindow.GetCenterSquare().GetDeflated(1.0f, 1.0f);
if (nStyle == CheckStyle::kCircle) {
if (nBorderStyle == BorderStyle::BEVELED) {
@@ -1521,7 +1521,7 @@
crRightBottom, nBorderStyle, dsBorder);
}
- CFX_ByteString csAP_N_OFF = csAP_N_ON;
+ ByteString csAP_N_OFF = csAP_N_ON;
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
@@ -1539,7 +1539,7 @@
break;
}
- CFX_ByteString csAP_D_ON;
+ ByteString csAP_D_ON;
if (nStyle == CheckStyle::kCircle) {
CFX_Color crBK = crBackground - 0.25f;
@@ -1563,7 +1563,7 @@
crRightBottom, nBorderStyle, dsBorder);
}
- CFX_ByteString csAP_D_OFF = csAP_D_ON;
+ ByteString csAP_D_OFF = csAP_D_ON;
csAP_N_ON += GetRadioButtonAppStream(rcClient, nStyle, crText);
csAP_D_ON += GetRadioButtonAppStream(rcClient, nStyle, crText);
@@ -1574,12 +1574,12 @@
Write("D", csAP_D_ON, pControl->GetCheckedAPState());
Write("D", csAP_D_OFF, "Off");
- CFX_ByteString csAS = widget_->GetAppState();
+ ByteString csAS = widget_->GetAppState();
if (csAS.IsEmpty())
widget_->SetAppState("Off");
}
-void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) {
+void CPWL_AppStream::SetAsComboBox(const WideString* sValue) {
CPDF_FormControl* pControl = widget_->GetFormControl();
CPDF_FormField* pField = pControl->GetField();
std::ostringstream sBody;
@@ -1623,7 +1623,7 @@
}
CFX_FloatRect rcContent = pEdit->GetContentRect();
- CFX_ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0);
+ ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0);
if (sEdit.GetLength() > 0) {
sBody << "/Tx ";
AutoClosedCommand bmc(&sBody, kMarkedSequenceBeginOperator,
@@ -1645,7 +1645,7 @@
sBody << GetDropButtonAppStream(rcButton);
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody),
"");
}
@@ -1729,11 +1729,11 @@
<< sList.str();
}
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody),
"");
}
-void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
+void CPWL_AppStream::SetAsTextField(const WideString* sValue) {
CPDF_FormControl* pControl = widget_->GetFormControl();
CPDF_FormField* pField = pControl->GetField();
std::ostringstream sBody;
@@ -1771,7 +1771,7 @@
float fFontSize = widget_->GetFontSize();
#ifdef PDF_ENABLE_XFA
- CFX_WideString sValueTmp;
+ WideString sValueTmp;
if (!sValue && widget_->GetMixXFAWidget()) {
sValueTmp = widget_->GetValue(true);
sValue = &sValueTmp;
@@ -1802,7 +1802,7 @@
pEdit->SetText(sValue ? *sValue : pField->GetValue());
CFX_FloatRect rcContent = pEdit->GetContentRect();
- CFX_ByteString sEdit =
+ ByteString sEdit =
GetEditAppStream(pEdit.get(), CFX_PointF(), !bCharArray, subWord);
if (sEdit.GetLength() > 0) {
@@ -1828,7 +1828,7 @@
if (bCharArray) {
switch (widget_->GetBorderStyle()) {
case BorderStyle::SOLID: {
- CFX_ByteString sColor =
+ ByteString sColor =
GetColorAppStream(widget_->GetBorderPWLColor(), false);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sLines);
@@ -1851,7 +1851,7 @@
break;
}
case BorderStyle::DASH: {
- CFX_ByteString sColor =
+ ByteString sColor =
GetColorAppStream(widget_->GetBorderPWLColor(), false);
if (sColor.GetLength() > 0) {
CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0);
@@ -1880,16 +1880,15 @@
}
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() +
- CFX_ByteString(sLines) + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sLines) +
+ ByteString(sBody),
"");
}
-void CPWL_AppStream::AddImage(const CFX_ByteString& sAPType,
- CPDF_Stream* pImage) {
+void CPWL_AppStream::AddImage(const ByteString& sAPType, CPDF_Stream* pImage) {
CPDF_Stream* pStream = dict_->GetStreamFor(sAPType);
CPDF_Dictionary* pStreamDict = pStream->GetDict();
- CFX_ByteString sImageAlias = "IMG";
+ ByteString sImageAlias = "IMG";
if (CPDF_Dictionary* pImageDict = pImage->GetDict()) {
sImageAlias = pImageDict->GetStringFor("Name");
@@ -1908,9 +1907,9 @@
pImage->GetObjNum());
}
-void CPWL_AppStream::Write(const CFX_ByteString& sAPType,
- const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState) {
+void CPWL_AppStream::Write(const ByteString& sAPType,
+ const ByteString& sContents,
+ const ByteString& sAPState) {
CPDF_Stream* pStream = nullptr;
CPDF_Dictionary* pParentDict = nullptr;
if (sAPState.IsEmpty()) {
@@ -1947,19 +1946,19 @@
sContents.GetLength());
}
-void CPWL_AppStream::Remove(const CFX_ByteString& sAPType) {
+void CPWL_AppStream::Remove(const ByteString& sAPType) {
dict_->RemoveFor(sAPType);
}
-CFX_ByteString CPWL_AppStream::GetBackgroundAppStream() const {
+ByteString CPWL_AppStream::GetBackgroundAppStream() const {
CFX_Color crBackground = widget_->GetFillPWLColor();
if (crBackground.nColorType != COLORTYPE_TRANSPARENT)
return GetRectFillAppStream(widget_->GetRotatedRect(), crBackground);
- return CFX_ByteString();
+ return ByteString();
}
-CFX_ByteString CPWL_AppStream::GetBorderAppStream() const {
+ByteString CPWL_AppStream::GetBorderAppStream() const {
CFX_FloatRect rcWindow = widget_->GetRotatedRect();
CFX_Color crBorder = widget_->GetBorderPWLColor();
CFX_Color crBackground = widget_->GetFillPWLColor();
diff --git a/fpdfsdk/pwl/cpwl_appstream.h b/fpdfsdk/pwl/cpwl_appstream.h
index 2043c7b..d73e3aa 100644
--- a/fpdfsdk/pwl/cpwl_appstream.h
+++ b/fpdfsdk/pwl/cpwl_appstream.h
@@ -22,19 +22,19 @@
void SetAsPushButton();
void SetAsCheckBox();
void SetAsRadioButton();
- void SetAsComboBox(const CFX_WideString* sValue);
+ void SetAsComboBox(const WideString* sValue);
void SetAsListBox();
- void SetAsTextField(const CFX_WideString* sValue);
+ void SetAsTextField(const WideString* sValue);
private:
- void AddImage(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
- void Write(const CFX_ByteString& sAPType,
- const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState);
- void Remove(const CFX_ByteString& sAPType);
+ void AddImage(const ByteString& sAPType, CPDF_Stream* pImage);
+ void Write(const ByteString& sAPType,
+ const ByteString& sContents,
+ const ByteString& sAPState);
+ void Remove(const ByteString& sAPType);
- CFX_ByteString GetBackgroundAppStream() const;
- CFX_ByteString GetBorderAppStream() const;
+ ByteString GetBackgroundAppStream() const;
+ ByteString GetBorderAppStream() const;
CFX_UnownedPtr<CPDFSDK_Widget> widget_;
CFX_UnownedPtr<CPDF_Dictionary> dict_;
diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp
index fc0479b..5c06a98 100644
--- a/fpdfsdk/pwl/cpwl_button.cpp
+++ b/fpdfsdk/pwl/cpwl_button.cpp
@@ -11,7 +11,7 @@
CPWL_Button::~CPWL_Button() {}
-CFX_ByteString CPWL_Button::GetClassName() const {
+ByteString CPWL_Button::GetClassName() const {
return "CPWL_Button";
}
diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h
index f26ae1c..70f5ef1 100644
--- a/fpdfsdk/pwl/cpwl_button.h
+++ b/fpdfsdk/pwl/cpwl_button.h
@@ -15,7 +15,7 @@
~CPWL_Button() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp
index 3d05961..b1040bc 100644
--- a/fpdfsdk/pwl/cpwl_caret.cpp
+++ b/fpdfsdk/pwl/cpwl_caret.cpp
@@ -19,7 +19,7 @@
CPWL_Caret::~CPWL_Caret() {}
-CFX_ByteString CPWL_Caret::GetClassName() const {
+ByteString CPWL_Caret::GetClassName() const {
return "CPWL_Caret";
}
diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h
index 3203470..fb0fa89 100644
--- a/fpdfsdk/pwl/cpwl_caret.h
+++ b/fpdfsdk/pwl/cpwl_caret.h
@@ -15,7 +15,7 @@
~CPWL_Caret() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
void InvalidateRect(CFX_FloatRect* pRect) override;
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp
index 0365194..5bb9124 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -147,7 +147,7 @@
CPWL_ComboBox::~CPWL_ComboBox() {}
-CFX_ByteString CPWL_ComboBox::GetClassName() const {
+ByteString CPWL_ComboBox::GetClassName() const {
return "CPWL_ComboBox";
}
@@ -177,31 +177,31 @@
CPWL_Wnd::KillFocus();
}
-CFX_WideString CPWL_ComboBox::GetSelectedText() {
+WideString CPWL_ComboBox::GetSelectedText() {
if (m_pEdit)
return m_pEdit->GetSelectedText();
- return CFX_WideString();
+ return WideString();
}
-void CPWL_ComboBox::ReplaceSelection(const CFX_WideString& text) {
+void CPWL_ComboBox::ReplaceSelection(const WideString& text) {
if (m_pEdit)
m_pEdit->ReplaceSelection(text);
}
-CFX_WideString CPWL_ComboBox::GetText() const {
+WideString CPWL_ComboBox::GetText() const {
if (m_pEdit) {
return m_pEdit->GetText();
}
- return CFX_WideString();
+ return WideString();
}
-void CPWL_ComboBox::SetText(const CFX_WideString& text) {
+void CPWL_ComboBox::SetText(const WideString& text) {
if (m_pEdit)
m_pEdit->SetText(text);
}
-void CPWL_ComboBox::AddString(const CFX_WideString& str) {
+void CPWL_ComboBox::AddString(const WideString& str) {
if (m_pList)
m_pList->AddString(str);
}
diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h
index b431191..c9fa2cd 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.h
+++ b/fpdfsdk/pwl/cpwl_combo_box.h
@@ -50,7 +50,7 @@
CPWL_Edit* GetEdit() const { return m_pEdit.Get(); }
// CPWL_Wnd:
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void OnDestroy() override;
bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override;
@@ -62,14 +62,14 @@
CFX_FloatRect GetFocusRect() const override;
void SetFocus() override;
void KillFocus() override;
- CFX_WideString GetSelectedText() override;
- void ReplaceSelection(const CFX_WideString& text) override;
+ WideString GetSelectedText() override;
+ void ReplaceSelection(const WideString& text) override;
void SetFillerNotify(IPWL_Filler_Notify* pNotify);
- CFX_WideString GetText() const;
- void SetText(const CFX_WideString& text);
- void AddString(const CFX_WideString& str);
+ WideString GetText() const;
+ void SetText(const WideString& text);
+ void AddString(const WideString& str);
int32_t GetSelect() const;
void SetSelect(int32_t nItemIndex);
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 8fbafd0..c71dbe4 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -35,18 +35,18 @@
ASSERT(!m_bFocus);
}
-CFX_ByteString CPWL_Edit::GetClassName() const {
+ByteString CPWL_Edit::GetClassName() const {
return PWL_CLASSNAME_EDIT;
}
-void CPWL_Edit::SetText(const CFX_WideString& csText) {
- CFX_WideString swText = csText;
+void CPWL_Edit::SetText(const WideString& csText) {
+ WideString swText = csText;
if (!HasFlag(PES_RICH)) {
m_pEdit->SetText(swText);
return;
}
- CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText);
+ ByteString sValue = ByteString::FromUnicode(swText);
std::unique_ptr<CXML_Element> pXML(
CXML_Element::Parse(sValue.c_str(), sValue.GetLength()));
if (!pXML) {
@@ -62,7 +62,7 @@
if (!pSubElement || !pSubElement->GetTagName().EqualNoCase("p"))
continue;
- CFX_WideString swSection;
+ WideString swSection;
int nSubChild = pSubElement->CountChildren();
for (int32_t j = 0; j < nSubChild; j++) {
CXML_Content* pSubContent = ToContent(pSubElement->GetChild(j));
@@ -443,7 +443,7 @@
m_pEdit->SetLimitChar(nLimitChar);
}
-void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) {
+void CPWL_Edit::ReplaceSel(const WideString& wsText) {
m_pEdit->ClearSelection();
m_pEdit->InsertText(wsText, FX_CHARSET_Default);
}
@@ -463,8 +463,8 @@
if (nChar == FWL_VKEY_Delete) {
if (m_pFillerNotify) {
- CFX_WideString strChange;
- CFX_WideString strChangeEx;
+ WideString strChange;
+ WideString strChangeEx;
int nSelStart = 0;
int nSelEnd = 0;
@@ -532,7 +532,7 @@
if (!IsCTRLpressed(nFlag)) {
if (m_pFillerNotify) {
- CFX_WideString swChange;
+ WideString swChange;
int nSelStart = 0;
int nSelEnd = 0;
@@ -550,7 +550,7 @@
break;
}
- CFX_WideString strChangeEx;
+ WideString strChangeEx;
std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke(
GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, true,
nFlag);
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h
index 3e8de04..d61b947 100644
--- a/fpdfsdk/pwl/cpwl_edit.h
+++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -27,8 +27,8 @@
float* fPopupRet) = 0;
virtual 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,
@@ -47,7 +47,7 @@
~CPWL_Edit() override;
// CPWL_EditCtrl
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreated() override;
void RePosChildWnd() override;
CFX_FloatRect GetClientRect() const override;
@@ -80,8 +80,8 @@
void CutText();
- void SetText(const CFX_WideString& csText);
- void ReplaceSel(const CFX_WideString& csText);
+ void SetText(const WideString& csText);
+ void ReplaceSel(const WideString& csText);
bool IsTextFull() const;
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
index 7baaaa8..f0fc408 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
@@ -52,14 +52,14 @@
}
}
-CFX_WideString CPWL_EditCtrl::GetSelectedText() {
+WideString CPWL_EditCtrl::GetSelectedText() {
if (m_pEdit)
return m_pEdit->GetSelectedText();
- return CFX_WideString();
+ return WideString();
}
-void CPWL_EditCtrl::ReplaceSelection(const CFX_WideString& text) {
+void CPWL_EditCtrl::ReplaceSelection(const WideString& text) {
if (!m_pEdit)
return;
@@ -338,7 +338,7 @@
}
}
-CFX_WideString CPWL_EditCtrl::GetText() const {
+WideString CPWL_EditCtrl::GetText() const {
return m_pEdit->GetText();
}
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h
index eb4470f..37ac320 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h
@@ -25,7 +25,7 @@
CPWL_EditCtrl();
~CPWL_EditCtrl() override;
- CFX_WideString GetText() const;
+ WideString GetText() const;
void SetSelection(int32_t nStartChar, int32_t nEndChar);
void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const;
void ClearSelection();
@@ -60,8 +60,8 @@
void SetFontSize(float fFontSize) override;
float GetFontSize() const override;
void SetCursor() override;
- CFX_WideString GetSelectedText() override;
- void ReplaceSelection(const CFX_WideString& text) override;
+ WideString GetSelectedText() override;
+ void ReplaceSelection(const WideString& text) override;
void SetCaret(bool bVisible,
const CFX_PointF& ptHead,
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index c44301f..c651999 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -43,7 +43,7 @@
CPDF_Font* pFont,
float fFontSize,
const CFX_Matrix& mtUser2Device,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB crTextFill,
int32_t nHorzScale) {
if (!pFont)
@@ -394,7 +394,7 @@
CFXEU_Clear::CFXEU_Clear(CPWL_EditImpl* pEdit,
const CPVT_WordRange& wrSel,
- const CFX_WideString& swText)
+ const WideString& swText)
: m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {
ASSERT(m_pEdit);
}
@@ -417,7 +417,7 @@
CFXEU_InsertText::CFXEU_InsertText(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
- const CFX_WideString& swText,
+ const WideString& swText,
int32_t charset)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
@@ -526,7 +526,7 @@
DrawTextString(
pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
+ ByteString(sTextBuf), crOldFill, nHorzScale);
sTextBuf.str("");
}
@@ -553,7 +553,7 @@
DrawTextString(pDevice,
CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
+ ByteString(sTextBuf), crOldFill, nHorzScale);
}
}
@@ -736,8 +736,8 @@
return m_wpCaret;
}
-CFX_WideString CPWL_EditImpl::GetText() const {
- CFX_WideString swRet;
+WideString CPWL_EditImpl::GetText() const {
+ WideString swRet;
if (!m_pVT->IsValid())
return swRet;
@@ -757,8 +757,8 @@
return swRet;
}
-CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const {
- CFX_WideString swRet;
+WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const {
+ WideString swRet;
if (!m_pVT->IsValid())
return swRet;
@@ -783,7 +783,7 @@
return swRet;
}
-CFX_WideString CPWL_EditImpl::GetSelectedText() const {
+WideString CPWL_EditImpl::GetSelectedText() const {
return GetRangeText(m_SelState.ConvertToWordRange());
}
@@ -802,7 +802,7 @@
return m_SelState.ConvertToWordRange();
}
-void CPWL_EditImpl::SetText(const CFX_WideString& sText) {
+void CPWL_EditImpl::SetText(const WideString& sText) {
Empty();
DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FX_CHARSET_Default);
Paint();
@@ -828,7 +828,7 @@
return Clear(true, true);
}
-bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, int32_t charset) {
+bool CPWL_EditImpl::InsertText(const WideString& sText, int32_t charset) {
return InsertText(sText, charset, true, true);
}
@@ -1702,7 +1702,7 @@
return true;
}
-bool CPWL_EditImpl::InsertText(const CFX_WideString& sText,
+bool CPWL_EditImpl::InsertText(const WideString& sText,
int32_t charset,
bool bAddUndo,
bool bPaint) {
@@ -1836,7 +1836,7 @@
}
CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place,
- const CFX_WideString& sText,
+ const WideString& sText,
int32_t charset) {
CPVT_WordPlace wp = place;
@@ -1877,15 +1877,15 @@
m_Undo.AddItem(std::move(pEditUndoItem));
}
-CFX_ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord) {
+ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord) {
IPVT_FontMap* pFontMap = GetFontMap();
CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex);
if (!pPDFFont)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString sWord;
+ ByteString sWord;
if (SubWord > 0) {
Word = SubWord;
} else {
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index 177a052..a63b22c 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -233,7 +233,7 @@
public:
CFXEU_Clear(CPWL_EditImpl* pEdit,
const CPVT_WordRange& wrSel,
- const CFX_WideString& swText);
+ const WideString& swText);
~CFXEU_Clear() override;
// IFX_Edit_UndoItem:
@@ -244,7 +244,7 @@
CFX_UnownedPtr<CPWL_EditImpl> m_pEdit;
CPVT_WordRange m_wrSel;
- CFX_WideString m_swText;
+ WideString m_swText;
};
class CFXEU_InsertText : public IFX_Edit_UndoItem {
@@ -252,7 +252,7 @@
CFXEU_InsertText(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
- const CFX_WideString& swText,
+ const WideString& swText,
int32_t charset);
~CFXEU_InsertText() override;
@@ -265,7 +265,7 @@
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
- CFX_WideString m_swText;
+ WideString m_swText;
int32_t m_nCharset;
};
@@ -323,27 +323,27 @@
void OnVK_RIGHT(bool bShift, bool bCtrl);
void OnVK_HOME(bool bShift, bool bCtrl);
void OnVK_END(bool bShift, bool bCtrl);
- void SetText(const CFX_WideString& sText);
+ void SetText(const WideString& sText);
bool InsertWord(uint16_t word, int32_t charset);
bool InsertReturn();
bool Backspace();
bool Delete();
bool ClearSelection();
- bool InsertText(const CFX_WideString& sText, int32_t charset);
+ bool InsertText(const WideString& sText, int32_t charset);
bool Redo();
bool Undo();
CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
int32_t GetCaret() const;
CPVT_WordPlace GetCaretWordPlace() const;
- CFX_WideString GetSelectedText() const;
- CFX_WideString GetText() const;
+ WideString GetSelectedText() const;
+ WideString GetText() const;
float GetFontSize() const;
uint16_t GetPasswordChar() const;
CFX_PointF GetScrollPos() const;
int32_t GetCharArray() const;
CFX_FloatRect GetContentRect() const;
- CFX_WideString GetRangeText(const CPVT_WordRange& range) const;
+ WideString GetRangeText(const CPVT_WordRange& range) const;
int32_t GetHorzScale() const;
float GetCharSpace() const;
void SetSelection(int32_t nStartChar, int32_t nEndChar);
@@ -366,15 +366,15 @@
bool Empty();
CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place,
- const CFX_WideString& sText,
+ const WideString& sText,
int32_t charset);
int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset);
int32_t GetTotalLines() const;
- CFX_ByteString GetPDFWordString(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord);
+ ByteString GetPDFWordString(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord);
private:
friend class CPWL_EditImpl_Iterator;
@@ -408,7 +408,7 @@
bool Backspace(bool bAddUndo, bool bPaint);
bool Delete(bool bAddUndo, bool bPaint);
bool Clear(bool bAddUndo, bool bPaint);
- bool InsertText(const CFX_WideString& sText,
+ bool InsertText(const WideString& sText,
int32_t charset,
bool bAddUndo,
bool bPaint);
diff --git a/fpdfsdk/pwl/cpwl_font_map.cpp b/fpdfsdk/pwl/cpwl_font_map.cpp
index 8629735..94d5fb8 100644
--- a/fpdfsdk/pwl/cpwl_font_map.cpp
+++ b/fpdfsdk/pwl/cpwl_font_map.cpp
@@ -66,11 +66,11 @@
return nullptr;
}
-CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
+ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
if (pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex])
return m_Data[nFontIndex]->sFontName;
- return CFX_ByteString();
+ return ByteString();
}
bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) {
@@ -122,15 +122,15 @@
return word < 0xFF ? word : -1;
}
-CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) {
+ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) {
for (const auto& pData : m_NativeFont) {
if (pData && pData->nCharset == nCharset)
return pData->sFontName;
}
- CFX_ByteString sNew = GetNativeFont(nCharset);
+ ByteString sNew = GetNativeFont(nCharset);
if (sNew.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
auto pNewData = pdfium::MakeUnique<CPWL_FontMap_Native>();
pNewData->nCharset = nCharset;
@@ -148,7 +148,7 @@
GetFontIndex(kDefaultFontName, FX_CHARSET_ANSI, false);
}
-bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
+bool CPWL_FontMap::IsStandardFont(const ByteString& sFontName) {
for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) {
if (sFontName == g_sDEStandardFontName[i])
return true;
@@ -157,8 +157,7 @@
return false;
}
-int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName,
- int32_t nCharset) {
+int32_t CPWL_FontMap::FindFont(const ByteString& sFontName, int32_t nCharset) {
int32_t i = 0;
for (const auto& pData : m_Data) {
if (pData &&
@@ -171,17 +170,17 @@
return -1;
}
-int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
+int32_t CPWL_FontMap::GetFontIndex(const ByteString& sFontName,
int32_t nCharset,
bool bFind) {
int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset);
if (nFontIndex >= 0)
return nFontIndex;
- CFX_ByteString sAlias;
+ ByteString sAlias;
CPDF_Font* pFont = bFind ? FindFontSameCharset(&sAlias, nCharset) : nullptr;
if (!pFont) {
- CFX_ByteString sTemp = sFontName;
+ ByteString sTemp = sFontName;
pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);
sAlias = EncodeFontAlias(sTemp, nCharset);
}
@@ -189,13 +188,13 @@
return AddFontData(pFont, sAlias, nCharset);
}
-CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
+CPDF_Font* CPWL_FontMap::FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) {
return nullptr;
}
int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias,
+ const ByteString& sFontAlias,
int32_t nCharset) {
auto pNewData = pdfium::MakeUnique<CPWL_FontMap_Data>();
pNewData->pFont = pFont;
@@ -205,22 +204,21 @@
return pdfium::CollectionSize<int32_t>(m_Data) - 1;
}
-void CPWL_FontMap::AddedFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias) {}
+void CPWL_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) {}
-CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
+ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
if (nCharset == FX_CHARSET_Default)
nCharset = GetNativeCharset();
- CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset);
+ ByteString sFontName = GetDefaultFontByCharset(nCharset);
if (!m_pSystemHandler->FindNativeTrueTypeFont(sFontName))
- return CFX_ByteString();
+ return ByteString();
return sFontName;
}
CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset) {
if (IsStandardFont(sFontName))
return AddStandardFont(pDoc, sFontName);
@@ -229,7 +227,7 @@
}
CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName) {
+ ByteString& sFontName) {
if (!pDoc)
return nullptr;
@@ -246,7 +244,7 @@
}
CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset) {
if (!pDoc)
return nullptr;
@@ -260,15 +258,15 @@
nCharset);
}
-CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName,
- int32_t nCharset) {
- CFX_ByteString sPostfix;
+ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName,
+ int32_t nCharset) {
+ ByteString sPostfix;
sPostfix.Format("_%02X", nCharset);
return EncodeFontAlias(sFontName) + sPostfix;
}
-CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) {
- CFX_ByteString sRet = sFontName;
+ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName) {
+ ByteString sRet = sFontName;
sRet.Remove(' ');
return sRet;
}
@@ -349,7 +347,7 @@
{FX_CHARSET_MSWin_Arabic, "Arial"},
{-1, nullptr}};
-CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
+ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
int i = 0;
while (defaultTTFMap[i].charset != -1) {
if (nCharset == defaultTTFMap[i].charset)
diff --git a/fpdfsdk/pwl/cpwl_font_map.h b/fpdfsdk/pwl/cpwl_font_map.h
index 9872779..5336949 100644
--- a/fpdfsdk/pwl/cpwl_font_map.h
+++ b/fpdfsdk/pwl/cpwl_font_map.h
@@ -21,12 +21,12 @@
struct CPWL_FontMap_Data {
CPDF_Font* pFont;
int32_t nCharset;
- CFX_ByteString sFontName;
+ ByteString sFontName;
};
struct CPWL_FontMap_Native {
int32_t nCharset;
- CFX_ByteString sFontName;
+ ByteString sFontName;
};
class CPWL_FontMap : public IPVT_FontMap {
@@ -36,7 +36,7 @@
// IPVT_FontMap
CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
- CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
+ ByteString GetPDFFontAlias(int32_t nFontIndex) override;
int32_t GetWordFontIndex(uint16_t word,
int32_t nCharset,
int32_t nFontIndex) override;
@@ -45,47 +45,46 @@
const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
static int32_t GetNativeCharset();
- CFX_ByteString GetNativeFontName(int32_t nCharset);
+ ByteString GetNativeFontName(int32_t nCharset);
- static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset);
+ static ByteString GetDefaultFontByCharset(int32_t nCharset);
static const FPDF_CharsetFontMap defaultTTFMap[];
protected:
virtual void Initialize();
virtual CPDF_Document* GetDocument();
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
+ virtual CPDF_Font* FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+ virtual void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias);
bool KnowWord(int32_t nFontIndex, uint16_t word);
void Empty();
- int32_t GetFontIndex(const CFX_ByteString& sFontName,
+ int32_t GetFontIndex(const ByteString& sFontName,
int32_t nCharset,
bool bFind);
int32_t AddFontData(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias,
+ const ByteString& sFontAlias,
int32_t nCharset = FX_CHARSET_Default);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
- int32_t nCharset);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
+ ByteString EncodeFontAlias(const ByteString& sFontName, int32_t nCharset);
+ ByteString EncodeFontAlias(const ByteString& sFontName);
std::vector<std::unique_ptr<CPWL_FontMap_Data>> m_Data;
std::vector<std::unique_ptr<CPWL_FontMap_Native>> m_NativeFont;
private:
- int32_t FindFont(const CFX_ByteString& sFontName,
+ int32_t FindFont(const ByteString& sFontName,
int32_t nCharset = FX_CHARSET_Default);
- CFX_ByteString GetNativeFont(int32_t nCharset);
+ ByteString GetNativeFont(int32_t nCharset);
CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset);
- bool IsStandardFont(const CFX_ByteString& sFontName);
- CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
+ bool IsStandardFont(const ByteString& sFontName);
+ CPDF_Font* AddStandardFont(CPDF_Document* pDoc, ByteString& sFontName);
CPDF_Font* AddSystemFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset);
std::unique_ptr<CPDF_Document> m_pPDFDoc;
diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp
index 8a2e31d..e7669b3 100644
--- a/fpdfsdk/pwl/cpwl_icon.cpp
+++ b/fpdfsdk/pwl/cpwl_icon.cpp
@@ -37,12 +37,12 @@
return CFX_Matrix();
}
-CFX_ByteString CPWL_Icon::GetImageAlias() {
+ByteString CPWL_Icon::GetImageAlias() {
if (!m_pPDFStream)
- return CFX_ByteString();
+ return ByteString();
if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict())
return pDict->GetStringFor("Name");
- return CFX_ByteString();
+ return ByteString();
}
std::pair<float, float> CPWL_Icon::GetIconPosition() {
diff --git a/fpdfsdk/pwl/cpwl_icon.h b/fpdfsdk/pwl/cpwl_icon.h
index 2607e56..e2f792b 100644
--- a/fpdfsdk/pwl/cpwl_icon.h
+++ b/fpdfsdk/pwl/cpwl_icon.h
@@ -28,7 +28,7 @@
std::pair<float, float> GetImageOffset();
CFX_Matrix GetImageMatrix();
- CFX_ByteString GetImageAlias();
+ ByteString GetImageAlias();
private:
// left, bottom
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 4090e79..b5c6293 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -72,7 +72,7 @@
CPWL_ListBox::~CPWL_ListBox() {}
-CFX_ByteString CPWL_ListBox::GetClassName() const {
+ByteString CPWL_ListBox::GetClassName() const {
return "CPWL_ListBox";
}
@@ -260,8 +260,8 @@
if (!m_pFillerNotify)
return false;
- CFX_WideString swChange = GetText();
- CFX_WideString strChangeEx;
+ WideString swChange = GetText();
+ WideString strChangeEx;
int nSelStart = 0;
int nSelEnd = swChange.GetLength();
bool bRC;
@@ -282,11 +282,11 @@
return CPWL_Wnd::GetFocusRect();
}
-void CPWL_ListBox::AddString(const CFX_WideString& str) {
+void CPWL_ListBox::AddString(const WideString& str) {
m_pList->AddString(str);
}
-CFX_WideString CPWL_ListBox::GetText() const {
+WideString CPWL_ListBox::GetText() const {
return m_pList->GetText();
}
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h
index f620ec1..1e028f7 100644
--- a/fpdfsdk/pwl/cpwl_list_box.h
+++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -44,7 +44,7 @@
~CPWL_ListBox() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreated() override;
void OnDestroy() override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
@@ -66,11 +66,11 @@
void SetFontSize(float fFontSize) override;
float GetFontSize() const override;
- virtual CFX_WideString GetText() const;
+ virtual WideString GetText() const;
bool OnNotifySelectionChanged(bool bKeyDown, uint32_t nFlag);
- void AddString(const CFX_WideString& str);
+ void AddString(const WideString& str);
void SetTopVisibleIndex(int32_t nItemIndex);
void ScrollToListItem(int32_t nItemIndex);
void ResetContent();
diff --git a/fpdfsdk/pwl/cpwl_list_impl.cpp b/fpdfsdk/pwl/cpwl_list_impl.cpp
index 94e0606..da455d0 100644
--- a/fpdfsdk/pwl/cpwl_list_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_impl.cpp
@@ -29,7 +29,7 @@
m_pEdit->SetFontMap(pFontMap);
}
-void CPWL_ListCtrl::Item::SetText(const CFX_WideString& text) {
+void CPWL_ListCtrl::Item::SetText(const WideString& text) {
m_pEdit->SetText(text);
}
@@ -49,7 +49,7 @@
return word.Word;
}
-CFX_WideString CPWL_ListCtrl::Item::GetText() const {
+WideString CPWL_ListCtrl::Item::GetText() const {
return m_pEdit->GetText();
}
@@ -310,7 +310,7 @@
return InnerToOuter(rcItem);
}
-void CPWL_ListCtrl::AddString(const CFX_WideString& str) {
+void CPWL_ListCtrl::AddString(const WideString& str) {
AddItem(str);
ReArrange(GetCount() - 1);
}
@@ -551,13 +551,13 @@
return -1;
}
-CFX_WideString CPWL_ListCtrl::GetText() const {
+WideString CPWL_ListCtrl::GetText() const {
if (IsMultipleSel())
return GetItemText(m_nCaretIndex);
return GetItemText(m_nSelItem);
}
-void CPWL_ListCtrl::AddItem(const CFX_WideString& str) {
+void CPWL_ListCtrl::AddItem(const WideString& str) {
auto pListItem = pdfium::MakeUnique<Item>();
pListItem->SetFontMap(m_pFontMap.Get());
pListItem->SetFontSize(m_fFontSize);
@@ -630,7 +630,7 @@
return pdfium::IndexInBounds(m_ListItems, nItemIndex);
}
-CFX_WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
+WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex])
return m_ListItems[nIndex]->GetText();
return L"";
diff --git a/fpdfsdk/pwl/cpwl_list_impl.h b/fpdfsdk/pwl/cpwl_list_impl.h
index 9bb0d29..18ca0a3 100644
--- a/fpdfsdk/pwl/cpwl_list_impl.h
+++ b/fpdfsdk/pwl/cpwl_list_impl.h
@@ -68,13 +68,13 @@
CFX_FloatRect GetContentRect() const;
int32_t GetItemIndex(const CFX_PointF& point) const;
- void AddString(const CFX_WideString& str);
+ void AddString(const WideString& str);
void SetTopItem(int32_t nIndex);
void Select(int32_t nItemIndex);
void SetCaret(int32_t nItemIndex);
void Empty();
void Cancel();
- CFX_WideString GetText() const;
+ WideString GetText() const;
void SetFontMap(IPVT_FontMap* pFontMap) { m_pFontMap = pFontMap; }
void SetFontSize(float fFontSize) { m_fFontSize = fFontSize; }
@@ -102,9 +102,9 @@
void SetRect(const CFX_FloatRect& rect) { m_rcListItem = rect; }
void SetSelect(bool bSelected) { m_bSelected = bSelected; }
- void SetText(const CFX_WideString& text);
+ void SetText(const WideString& text);
void SetFontSize(float fFontSize);
- CFX_WideString GetText() const;
+ WideString GetText() const;
CFX_FloatRect GetRect() const { return m_rcListItem; }
bool IsSelected() const { return m_bSelected; }
@@ -142,8 +142,8 @@
bool IsItemVisible(int32_t nItemIndex) const;
void SetScrollInfo();
void SetScrollPosY(float fy);
- void AddItem(const CFX_WideString& str);
- CFX_WideString GetItemText(int32_t nIndex) const;
+ void AddItem(const WideString& str);
+ WideString GetItemText(int32_t nIndex) const;
void SetItemSelect(int32_t nItemIndex, bool bSelected);
int32_t GetLastSelected() const;
CFX_PointF GetBTPoint() const {
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 1524729..e50f778 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -127,7 +127,7 @@
CPWL_SBButton::~CPWL_SBButton() {}
-CFX_ByteString CPWL_SBButton::GetClassName() const {
+ByteString CPWL_SBButton::GetClassName() const {
return "CPWL_SBButton";
}
@@ -325,7 +325,7 @@
CPWL_ScrollBar::~CPWL_ScrollBar() {}
-CFX_ByteString CPWL_ScrollBar::GetClassName() const {
+ByteString CPWL_ScrollBar::GetClassName() const {
return "CPWL_ScrollBar";
}
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h
index 44c72cb..48aef16 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.h
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.h
@@ -49,7 +49,7 @@
~CPWL_SBButton() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
@@ -121,7 +121,7 @@
~CPWL_ScrollBar() override;
// CPWL_Wnd:
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void OnDestroy() override;
void RePosChildWnd() override;
diff --git a/fpdfsdk/pwl/cpwl_special_button.cpp b/fpdfsdk/pwl/cpwl_special_button.cpp
index 53f7f2c..ddca67e 100644
--- a/fpdfsdk/pwl/cpwl_special_button.cpp
+++ b/fpdfsdk/pwl/cpwl_special_button.cpp
@@ -12,7 +12,7 @@
CPWL_PushButton::~CPWL_PushButton() {}
-CFX_ByteString CPWL_PushButton::GetClassName() const {
+ByteString CPWL_PushButton::GetClassName() const {
return "CPWL_PushButton";
}
@@ -25,7 +25,7 @@
CPWL_CheckBox::~CPWL_CheckBox() {}
-CFX_ByteString CPWL_CheckBox::GetClassName() const {
+ByteString CPWL_CheckBox::GetClassName() const {
return "CPWL_CheckBox";
}
@@ -54,7 +54,7 @@
CPWL_RadioButton::~CPWL_RadioButton() {}
-CFX_ByteString CPWL_RadioButton::GetClassName() const {
+ByteString CPWL_RadioButton::GetClassName() const {
return "CPWL_RadioButton";
}
diff --git a/fpdfsdk/pwl/cpwl_special_button.h b/fpdfsdk/pwl/cpwl_special_button.h
index b499542..076b529 100644
--- a/fpdfsdk/pwl/cpwl_special_button.h
+++ b/fpdfsdk/pwl/cpwl_special_button.h
@@ -15,7 +15,7 @@
~CPWL_PushButton() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
CFX_FloatRect GetFocusRect() const override;
};
@@ -25,7 +25,7 @@
~CPWL_CheckBox() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
bool OnChar(uint16_t nChar, uint32_t nFlag) override;
@@ -42,7 +42,7 @@
~CPWL_RadioButton() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
bool OnChar(uint16_t nChar, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 401fed3..1c1512e 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -146,7 +146,7 @@
ASSERT(!m_bCreated);
}
-CFX_ByteString CPWL_Wnd::GetClassName() const {
+ByteString CPWL_Wnd::GetClassName() const {
return "CPWL_Wnd";
}
@@ -361,11 +361,11 @@
PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
#undef PWL_IMPLEMENT_MOUSE_METHOD
-CFX_WideString CPWL_Wnd::GetSelectedText() {
- return CFX_WideString();
+WideString CPWL_Wnd::GetSelectedText() {
+ return WideString();
}
-void CPWL_Wnd::ReplaceSelection(const CFX_WideString& text) {}
+void CPWL_Wnd::ReplaceSelection(const WideString& text) {}
bool CPWL_Wnd::OnMouseWheel(short zDelta,
const CFX_PointF& point,
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 2fd5077..17ed064 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -152,7 +152,7 @@
CPWL_Wnd();
~CPWL_Wnd() override;
- virtual CFX_ByteString GetClassName() const;
+ virtual ByteString GetClassName() const;
virtual void InvalidateRect(CFX_FloatRect* pRect);
virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag);
@@ -179,8 +179,8 @@
virtual void SetFontSize(float fFontSize);
virtual float GetFontSize() const;
- virtual CFX_WideString GetSelectedText();
- virtual void ReplaceSelection(const CFX_WideString& text);
+ virtual WideString GetSelectedText();
+ virtual void ReplaceSelection(const WideString& text);
virtual CFX_FloatRect GetFocusRect() const;
virtual CFX_FloatRect GetClientRect() const;
diff --git a/fxbarcode/BC_UtilCodingConvert.cpp b/fxbarcode/BC_UtilCodingConvert.cpp
index f0f497a..77c52f2 100644
--- a/fxbarcode/BC_UtilCodingConvert.cpp
+++ b/fxbarcode/BC_UtilCodingConvert.cpp
@@ -10,43 +10,42 @@
CBC_UtilCodingConvert::~CBC_UtilCodingConvert() {}
-void CBC_UtilCodingConvert::UnicodeToLocale(const CFX_WideString& src,
- CFX_ByteString& dst) {
- dst = CFX_ByteString::FromUnicode(src);
+void CBC_UtilCodingConvert::UnicodeToLocale(const WideString& src,
+ ByteString& dst) {
+ dst = ByteString::FromUnicode(src);
}
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
- CFX_ByteString& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
+void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
+ ByteString& dst) {
+ WideString unicode = WideString::FromLocal(src.AsStringView());
dst = unicode.UTF8Encode();
}
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
+void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
std::vector<uint8_t>& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
- CFX_ByteString utf8 = unicode.UTF8Encode();
+ WideString unicode = WideString::FromLocal(src.AsStringView());
+ ByteString utf8 = unicode.UTF8Encode();
dst = std::vector<uint8_t>(utf8.begin(), utf8.end());
}
void CBC_UtilCodingConvert::Utf8ToLocale(const std::vector<uint8_t>& src,
- CFX_ByteString& dst) {
- CFX_ByteString utf8;
+ ByteString& dst) {
+ ByteString utf8;
for (uint8_t value : src)
utf8 += value;
- CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC());
- dst = CFX_ByteString::FromUnicode(unicode);
+ WideString unicode = WideString::FromUTF8(utf8.AsStringView());
+ dst = ByteString::FromUnicode(unicode);
}
void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src,
int32_t count,
- CFX_ByteString& dst) {
- CFX_WideString unicode =
- CFX_WideString::FromUTF8(CFX_ByteStringC(src, count));
- dst = CFX_ByteString::FromUnicode(unicode);
+ ByteString& dst) {
+ WideString unicode = WideString::FromUTF8(ByteStringView(src, count));
+ dst = ByteString::FromUnicode(unicode);
}
-void CBC_UtilCodingConvert::UnicodeToUTF8(const CFX_WideString& src,
- CFX_ByteString& dst) {
+void CBC_UtilCodingConvert::UnicodeToUTF8(const WideString& src,
+ ByteString& dst) {
dst = src.UTF8Encode();
}
diff --git a/fxbarcode/BC_UtilCodingConvert.h b/fxbarcode/BC_UtilCodingConvert.h
index de6b30e..8600cd1 100644
--- a/fxbarcode/BC_UtilCodingConvert.h
+++ b/fxbarcode/BC_UtilCodingConvert.h
@@ -15,19 +15,16 @@
public:
CBC_UtilCodingConvert();
virtual ~CBC_UtilCodingConvert();
- static void UnicodeToLocale(const CFX_WideString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
+ static void UnicodeToLocale(const WideString& source, ByteString& result);
+ static void LocaleToUtf8(const ByteString& source, ByteString& result);
+ static void LocaleToUtf8(const ByteString& source,
std::vector<uint8_t>& result);
static void Utf8ToLocale(const std::vector<uint8_t>& source,
- CFX_ByteString& result);
+ ByteString& result);
static void Utf8ToLocale(const uint8_t* source,
int32_t count,
- CFX_ByteString& result);
- static void UnicodeToUTF8(const CFX_WideString& source,
- CFX_ByteString& result);
+ ByteString& result);
+ static void UnicodeToUTF8(const WideString& source, ByteString& result);
};
#endif // FXBARCODE_BC_UTILCODINGCONVERT_H_
diff --git a/fxbarcode/BC_Utils.cpp b/fxbarcode/BC_Utils.cpp
index 284322e..1d09e24 100644
--- a/fxbarcode/BC_Utils.cpp
+++ b/fxbarcode/BC_Utils.cpp
@@ -8,7 +8,7 @@
#include "fxbarcode/utils.h"
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+bool BC_FX_ByteString_Replace(ByteString& dst,
uint32_t first,
uint32_t last,
int32_t count,
@@ -23,12 +23,11 @@
return true;
}
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) {
+void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c) {
for (int32_t i = 0; i < count; i++)
dst += c;
}
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const std::vector<uint8_t>& ba) {
+void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba) {
for (uint8_t value : ba)
dst += value;
}
diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index a8729b6..0795ff2 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -47,16 +47,15 @@
return GetOnedCodaBarWriter()->SetWideNarrowRatio(ratio);
}
-bool CBC_Codabar::Encode(const CFX_WideStringC& contents) {
+bool CBC_Codabar::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_CODABAR;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString filtercontents =
- GetOnedCodaBarWriter()->FilterContents(contents);
- CFX_ByteString byteString = filtercontents.UTF8Encode();
+ WideString filtercontents = GetOnedCodaBarWriter()->FilterContents(contents);
+ ByteString byteString = filtercontents.UTF8Encode();
m_renderContents = filtercontents;
auto* pWriter = GetOnedCodaBarWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
@@ -64,16 +63,16 @@
if (!data)
return false;
- return pWriter->RenderResult(filtercontents.AsStringC(), data.get(),
+ return pWriter->RenderResult(filtercontents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
auto* pWriter = GetOnedCodaBarWriter();
- CFX_WideString renderCon =
- pWriter->encodedContents(m_renderContents.AsStringC());
- return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC());
+ WideString renderCon =
+ pWriter->encodedContents(m_renderContents.AsStringView());
+ return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView());
}
BC_TYPE CBC_Codabar::GetType() {
diff --git a/fxbarcode/cbc_codabar.h b/fxbarcode/cbc_codabar.h
index 092b840..827fc28 100644
--- a/fxbarcode/cbc_codabar.h
+++ b/fxbarcode/cbc_codabar.h
@@ -20,7 +20,7 @@
~CBC_Codabar() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -33,7 +33,7 @@
private:
CBC_OnedCodaBarWriter* GetOnedCodaBarWriter();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODABAR_H_
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index d802b28..7ba6235 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -35,7 +35,7 @@
return GetOnedCode128Writer()->SetTextLocation(location);
}
-bool CBC_Code128::Encode(const CFX_WideStringC& contents) {
+bool CBC_Code128::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
@@ -43,25 +43,25 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetOnedCode128Writer();
- CFX_WideString content(contents);
+ WideString content(contents);
if (contents.GetLength() % 2 && pWriter->GetType() == BC_CODE128_C)
content += '0';
- CFX_WideString encodeContents = pWriter->FilterContents(content.AsStringC());
+ WideString encodeContents = pWriter->FilterContents(content.AsStringView());
m_renderContents = encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Code128::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
return GetOnedCode128Writer()->RenderDeviceResult(
- device, matrix, m_renderContents.AsStringC());
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_Code128::GetType() {
diff --git a/fxbarcode/cbc_code128.h b/fxbarcode/cbc_code128.h
index 571ee7e..b057aff 100644
--- a/fxbarcode/cbc_code128.h
+++ b/fxbarcode/cbc_code128.h
@@ -20,7 +20,7 @@
~CBC_Code128() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -30,7 +30,7 @@
private:
CBC_OnedCode128Writer* GetOnedCode128Writer();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODE128_H_
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index a46af14..9715c25 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -31,7 +31,7 @@
CBC_Code39::~CBC_Code39() {}
-bool CBC_Code39::Encode(const CFX_WideStringC& contents) {
+bool CBC_Code39::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
@@ -39,25 +39,25 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetOnedCode39Writer();
- CFX_WideString filtercontents = pWriter->FilterContents(contents);
- CFX_WideString renderContents = pWriter->RenderTextContents(contents);
+ WideString filtercontents = pWriter->FilterContents(contents);
+ WideString renderContents = pWriter->RenderTextContents(contents);
m_renderContents = renderContents;
- CFX_ByteString byteString = filtercontents.UTF8Encode();
+ ByteString byteString = filtercontents.UTF8Encode();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(renderContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(renderContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
auto* pWriter = GetOnedCode39Writer();
- CFX_WideString renderCon;
- if (!pWriter->encodedContents(m_renderContents.AsStringC(), &renderCon))
+ WideString renderCon;
+ if (!pWriter->encodedContents(m_renderContents.AsStringView(), &renderCon))
return false;
- return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC());
+ return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView());
}
BC_TYPE CBC_Code39::GetType() {
diff --git a/fxbarcode/cbc_code39.h b/fxbarcode/cbc_code39.h
index 66974c0..937673c 100644
--- a/fxbarcode/cbc_code39.h
+++ b/fxbarcode/cbc_code39.h
@@ -21,7 +21,7 @@
~CBC_Code39() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -32,7 +32,7 @@
private:
CBC_OnedCode39Writer* GetOnedCode39Writer();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODE39_H_
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index f1a7b03..aab98da 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -26,7 +26,7 @@
virtual ~CBC_CodeBase();
virtual BC_TYPE GetType() = 0;
- virtual bool Encode(const CFX_WideStringC& contents) = 0;
+ virtual bool Encode(const WideStringView& contents) = 0;
virtual bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) = 0;
diff --git a/fxbarcode/cbc_datamatrix.cpp b/fxbarcode/cbc_datamatrix.cpp
index 91ed10e..c9e23fa 100644
--- a/fxbarcode/cbc_datamatrix.cpp
+++ b/fxbarcode/cbc_datamatrix.cpp
@@ -31,12 +31,12 @@
CBC_DataMatrix::~CBC_DataMatrix() {}
-bool CBC_DataMatrix::Encode(const CFX_WideStringC& contents) {
+bool CBC_DataMatrix::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetDataMatrixWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_datamatrix.h b/fxbarcode/cbc_datamatrix.h
index 9f6c914..3fe1c09 100644
--- a/fxbarcode/cbc_datamatrix.h
+++ b/fxbarcode/cbc_datamatrix.h
@@ -20,7 +20,7 @@
~CBC_DataMatrix() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp
index 3606527..1672532 100644
--- a/fxbarcode/cbc_ean13.cpp
+++ b/fxbarcode/cbc_ean13.cpp
@@ -31,15 +31,15 @@
CBC_EAN13::~CBC_EAN13() {}
-CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_EAN13::Preprocess(const WideStringView& contents) {
auto* pWriter = GetOnedEAN13Writer();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 12) {
for (int32_t i = 0; i < 12 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
@@ -50,29 +50,29 @@
return encodeContents;
}
-bool CBC_EAN13::Encode(const CFX_WideStringC& contents) {
+bool CBC_EAN13::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_EAN_13;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
auto* pWriter = GetOnedEAN13Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedEAN13Writer()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedEAN13Writer()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_EAN13::GetType() {
diff --git a/fxbarcode/cbc_ean13.h b/fxbarcode/cbc_ean13.h
index 8a62151..609f8b0 100644
--- a/fxbarcode/cbc_ean13.h
+++ b/fxbarcode/cbc_ean13.h
@@ -21,16 +21,16 @@
~CBC_EAN13() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedEAN13Writer* GetOnedEAN13Writer();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
+ WideString Preprocess(const WideStringView& contents);
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_EAN13_H_
diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp
index 7fbe07f..796f3a5 100644
--- a/fxbarcode/cbc_ean8.cpp
+++ b/fxbarcode/cbc_ean8.cpp
@@ -30,15 +30,15 @@
CBC_EAN8::~CBC_EAN8() {}
-CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_EAN8::Preprocess(const WideStringView& contents) {
auto* pWriter = GetOnedEAN8Writer();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 7) {
for (int32_t i = 0; i < 7 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
encodeContents += wchar_t(checksum - 0 + '0');
}
@@ -48,29 +48,29 @@
return encodeContents;
}
-bool CBC_EAN8::Encode(const CFX_WideStringC& contents) {
+bool CBC_EAN8::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_EAN_8;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
auto* pWriter = GetOnedEAN8Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedEAN8Writer()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedEAN8Writer()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_EAN8::GetType() {
diff --git a/fxbarcode/cbc_ean8.h b/fxbarcode/cbc_ean8.h
index df0ca62..4127650 100644
--- a/fxbarcode/cbc_ean8.h
+++ b/fxbarcode/cbc_ean8.h
@@ -20,15 +20,15 @@
~CBC_EAN8() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedEAN8Writer* GetOnedEAN8Writer();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
+ WideString Preprocess(const WideStringView& contents);
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_EAN8_H_
diff --git a/fxbarcode/cbc_onecode.cpp b/fxbarcode/cbc_onecode.cpp
index 2d64704..fb8cb05 100644
--- a/fxbarcode/cbc_onecode.cpp
+++ b/fxbarcode/cbc_onecode.cpp
@@ -30,11 +30,11 @@
CBC_OneCode::~CBC_OneCode() {}
-bool CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OneCode::CheckContentValidity(const WideStringView& contents) {
return GetOneDimWriter()->CheckContentValidity(contents);
}
-CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) {
+WideString CBC_OneCode::FilterContents(const WideStringView& contents) {
return GetOneDimWriter()->FilterContents(contents);
}
diff --git a/fxbarcode/cbc_onecode.h b/fxbarcode/cbc_onecode.h
index e6b5b7b..eae618e 100644
--- a/fxbarcode/cbc_onecode.h
+++ b/fxbarcode/cbc_onecode.h
@@ -21,8 +21,8 @@
explicit CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter);
~CBC_OneCode() override;
- virtual bool CheckContentValidity(const CFX_WideStringC& contents);
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
+ virtual bool CheckContentValidity(const WideStringView& contents);
+ virtual WideString FilterContents(const WideStringView& contents);
virtual void SetPrintChecksum(bool checksum);
virtual void SetDataLength(int32_t length);
diff --git a/fxbarcode/cbc_pdf417i.cpp b/fxbarcode/cbc_pdf417i.cpp
index 545a7d8..4e7e063 100644
--- a/fxbarcode/cbc_pdf417i.cpp
+++ b/fxbarcode/cbc_pdf417i.cpp
@@ -40,12 +40,12 @@
GetPDF417Writer()->SetTruncated(truncated);
}
-bool CBC_PDF417I::Encode(const CFX_WideStringC& contents) {
+bool CBC_PDF417I::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetPDF417Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_pdf417i.h b/fxbarcode/cbc_pdf417i.h
index 73f99d3..5bd7a26 100644
--- a/fxbarcode/cbc_pdf417i.h
+++ b/fxbarcode/cbc_pdf417i.h
@@ -20,7 +20,7 @@
~CBC_PDF417I() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_qrcode.cpp b/fxbarcode/cbc_qrcode.cpp
index 297ce77..0f3a65e 100644
--- a/fxbarcode/cbc_qrcode.cpp
+++ b/fxbarcode/cbc_qrcode.cpp
@@ -37,13 +37,13 @@
return GetQRCodeWriter()->SetErrorCorrectionLevel(level);
}
-bool CBC_QRCode::Encode(const CFX_WideStringC& contents) {
+bool CBC_QRCode::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
CBC_QRCodeWriter* pWriter = GetQRCodeWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents),
- pWriter->GetErrorCorrectionLevel(), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), pWriter->GetErrorCorrectionLevel(),
+ outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_qrcode.h b/fxbarcode/cbc_qrcode.h
index 6387267..509de8a 100644
--- a/fxbarcode/cbc_qrcode.h
+++ b/fxbarcode/cbc_qrcode.h
@@ -20,7 +20,7 @@
~CBC_QRCode() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp
index f4c273f..69cedce 100644
--- a/fxbarcode/cbc_upca.cpp
+++ b/fxbarcode/cbc_upca.cpp
@@ -30,15 +30,15 @@
CBC_UPCA::~CBC_UPCA() {}
-CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_UPCA::Preprocess(const WideStringView& contents) {
CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 11) {
for (int32_t i = 0; i < 11 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
@@ -49,15 +49,15 @@
return encodeContents;
}
-bool CBC_UPCA::Encode(const CFX_WideStringC& contents) {
+bool CBC_UPCA::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_UPC_A;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter();
@@ -66,14 +66,14 @@
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedUPCAWriter()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedUPCAWriter()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_UPCA::GetType() {
diff --git a/fxbarcode/cbc_upca.h b/fxbarcode/cbc_upca.h
index 5955230..29c4d7d 100644
--- a/fxbarcode/cbc_upca.h
+++ b/fxbarcode/cbc_upca.h
@@ -20,15 +20,15 @@
~CBC_UPCA() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedUPCAWriter* GetOnedUPCAWriter();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
+ WideString Preprocess(const WideStringView& contents);
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_UPCA_H_
diff --git a/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
index 0cbd3fd..b7dd69c 100644
--- a/fxbarcode/datamatrix/BC_Base256Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
@@ -34,7 +34,7 @@
return BASE256_ENCODATION;
}
void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
buffer += L'\0';
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 8a55c92..348315e 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -31,7 +31,7 @@
namespace {
-CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
+WideString EncodeToCodewords(const WideString& sb, int32_t startPos) {
wchar_t c1 = sb[startPos];
wchar_t c2 = sb[startPos + 1];
wchar_t c3 = sb[startPos + 2];
@@ -39,7 +39,7 @@
wchar_t cw[2];
cw[0] = static_cast<wchar_t>(v / 256);
cw[1] = static_cast<wchar_t>(v % 256);
- return CFX_WideString(cw, FX_ArraySize(cw));
+ return WideString(cw, FX_ArraySize(cw));
}
} // namespace
@@ -50,7 +50,7 @@
return C40_ENCODATION;
}
void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
context.m_pos++;
@@ -98,12 +98,12 @@
handleEOD(context, buffer, e);
}
void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer) {
+ WideString& buffer) {
context.writeCodewords(EncodeToCodewords(buffer, 0));
buffer.Delete(0, 3);
}
void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) {
int32_t unwritten = (buffer.GetLength() / 3) * 2;
int32_t rest = buffer.GetLength() % 3;
@@ -142,7 +142,7 @@
}
context.signalEncoderChange(ASCII_ENCODATION);
}
-int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_C40Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == ' ') {
sb += (wchar_t)'\3';
return 1;
@@ -187,7 +187,7 @@
}
int32_t CBC_C40Encoder::BacktrackOneCharacter(CBC_EncoderContext* context,
- CFX_WideString* buffer,
+ WideString* buffer,
int32_t lastCharSize) {
if (context->m_pos < 1)
return -1;
@@ -200,7 +200,7 @@
context->m_pos--;
wchar_t c = context->getCurrentChar();
int32_t e = BCExceptionNO;
- CFX_WideString removed;
+ WideString removed;
int32_t len = encodeChar(c, removed, e);
if (e != BCExceptionNO)
return -1;
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.h b/fxbarcode/datamatrix/BC_C40Encoder.h
index 550d226..5ddad92 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.h
+++ b/fxbarcode/datamatrix/BC_C40Encoder.h
@@ -7,10 +7,9 @@
#ifndef FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
#define FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
+#include "core/fxcrt/widestring.h"
#include "fxbarcode/datamatrix/BC_Encoder.h"
-class CFX_WideString;
-
class CBC_C40Encoder : public CBC_Encoder {
public:
CBC_C40Encoder();
@@ -20,13 +19,12 @@
int32_t getEncodingMode() override;
void Encode(CBC_EncoderContext& context, int32_t& e) override;
- static void writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer);
+ static void writeNextTriplet(CBC_EncoderContext& context, WideString& buffer);
virtual void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e);
- virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e);
+ virtual int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e);
private:
// Moves back by 1 position in |context| and adjusts |buffer| accordingly
@@ -34,7 +32,7 @@
// |context| after adjusting the position. If the character cannot be encoded,
// return -1.
int32_t BacktrackOneCharacter(CBC_EncoderContext* context,
- CFX_WideString* buffer,
+ WideString* buffer,
int32_t lastCharSize);
};
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 98af282..d4f9ad3 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -108,15 +108,15 @@
return true;
}
-uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
+uint8_t* CBC_DataMatrixWriter::Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight) {
if (outWidth < 0 || outHeight < 0)
return nullptr;
- CFX_WideString ecLevel;
+ WideString ecLevel;
int32_t e = BCExceptionNO;
- CFX_WideString encoded =
+ WideString encoded =
CBC_HighLevelEncoder::encodeHighLevel(contents, ecLevel, false, e);
if (e != BCExceptionNO)
return nullptr;
@@ -124,7 +124,7 @@
CBC_SymbolInfo::lookup(encoded.GetLength(), false, e);
if (e != BCExceptionNO)
return nullptr;
- CFX_WideString codewords =
+ WideString codewords =
CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e);
if (e != BCExceptionNO)
return nullptr;
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/fxbarcode/datamatrix/BC_DataMatrixWriter.h
index 84b83fe..ba2c547 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.h
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.h
@@ -18,7 +18,7 @@
CBC_DataMatrixWriter();
~CBC_DataMatrixWriter() override;
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
index 934d795..3f1b358 100644
--- a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
+++ b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
@@ -23,7 +23,7 @@
#include "fxbarcode/datamatrix/BC_DefaultPlacement.h"
#include "fxbarcode/datamatrix/BC_Encoder.h"
-CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords,
+CBC_DefaultPlacement::CBC_DefaultPlacement(WideString codewords,
int32_t numcols,
int32_t numrows) {
m_codewords = codewords;
diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.h b/fxbarcode/datamatrix/BC_DefaultPlacement.h
index 17ecac9..12ea852 100644
--- a/fxbarcode/datamatrix/BC_DefaultPlacement.h
+++ b/fxbarcode/datamatrix/BC_DefaultPlacement.h
@@ -13,9 +13,7 @@
class CBC_DefaultPlacement {
public:
- CBC_DefaultPlacement(CFX_WideString codewords,
- int32_t numcols,
- int32_t numrows);
+ CBC_DefaultPlacement(WideString codewords, int32_t numcols, int32_t numrows);
virtual ~CBC_DefaultPlacement();
int32_t getNumrows();
@@ -27,7 +25,7 @@
void place();
private:
- CFX_WideString m_codewords;
+ WideString m_codewords;
int32_t m_numrows;
int32_t m_numcols;
std::vector<uint8_t> m_bits;
diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
index 7407efb..438c87a 100644
--- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -33,10 +33,10 @@
namespace {
-CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
+WideString EncodeToCodewords(const WideString& sb, int32_t startPos) {
int32_t len = sb.GetLength() - startPos;
if (len == 0)
- return CFX_WideString();
+ return WideString();
wchar_t c1 = sb[startPos];
wchar_t c2 = len >= 2 ? sb[startPos + 1] : 0;
@@ -48,10 +48,10 @@
cw[0] = static_cast<wchar_t>((v >> 16) & 255);
cw[1] = static_cast<wchar_t>((v >> 8) & 255);
cw[2] = static_cast<wchar_t>(v & 255);
- return CFX_WideString(cw, std::min(len, kBuflen));
+ return WideString(cw, std::min(len, kBuflen));
}
-bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) {
+bool HandleEOD(CBC_EncoderContext* context, const WideString& buffer) {
int32_t count = buffer.GetLength();
if (count == 0)
return true;
@@ -72,7 +72,7 @@
}
int32_t restChars = count - 1;
- CFX_WideString encoded = EncodeToCodewords(buffer, 0);
+ WideString encoded = EncodeToCodewords(buffer, 0);
if (encoded.IsEmpty())
return false;
@@ -105,7 +105,7 @@
return true;
}
-void encodeChar(wchar_t c, CFX_WideString* sb, int32_t& e) {
+void encodeChar(wchar_t c, WideString* sb, int32_t& e) {
if (c >= ' ' && c <= '?') {
*sb += c;
} else if (c >= '@' && c <= '^') {
@@ -126,7 +126,7 @@
}
void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
encodeChar(c, &buffer, e);
@@ -136,7 +136,7 @@
context.m_pos++;
int32_t count = buffer.GetLength();
if (count >= 4) {
- CFX_WideString encoded = EncodeToCodewords(buffer, 0);
+ WideString encoded = EncodeToCodewords(buffer, 0);
if (encoded.IsEmpty()) {
e = BCExceptionGeneric;
return;
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp
index eaf3768..6e16710 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -28,12 +28,12 @@
#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
#include "fxbarcode/utils.h"
-CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString& msg,
- const CFX_WideString& ecLevel,
+CBC_EncoderContext::CBC_EncoderContext(const WideString& msg,
+ const WideString& ecLevel,
int32_t& e) {
- CFX_ByteString dststr;
+ ByteString dststr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
- CFX_WideString sb;
+ WideString sb;
FX_STRSIZE c = dststr.GetLength();
for (FX_STRSIZE i = 0; i < c; i++) {
wchar_t ch = static_cast<wchar_t>(dststr[i] & 0xff);
@@ -66,7 +66,7 @@
return m_msg[m_pos];
}
-void CBC_EncoderContext::writeCodewords(const CFX_WideString& codewords) {
+void CBC_EncoderContext::writeCodewords(const WideString& codewords) {
m_codewords += codewords;
}
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h
index ef4c38e..1289a45 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.h
+++ b/fxbarcode/datamatrix/BC_EncoderContext.h
@@ -8,14 +8,14 @@
#define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
#include "core/fxcrt/cfx_unowned_ptr.h"
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
class CBC_SymbolInfo;
class CBC_EncoderContext {
public:
- CBC_EncoderContext(const CFX_WideString& msg,
- const CFX_WideString& ecLevel,
+ CBC_EncoderContext(const WideString& msg,
+ const WideString& ecLevel,
int32_t& e);
~CBC_EncoderContext();
@@ -23,7 +23,7 @@
void setSkipAtEnd(int32_t count);
wchar_t getCurrentChar();
wchar_t getCurrent();
- void writeCodewords(const CFX_WideString& codewords);
+ void writeCodewords(const WideString& codewords);
void writeCodeword(wchar_t codeword);
FX_STRSIZE getCodewordCount();
void signalEncoderChange(int32_t encoding);
@@ -34,8 +34,8 @@
void updateSymbolInfo(int32_t len, int32_t& e);
void resetSymbolInfo();
- CFX_WideString m_msg;
- CFX_WideString m_codewords;
+ WideString m_msg;
+ WideString m_codewords;
FX_STRSIZE m_pos;
int32_t m_newEncoding;
CFX_UnownedPtr<CBC_SymbolInfo> m_symbolInfo;
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index c45eadc..35077ee 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -119,22 +119,21 @@
void CBC_ErrorCorrection::Finalize() {}
CBC_ErrorCorrection::CBC_ErrorCorrection() {}
CBC_ErrorCorrection::~CBC_ErrorCorrection() {}
-CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e) {
+WideString CBC_ErrorCorrection::encodeECC200(WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e) {
if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) !=
symbolInfo->dataCapacity()) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
- CFX_WideString sb;
+ WideString sb;
sb += codewords;
int32_t blockCount = symbolInfo->getInterleavedBlockCount();
if (blockCount == 1) {
- CFX_WideString ecc =
- createECCBlock(codewords, symbolInfo->errorCodewords(), e);
+ WideString ecc = createECCBlock(codewords, symbolInfo->errorCodewords(), e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
sb += ecc;
} else {
std::vector<int32_t> dataSizes(blockCount);
@@ -149,13 +148,13 @@
}
}
for (int32_t block = 0; block < blockCount; block++) {
- CFX_WideString temp;
+ WideString temp;
for (int32_t d = block; d < symbolInfo->dataCapacity(); d += blockCount) {
temp += (wchar_t)codewords[d];
}
- CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
+ WideString ecc = createECCBlock(temp, errorSizes[block], e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
int32_t pos = 0;
for (int32_t l = block; l < errorSizes[block] * blockCount;
l += blockCount) {
@@ -165,16 +164,16 @@
}
return sb;
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t numECWords,
+ int32_t& e) {
return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e) {
static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
size_t table = 0;
while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
@@ -182,7 +181,7 @@
if (table >= kFactorTableNum) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
uint16_t* ecc = FX_Alloc(uint16_t, numECWords);
memset(ecc, 0, numECWords * sizeof(uint16_t));
@@ -202,7 +201,7 @@
ecc[0] = 0;
}
}
- CFX_WideString strecc;
+ WideString strecc;
for (int32_t j = 0; j < numECWords; j++) {
strecc += (wchar_t)ecc[numECWords - j - 1];
}
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.h b/fxbarcode/datamatrix/BC_ErrorCorrection.h
index 97a2e48..361b205 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.h
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.h
@@ -7,7 +7,7 @@
#ifndef FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
#define FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
class CBC_SymbolInfo;
@@ -18,9 +18,9 @@
static void Initialize();
static void Finalize();
- static CFX_WideString encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e);
+ static WideString encodeECC200(WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e);
private:
static int32_t MODULO_VALUE;
@@ -28,14 +28,14 @@
static int32_t ALOG[256];
private:
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e);
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e);
+ static WideString createECCBlock(WideString codewords,
+ int32_t numECWords,
+ int32_t& e);
+ static WideString createECCBlock(WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e);
};
#endif // FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index b8c6394..56a8847 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -58,22 +58,21 @@
CBC_HighLevelEncoder::CBC_HighLevelEncoder() {}
CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {}
-std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
- CFX_WideString msg) {
- CFX_ByteString bytestr;
+std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(WideString msg) {
+ ByteString bytestr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
m_bytearray.insert(m_bytearray.end(), bytestr.begin(), bytestr.end());
return m_bytearray;
}
// static
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- bool allowRectangular,
- int32_t& e) {
+WideString CBC_HighLevelEncoder::encodeHighLevel(WideString msg,
+ WideString ecLevel,
+ bool allowRectangular,
+ int32_t& e) {
CBC_EncoderContext context(msg, ecLevel, e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
context.setAllowRectangular(allowRectangular);
if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Last() == MACRO_TRAILER)) {
@@ -117,7 +116,7 @@
context.writeCodeword(0x00fe);
}
}
- CFX_WideString codewords = context.m_codewords;
+ WideString codewords = context.m_codewords;
if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) < capacity) {
codewords += PAD;
}
@@ -128,7 +127,7 @@
}
return codewords;
}
-int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
+int32_t CBC_HighLevelEncoder::lookAheadTest(WideString msg,
int32_t startpos,
int32_t currentMode) {
if (startpos >= pdfium::base::checked_cast<int32_t>(msg.GetLength())) {
@@ -279,7 +278,7 @@
bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) {
return ch >= 128 && ch <= 255;
}
-int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg,
+int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(WideString msg,
int32_t startpos) {
int32_t count = 0;
int32_t len = msg.GetLength();
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/fxbarcode/datamatrix/BC_HighLevelEncoder.h
index 0b7ff9b..50cfc8c 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.h
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.h
@@ -9,7 +9,7 @@
#include <vector>
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
#define ASCII_ENCODATION 0
#define C40_ENCODATION 1
@@ -23,18 +23,18 @@
CBC_HighLevelEncoder();
~CBC_HighLevelEncoder();
- std::vector<uint8_t>& getBytesForMessage(CFX_WideString msg);
+ std::vector<uint8_t>& getBytesForMessage(WideString msg);
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- bool allowRectangular,
- int32_t& e);
- static int32_t lookAheadTest(CFX_WideString msg,
+ static WideString encodeHighLevel(WideString msg,
+ WideString ecLevel,
+ bool allowRectangular,
+ int32_t& e);
+ static int32_t lookAheadTest(WideString msg,
int32_t startpos,
int32_t currentMode);
static bool isDigit(wchar_t ch);
static bool isExtendedASCII(wchar_t ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ static int32_t determineConsecutiveDigitCount(WideString msg,
int32_t startpos);
static const wchar_t LATCH_TO_C40;
diff --git a/fxbarcode/datamatrix/BC_TextEncoder.cpp b/fxbarcode/datamatrix/BC_TextEncoder.cpp
index 451c7b8..a78310e 100644
--- a/fxbarcode/datamatrix/BC_TextEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_TextEncoder.cpp
@@ -33,7 +33,7 @@
int32_t CBC_TextEncoder::getEncodingMode() {
return TEXT_ENCODATION;
}
-int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_TextEncoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == ' ') {
sb += (wchar_t)'\3';
return 1;
diff --git a/fxbarcode/datamatrix/BC_TextEncoder.h b/fxbarcode/datamatrix/BC_TextEncoder.h
index c4ba3c3..9d4cdaf 100644
--- a/fxbarcode/datamatrix/BC_TextEncoder.h
+++ b/fxbarcode/datamatrix/BC_TextEncoder.h
@@ -16,7 +16,7 @@
// CBC_C40Encoder
int32_t getEncodingMode() override;
- int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+ int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override;
};
#endif // FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
diff --git a/fxbarcode/datamatrix/BC_X12Encoder.cpp b/fxbarcode/datamatrix/BC_X12Encoder.cpp
index 625ff90..a080a71 100644
--- a/fxbarcode/datamatrix/BC_X12Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_X12Encoder.cpp
@@ -36,7 +36,7 @@
return X12_ENCODATION;
}
void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
context.m_pos++;
@@ -58,7 +58,7 @@
handleEOD(context, buffer, e);
}
void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) {
context.updateSymbolInfo(e);
if (e != BCExceptionNO) {
@@ -79,7 +79,7 @@
context.signalEncoderChange(ASCII_ENCODATION);
}
}
-int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_X12Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == '\r') {
sb += (wchar_t)'\0';
} else if (c == '*') {
diff --git a/fxbarcode/datamatrix/BC_X12Encoder.h b/fxbarcode/datamatrix/BC_X12Encoder.h
index 146f739..324b78b 100644
--- a/fxbarcode/datamatrix/BC_X12Encoder.h
+++ b/fxbarcode/datamatrix/BC_X12Encoder.h
@@ -18,9 +18,9 @@
int32_t getEncodingMode() override;
void Encode(CBC_EncoderContext& context, int32_t& e) override;
void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) override;
- int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+ int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override;
};
#endif // FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 1f96c45..e09e0ce 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -89,7 +89,7 @@
return ch;
}
-uint8_t* CBC_OneDimWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OneDimWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -98,7 +98,7 @@
return EncodeImpl(contents, outWidth);
}
-uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
+uint8_t* CBC_OneDimWriter::Encode(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight) {
@@ -127,7 +127,7 @@
return numAdded;
}
-void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
+void CBC_OneDimWriter::CalcTextInfo(const ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
float geWidth,
@@ -176,7 +176,7 @@
void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_ByteString str,
+ const ByteString str,
float geWidth,
FXTEXT_CHARPOS* pCharPos,
float locX,
@@ -201,7 +201,7 @@
m_fontColor, FXTEXT_CLEARTYPE);
}
-bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OneDimWriter::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -209,7 +209,7 @@
if (!device || !m_pFont)
return false;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
float charsLen = 0;
@@ -260,7 +260,7 @@
bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
if (m_output.empty())
return false;
@@ -283,7 +283,7 @@
ShowChars(contents, device, matrix, m_barWidth, m_multiple);
}
-bool CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OneDimWriter::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
if (codeLength < 1)
@@ -338,7 +338,7 @@
}
}
-CFX_WideString CBC_OneDimWriter::RenderTextContents(
- const CFX_WideStringC& contents) {
- return CFX_WideString();
+WideString CBC_OneDimWriter::RenderTextContents(
+ const WideStringView& contents) {
+ return WideString();
}
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 2d604b5..880f60f 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -24,12 +24,12 @@
CBC_OneDimWriter();
~CBC_OneDimWriter() override;
- virtual bool RenderResult(const CFX_WideStringC& contents,
+ virtual bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength);
- virtual bool CheckContentValidity(const CFX_WideStringC& contents) = 0;
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents) = 0;
- virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents);
+ virtual bool CheckContentValidity(const WideStringView& contents) = 0;
+ virtual WideString FilterContents(const WideStringView& contents) = 0;
+ virtual WideString RenderTextContents(const WideStringView& contents);
virtual void SetPrintChecksum(bool checksum);
virtual void SetDataLength(int32_t length);
virtual void SetCalcChecksum(bool state);
@@ -37,37 +37,37 @@
virtual void SetFontStyle(int32_t style);
virtual void SetFontColor(FX_ARGB color);
- uint8_t* Encode(const CFX_ByteString& contents,
+ uint8_t* Encode(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight);
bool RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_WideStringC& contents);
+ const WideStringView& contents);
bool SetFont(CFX_Font* cFont);
protected:
- virtual uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ virtual uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints);
- virtual uint8_t* EncodeImpl(const CFX_ByteString& contents,
+ virtual uint8_t* EncodeImpl(const ByteString& contents,
int32_t& outLength) = 0;
- virtual void CalcTextInfo(const CFX_ByteString& text,
+ virtual void CalcTextInfo(const ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
float geWidth,
int32_t fontSize,
float& charsLen);
- virtual bool ShowChars(const CFX_WideStringC& contents,
+ virtual bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple);
virtual void ShowDeviceChars(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_ByteString str,
+ const ByteString str,
float geWidth,
FXTEXT_CHARPOS* pCharPos,
float locX,
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 03a733a..4c5ad67 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -95,15 +95,15 @@
}
bool CBC_OnedCodaBarWriter::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
return std::all_of(
contents.begin(), contents.end(),
[this](const wchar_t& ch) { return this->FindChar(ch, false); });
}
-CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedCodaBarWriter::FilterContents(
+ const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE index = 0; index < contents.GetLength(); index++) {
ch = contents[index];
@@ -118,7 +118,7 @@
return filtercontents;
}
-uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -129,9 +129,9 @@
hints);
}
-uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
- CFX_ByteString data = m_chStart + contents + m_chEnd;
+ ByteString data = m_chStart + contents + m_chEnd;
m_iContentLen = data.GetLength();
uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength());
char ch;
@@ -188,16 +188,16 @@
return result;
}
-CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
- const CFX_WideStringC& contents) {
- CFX_WideString strStart(static_cast<wchar_t>(m_chStart));
- CFX_WideString strEnd(static_cast<wchar_t>(m_chEnd));
+WideString CBC_OnedCodaBarWriter::encodedContents(
+ const WideStringView& contents) {
+ WideString strStart(static_cast<wchar_t>(m_chStart));
+ WideString strEnd(static_cast<wchar_t>(m_chEnd));
return strStart + contents + strEnd;
}
-bool CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OnedCodaBarWriter::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
- return CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(),
- code, codeLength);
+ return CBC_OneDimWriter::RenderResult(
+ encodedContents(contents).AsStringView(), code, codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 6a5f315..ab354ef 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -18,18 +18,17 @@
~CBC_OnedCodaBarWriter() override;
// CBC_OneDimWriter
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- bool RenderResult(const CFX_WideStringC& contents,
+ bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
virtual bool SetStartChar(char start);
@@ -38,7 +37,7 @@
virtual bool SetWideNarrowRatio(int8_t ratio);
virtual bool FindChar(wchar_t ch, bool isContent);
- CFX_WideString encodedContents(const CFX_WideStringC& contents);
+ WideString encodedContents(const WideStringView& contents);
private:
char m_chStart;
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index 1e9f98b..61ec77b 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -84,7 +84,7 @@
CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {}
bool CBC_OnedCode128Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
for (const auto& ch : contents) {
int32_t patternIndex = static_cast<int32_t>(ch);
if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34)
@@ -93,9 +93,9 @@
return true;
}
-CFX_WideString CBC_OnedCode128Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filterChineseChar;
+WideString CBC_OnedCode128Writer::FilterContents(
+ const WideStringView& contents) {
+ WideString filterChineseChar;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch > 175) {
@@ -105,7 +105,7 @@
filterChineseChar += ch;
}
const wchar_t limit = m_codeFormat == BC_CODE128_B ? 126 : 106;
- CFX_WideString filtercontents;
+ WideString filtercontents;
for (const auto& ch : filterChineseChar) {
if (ch >= 32 && ch <= limit)
filtercontents += ch;
@@ -121,7 +121,7 @@
return true;
}
-uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -132,7 +132,7 @@
hints);
}
-uint8_t* CBC_OnedCode128Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode128Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() < 1 || contents.GetLength() > 80)
return nullptr;
@@ -168,7 +168,7 @@
}
// static
-int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString& contents,
+int32_t CBC_OnedCode128Writer::Encode128B(const ByteString& contents,
std::vector<int32_t>* patterns) {
int32_t checkWeight = 1;
patterns->push_back(CODE_START_B);
@@ -182,7 +182,7 @@
}
// static
-int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents,
+int32_t CBC_OnedCode128Writer::Encode128C(const ByteString& contents,
std::vector<int32_t>* patterns) {
int32_t checkWeight = 1;
patterns->push_back(CODE_START_C);
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h
index a80ac64..3edb65a 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -19,21 +19,20 @@
~CBC_OnedCode128Writer() override;
// Exposed for testing.
- static int32_t Encode128B(const CFX_ByteString& contents,
+ static int32_t Encode128B(const ByteString& contents,
std::vector<int32_t>* patterns);
- static int32_t Encode128C(const CFX_ByteString& contents,
+ static int32_t Encode128C(const ByteString& contents,
std::vector<int32_t>* patterns);
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
bool SetTextLocation(BC_TEXT_LOC location);
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 72d7dc4..2e02e01 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -48,7 +48,7 @@
CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {}
bool CBC_OnedCode39Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') ||
@@ -61,9 +61,9 @@
return true;
}
-CFX_WideString CBC_OnedCode39Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedCode39Writer::FilterContents(
+ const WideStringView& contents) {
+ WideString filtercontents;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
@@ -84,9 +84,9 @@
return filtercontents;
}
-CFX_WideString CBC_OnedCode39Writer::RenderTextContents(
- const CFX_WideStringC& contents) {
- CFX_WideString renderContents;
+WideString CBC_OnedCode39Writer::RenderTextContents(
+ const WideStringView& contents) {
+ WideString renderContents;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
@@ -120,7 +120,7 @@
return true;
}
-uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -137,7 +137,7 @@
}
}
-char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents) {
+char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) {
FX_STRSIZE length = contents.GetLength();
if (length > 80)
return '*';
@@ -160,7 +160,7 @@
return CHECKSUM_STRING[checksum];
}
-uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents,
int32_t& outlength) {
char checksum = CalcCheckSum(contents);
if (checksum == '*')
@@ -169,7 +169,7 @@
int8_t widths[9] = {0};
int32_t wideStrideNum = 3;
int32_t narrStrideNum = 9 - wideStrideNum;
- CFX_ByteString encodedContents = contents;
+ ByteString encodedContents = contents;
if (m_bCalcChecksum)
encodedContents += checksum;
m_iContentLen = encodedContents.GetLength();
@@ -227,12 +227,12 @@
return result.release();
}
-bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents,
- CFX_WideString* result) {
- *result = CFX_WideString(contents);
+bool CBC_OnedCode39Writer::encodedContents(const WideStringView& contents,
+ WideString* result) {
+ *result = WideString(contents);
if (m_bCalcChecksum && m_bPrintChecksum) {
- CFX_WideString checksumContent = FilterContents(contents);
- CFX_ByteString str = checksumContent.UTF8Encode();
+ WideString checksumContent = FilterContents(contents);
+ ByteString str = checksumContent.UTF8Encode();
char checksum;
checksum = CalcCheckSum(str);
if (checksum == '*')
@@ -243,12 +243,12 @@
return true;
}
-bool CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OnedCode39Writer::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
- CFX_WideString encodedCon;
+ WideString encodedCon;
if (!encodedContents(contents, &encodedCon))
return false;
- return CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code,
+ return CBC_OneDimWriter::RenderResult(encodedCon.AsStringView(), code,
codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index fe57d3c..ffed6d9 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -16,28 +16,27 @@
~CBC_OnedCode39Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool RenderResult(const CFX_WideStringC& contents,
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
- CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
+ WideString RenderTextContents(const WideStringView& contents) override;
virtual bool SetTextLocation(BC_TEXT_LOC loction);
virtual bool SetWideNarrowRatio(int8_t ratio);
- bool encodedContents(const CFX_WideStringC& contents, CFX_WideString* result);
+ bool encodedContents(const WideStringView& contents, WideString* result);
private:
void ToIntArray(int32_t a, int8_t* toReturn);
- char CalcCheckSum(const CFX_ByteString& contents);
+ char CalcCheckSum(const ByteString& contents);
int8_t m_iWideNarrRatio;
};
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 2d9759b..6de7c2c 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -56,14 +56,12 @@
}
CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {}
-bool CBC_OnedEAN13Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+bool CBC_OnedEAN13Writer::CheckContentValidity(const WideStringView& contents) {
return std::all_of(contents.begin(), contents.end(), std::iswdigit);
}
-CFX_WideString CBC_OnedEAN13Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -78,11 +76,11 @@
return filtercontents;
}
-int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedEAN13Writer::CalcChecksum(const ByteString& contents) {
return EANCalcChecksum(contents);
}
-uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -93,7 +91,7 @@
hints);
}
-uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() != 13)
return nullptr;
@@ -136,7 +134,7 @@
return result.release();
}
-bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedEAN13Writer::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -146,12 +144,12 @@
int32_t leftPadding = 7 * multiple;
int32_t leftPosition = 3 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- CFX_ByteString tempStr = str.Mid(1, 6);
+ ByteString tempStr = str.Mid(1, 6);
int32_t strWidth = multiple * 42;
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.h b/fxbarcode/oned/BC_OnedEAN13Writer.h
index 826d161..c874610 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -20,20 +20,19 @@
~CBC_OnedEAN13Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index d4d438f..f92a162 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -63,13 +63,12 @@
return false;
}
-bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OnedEAN8Writer::CheckContentValidity(const WideStringView& contents) {
return std::all_of(contents.begin(), contents.end(), std::iswdigit);
}
-CFX_WideString CBC_OnedEAN8Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -84,11 +83,11 @@
return filtercontents;
}
-int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const ByteString& contents) {
return EANCalcChecksum(contents);
}
-uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -99,7 +98,7 @@
hints);
}
-uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() != 8)
return nullptr;
@@ -136,7 +135,7 @@
return result.release();
}
-bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedEAN8Writer::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -145,10 +144,10 @@
return false;
int32_t leftPosition = 3 * multiple;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
FX_STRSIZE iLength = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLength);
- CFX_ByteString tempStr = str.Left(4);
+ ByteString tempStr = str.Left(4);
FX_STRSIZE iLen = tempStr.GetLength();
int32_t strWidth = 7 * multiple * 4;
float blank = 0.0;
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h
index 70c8fd4..77a3602 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -21,22 +21,21 @@
~CBC_OnedEAN8Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
bool SetTextLocation(BC_TEXT_LOC location);
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedEANChecksum.cpp b/fxbarcode/oned/BC_OnedEANChecksum.cpp
index 744a608..64aa1c5 100644
--- a/fxbarcode/oned/BC_OnedEANChecksum.cpp
+++ b/fxbarcode/oned/BC_OnedEANChecksum.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/fx_extension.h"
-int32_t EANCalcChecksum(const CFX_ByteString& contents) {
+int32_t EANCalcChecksum(const ByteString& contents) {
int32_t odd = 0;
int32_t even = 0;
FX_STRSIZE parity = 1;
diff --git a/fxbarcode/oned/BC_OnedEANChecksum.h b/fxbarcode/oned/BC_OnedEANChecksum.h
index 47d2d6b..5dd24bc 100644
--- a/fxbarcode/oned/BC_OnedEANChecksum.h
+++ b/fxbarcode/oned/BC_OnedEANChecksum.h
@@ -7,6 +7,6 @@
#include "core/fxcrt/fx_string.h"
-int32_t EANCalcChecksum(const CFX_ByteString& contents);
+int32_t EANCalcChecksum(const ByteString& contents);
#endif // FXBARCODE_ONED_BC_ONEDEANCHECKSUM_H_
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index fac4a1b..5185845 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -42,7 +42,7 @@
CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
-bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) {
for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) {
if (contents[i] < '0' || contents[i] > '9')
return false;
@@ -50,9 +50,8 @@
return true;
}
-CFX_WideString CBC_OnedUPCAWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -67,7 +66,7 @@
return filtercontents;
}
-int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedUPCAWriter::CalcChecksum(const ByteString& contents) {
int32_t odd = 0;
int32_t even = 0;
FX_STRSIZE j = 1;
@@ -84,7 +83,7 @@
return checksum;
}
-uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -92,18 +91,18 @@
if (format != BCFORMAT_UPC_A)
return nullptr;
- CFX_ByteString toEAN13String = '0' + contents;
+ ByteString toEAN13String = '0' + contents;
m_iDataLenth = 13;
return m_subWriter->EncodeWithHint(toEAN13String, BCFORMAT_EAN_13, outWidth,
outHeight, hints);
}
-uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
return nullptr;
}
-bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -113,10 +112,10 @@
int32_t leftPadding = 7 * multiple;
int32_t leftPosition = 10 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
- CFX_ByteString tempStr = str.Mid(1, 5);
+ ByteString tempStr = str.Mid(1, 5);
float strWidth = (float)35 * multiple;
float blank = 0.0;
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.h b/fxbarcode/oned/BC_OnedUPCAWriter.h
index 80f6196..a854ef4 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -24,21 +24,20 @@
~CBC_OnedUPCAWriter() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void Init();
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp
index 3f492f9..9b73b49 100644
--- a/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/fxbarcode/pdf417/BC_PDF417.cpp
@@ -399,7 +399,7 @@
return m_barcodeMatrix.get();
}
-bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
+bool CBC_PDF417::generateBarcodeLogic(WideString msg,
int32_t errorCorrectionLevel) {
int32_t errorCorrectionCodeWords =
CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
@@ -408,7 +408,7 @@
return false;
int32_t e = BCExceptionNO;
- CFX_WideString highLevel =
+ WideString highLevel =
CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
if (e != BCExceptionNO)
return false;
@@ -425,19 +425,19 @@
return false;
int32_t n = sourceCodeWords + pad + 1;
- CFX_WideString sb;
+ WideString sb;
sb += (wchar_t)n;
sb += highLevel;
for (int32_t i = 0; i < pad; i++)
sb += (wchar_t)900;
- CFX_WideString dataCodewords(sb);
- CFX_WideString ec;
+ WideString dataCodewords(sb);
+ WideString ec;
if (!CBC_PDF417ErrorCorrection::generateErrorCorrection(
dataCodewords, errorCorrectionLevel, &ec)) {
return false;
}
- CFX_WideString fullCodewords = dataCodewords + ec;
+ WideString fullCodewords = dataCodewords + ec;
m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols);
encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel,
m_barcodeMatrix.get());
@@ -498,7 +498,7 @@
logic->addBar(last, width);
}
-void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
+void CBC_PDF417::encodeLowLevel(WideString fullCodewords,
int32_t c,
int32_t r,
int32_t errorCorrectionLevel,
diff --git a/fxbarcode/pdf417/BC_PDF417.h b/fxbarcode/pdf417/BC_PDF417.h
index e6140a8..6014df0 100644
--- a/fxbarcode/pdf417/BC_PDF417.h
+++ b/fxbarcode/pdf417/BC_PDF417.h
@@ -23,7 +23,7 @@
virtual ~CBC_PDF417();
CBC_BarcodeMatrix* getBarcodeMatrix();
- bool generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel);
+ bool generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel);
void setDimensions(int32_t maxCols,
int32_t minCols,
int32_t maxRows,
@@ -45,7 +45,7 @@
int32_t c,
int32_t r);
static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
- void encodeLowLevel(CFX_WideString fullCodewords,
+ void encodeLowLevel(WideString fullCodewords,
int32_t c,
int32_t r,
int32_t errorCorrectionLevel,
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
index 1d8258e..ade3eb5 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
@@ -132,9 +132,9 @@
}
bool CBC_PDF417ErrorCorrection::generateErrorCorrection(
- const CFX_WideString& dataCodewords,
+ const WideString& dataCodewords,
int32_t errorCorrectionLevel,
- CFX_WideString* result) {
+ WideString* result) {
assert(result);
assert(result->IsEmpty());
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
index 3a84ef5..3e28162 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
@@ -17,9 +17,9 @@
virtual ~CBC_PDF417ErrorCorrection();
static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel);
- static bool generateErrorCorrection(const CFX_WideString& dataCodewords,
+ static bool generateErrorCorrection(const WideString& dataCodewords,
int32_t errorCorrectionLevel,
- CFX_WideString* result);
+ WideString* result);
};
#endif // FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index c531716..1450b37 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -55,24 +55,23 @@
void CBC_PDF417HighLevelEncoder::Finalize() {}
-CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
- CFX_WideString wideMsg,
- Compaction compaction,
- int32_t& e) {
- CFX_ByteString bytes;
+WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(WideString wideMsg,
+ Compaction compaction,
+ int32_t& e) {
+ ByteString bytes;
CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes);
- CFX_WideString msg;
+ WideString msg;
int32_t len = bytes.GetLength();
for (int32_t i = 0; i < len; i++) {
wchar_t ch = (wchar_t)(bytes[i] & 0xff);
if (ch == '?' && bytes[i] != '?') {
e = BCExceptionCharactersOutsideISO88591Encoding;
- return CFX_WideString();
+ return WideString();
}
msg += ch;
}
std::vector<uint8_t> byteArr(bytes.begin(), bytes.end());
- CFX_WideString sb;
+ WideString sb;
len = msg.GetLength();
int32_t p = 0;
int32_t textSubMode = SUBMODE_ALPHA;
@@ -145,12 +144,12 @@
}
}
-int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
+int32_t CBC_PDF417HighLevelEncoder::encodeText(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb,
+ WideString& sb,
int32_t initialSubmode) {
- CFX_WideString tmp;
+ WideString tmp;
int32_t submode = initialSubmode;
int32_t idx = 0;
while (true) {
@@ -262,7 +261,7 @@
int32_t startpos,
int32_t count,
int32_t startmode,
- CFX_WideString& sb) {
+ WideString& sb) {
if (count == 1 && startmode == TEXT_COMPACTION) {
sb += (wchar_t)SHIFT_TO_BYTE;
}
@@ -295,16 +294,16 @@
sb += (wchar_t)ch;
}
}
-void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg,
+void CBC_PDF417HighLevelEncoder::encodeNumeric(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb) {
+ WideString& sb) {
int32_t idx = 0;
BigInteger num900 = 900;
while (idx < count) {
- CFX_WideString tmp;
+ WideString tmp;
int32_t len = 44 < count - idx ? 44 : count - idx;
- CFX_ByteString part =
+ ByteString part =
((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
BigInteger bigint = stringToBigInteger(part.c_str());
do {
@@ -337,7 +336,7 @@
return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126);
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(
- CFX_WideString msg,
+ WideString msg,
int32_t startpos) {
int32_t count = 0;
int32_t len = msg.GetLength();
@@ -355,7 +354,7 @@
return count;
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
- CFX_WideString msg,
+ WideString msg,
int32_t startpos) {
int32_t len = msg.GetLength();
int32_t idx = startpos;
@@ -384,7 +383,7 @@
return idx - startpos;
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
- CFX_WideString msg,
+ WideString msg,
std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t& e) {
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 32482dc..2701c81 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -14,9 +14,9 @@
class CBC_PDF417HighLevelEncoder {
public:
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- Compaction compaction,
- int32_t& e);
+ static WideString encodeHighLevel(WideString msg,
+ Compaction compaction,
+ int32_t& e);
static void Inverse();
static void Initialize();
static void Finalize();
@@ -35,31 +35,31 @@
static uint8_t TEXT_PUNCTUATION_RAW[];
static int32_t MIXED[128];
static int32_t PUNCTUATION[128];
- static int32_t encodeText(CFX_WideString msg,
+ static int32_t encodeText(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb,
+ WideString& sb,
int32_t initialSubmode);
static void encodeBinary(std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
- CFX_WideString& sb);
- static void encodeNumeric(CFX_WideString msg,
+ WideString& sb);
+ static void encodeNumeric(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb);
+ WideString& sb);
static bool isDigit(wchar_t ch);
static bool isAlphaUpper(wchar_t ch);
static bool isAlphaLower(wchar_t ch);
static bool isMixed(wchar_t ch);
static bool isPunctuation(wchar_t ch);
static bool isText(wchar_t ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ static int32_t determineConsecutiveDigitCount(WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveTextCount(CFX_WideString msg,
+ static int32_t determineConsecutiveTextCount(WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveBinaryCount(CFX_WideString msg,
+ static int32_t determineConsecutiveBinaryCount(WideString msg,
std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t& e);
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index 1431174..ad4a59a 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -47,8 +47,8 @@
for (size_t j = 0; j < input_length; ++j) {
input_array[j] = ptr->input[j];
}
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
+ WideString expected(ptr->expected, ptr->expected_length);
+ WideString result;
CBC_PDF417HighLevelEncoder::encodeBinary(
&input_array, ptr->offset, ptr->count, ptr->startmode, result);
EXPECT_EQ(expected, result) << " for case number " << i;
@@ -109,9 +109,9 @@
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) {
EncodeNumericCase* ptr = &encode_numeric_cases[i];
- CFX_WideString input(ptr->input);
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
+ WideString input(ptr->input);
+ WideString expected(ptr->expected, ptr->expected_length);
+ WideString result;
CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count,
result);
EXPECT_EQ(expected, result) << " for case number " << i;
@@ -156,7 +156,7 @@
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) {
ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i];
- CFX_WideString input(ptr->input);
+ WideString input(ptr->input);
int actual_count =
CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input,
ptr->offset);
@@ -217,7 +217,7 @@
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) {
ConsecutiveTextCase* ptr = &consecutive_text_cases[i];
- CFX_WideString input(ptr->input);
+ WideString input(ptr->input);
int actual_count =
CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input,
ptr->offset);
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 2f6fc9e..4fec974 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -48,7 +48,7 @@
m_bTruncated = truncated;
}
-uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
+uint8_t* CBC_PDF417Writer::Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight) {
CBC_PDF417 encoder;
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.h b/fxbarcode/pdf417/BC_PDF417Writer.h
index 3941871..ef59616 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.h
+++ b/fxbarcode/pdf417/BC_PDF417Writer.h
@@ -18,7 +18,7 @@
CBC_PDF417Writer();
~CBC_PDF417Writer() override;
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index c679e9f..eb35af3 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -55,7 +55,7 @@
return true;
}
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
+uint8_t* CBC_QRCodeWriter::Encode(const WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
int32_t& outHeight) {
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.h b/fxbarcode/qrcode/BC_QRCodeWriter.h
index 1a0502d..3b3efc9 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.h
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.h
@@ -17,7 +17,7 @@
static void ReleaseAll();
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 4c48841..e1a4917 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -41,7 +41,7 @@
#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
#include "third_party/base/ptr_util.h"
-using ModeStringPair = std::pair<CBC_QRCoderMode*, CFX_ByteString>;
+using ModeStringPair = std::pair<CBC_QRCoderMode*, ByteString>;
namespace {
@@ -61,7 +61,7 @@
return g_alphaNumericTable[code_index];
}
-void AppendNumericBytes(const CFX_ByteString& content,
+void AppendNumericBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -84,7 +84,7 @@
}
}
-void AppendAlphaNumericBytes(const CFX_ByteString& content,
+void AppendAlphaNumericBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -110,7 +110,7 @@
}
}
-void AppendGBKBytes(const CFX_ByteString& content,
+void AppendGBKBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -130,15 +130,15 @@
}
}
-void Append8BitBytes(const CFX_ByteString& content,
+void Append8BitBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
+ ByteString encoding,
int32_t& e) {
for (FX_STRSIZE i = 0; i < content.GetLength(); i++)
bits->AppendBits(content[i], 8);
}
-void AppendKanjiBytes(const CFX_ByteString& content,
+void AppendKanjiBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
std::vector<uint8_t> bytes;
@@ -184,10 +184,10 @@
return true;
}
-void AppendBytes(const CFX_ByteString& content,
+void AppendBytes(const ByteString& content,
CBC_QRCoderMode* mode,
CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
+ ByteString encoding,
int32_t& e) {
if (mode == CBC_QRCoderMode::sNUMERIC)
AppendNumericBytes(content, bits, e);
@@ -423,7 +423,7 @@
MergeString(result, versionNum, e);
}
-void SplitString(const CFX_ByteString& content,
+void SplitString(const ByteString& content,
std::vector<ModeStringPair>* result) {
FX_STRSIZE index = 0;
while (index < content.GetLength()) {
@@ -484,8 +484,7 @@
SplitString(content.Right(content.GetLength() - index), result);
}
-CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
- CFX_ByteString encoding) {
+CBC_QRCoderMode* ChooseMode(const ByteString& content, ByteString encoding) {
if (encoding.Compare("SHIFT_JIS") == 0)
return CBC_QRCoderMode::sKANJI;
@@ -566,11 +565,11 @@
CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {}
// static
-bool CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
+bool CBC_QRCoderEncoder::Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode) {
- CFX_ByteString encoding = "utf8";
- CFX_ByteString utf8Data;
+ ByteString encoding = "utf8";
+ ByteString utf8Data;
CBC_UtilCodingConvert::UnicodeToUTF8(content, utf8Data);
CBC_QRCoderMode* mode = ChooseMode(utf8Data, encoding);
CBC_QRCoderBitVector dataBits;
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.h b/fxbarcode/qrcode/BC_QRCoderEncoder.h
index 6bba889..3acbd1b 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.h
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -20,7 +20,7 @@
CBC_QRCoderEncoder();
~CBC_QRCoderEncoder();
- static bool Encode(const CFX_WideString& content,
+ static bool Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode);
};
diff --git a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
index e153c64..ff7563c 100644
--- a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
+++ b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
@@ -25,7 +25,7 @@
int32_t Ordinal() const { return m_ordinal; }
int32_t GetBits() const { return m_bits; }
- CFX_ByteString GetName() const { return m_name; }
+ ByteString GetName() const { return m_name; }
private:
CBC_QRCoderErrorCorrectionLevel(int32_t ordinal,
@@ -35,7 +35,7 @@
int32_t m_ordinal;
int32_t m_bits;
- CFX_ByteString m_name;
+ ByteString m_name;
};
#endif // FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
diff --git a/fxbarcode/qrcode/BC_QRCoderMode.cpp b/fxbarcode/qrcode/BC_QRCoderMode.cpp
index 5f9ce5b..0f8c227 100644
--- a/fxbarcode/qrcode/BC_QRCoderMode.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderMode.cpp
@@ -39,7 +39,7 @@
CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits,
int32_t bits,
- CFX_ByteString name)
+ ByteString name)
: m_characterCountBitsForVersions(std::move(charCountBits)),
m_bits(bits),
m_name(name) {}
@@ -107,7 +107,7 @@
return m_bits;
}
-CFX_ByteString CBC_QRCoderMode::GetName() const {
+ByteString CBC_QRCoderMode::GetName() const {
return m_name;
}
diff --git a/fxbarcode/qrcode/BC_QRCoderMode.h b/fxbarcode/qrcode/BC_QRCoderMode.h
index 6669cbf..9f2844d 100644
--- a/fxbarcode/qrcode/BC_QRCoderMode.h
+++ b/fxbarcode/qrcode/BC_QRCoderMode.h
@@ -24,7 +24,7 @@
int32_t GetCharacterCountBits(int32_t number, int32_t& e) const;
int32_t GetBits() const;
- CFX_ByteString GetName() const;
+ ByteString GetName() const;
static CBC_QRCoderMode* sBYTE;
static CBC_QRCoderMode* sNUMERIC;
@@ -41,11 +41,11 @@
CBC_QRCoderMode();
CBC_QRCoderMode(std::vector<int32_t> charCountBits,
int32_t bits,
- CFX_ByteString name);
+ ByteString name);
std::vector<int32_t> m_characterCountBitsForVersions;
const int32_t m_bits;
- const CFX_ByteString m_name;
+ const ByteString m_name;
};
#endif // FXBARCODE_QRCODE_BC_QRCODERMODE_H_
diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h
index df7d1f0..7d5bc0a 100644
--- a/fxbarcode/utils.h
+++ b/fxbarcode/utils.h
@@ -11,14 +11,13 @@
#include "core/fxcrt/fx_string.h"
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+bool BC_FX_ByteString_Replace(ByteString& dst,
uint32_t first,
uint32_t last,
int32_t count,
char c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const std::vector<uint8_t>& ba);
+void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c);
+void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba);
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
#include <limits>
diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp
index 363f39c..f390cef 100644
--- a/fxjs/cfxjse_arguments.cpp
+++ b/fxjs/cfxjse_arguments.cpp
@@ -39,10 +39,10 @@
return static_cast<float>((*m_pInfo)[index]->NumberValue());
}
-CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
+ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString();
v8::String::Utf8Value szStringVal(hString);
- return CFX_ByteString(*szStringVal);
+ return ByteString(*szStringVal);
}
CFXJSE_HostObject* CFXJSE_Arguments::GetObject(int32_t index,
diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h
index 9317d70..0553335 100644
--- a/fxjs/cfxjse_arguments.h
+++ b/fxjs/cfxjse_arguments.h
@@ -24,7 +24,7 @@
bool GetBoolean(int32_t index) const;
int32_t GetInt32(int32_t index) const;
float GetFloat(int32_t index) const;
- CFX_ByteString GetUTF8String(int32_t index) const;
+ ByteString GetUTF8String(int32_t index) const;
CFXJSE_HostObject* GetObject(int32_t index,
CFXJSE_Class* pClass = nullptr) const;
CFXJSE_Value* GetReturnValue() const;
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp
index 3dba0ab..8f4334f 100644
--- a/fxjs/cfxjse_class.cpp
+++ b/fxjs/cfxjse_class.cpp
@@ -24,7 +24,7 @@
if (!lpFunctionInfo)
return;
- CFX_ByteStringC szFunctionName(lpFunctionInfo->name);
+ ByteStringView szFunctionName(lpFunctionInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -42,7 +42,7 @@
if (!lpClassDefinition)
return;
- CFX_ByteStringC szFunctionName(lpClassDefinition->name);
+ ByteStringView szFunctionName(lpClassDefinition->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -60,7 +60,7 @@
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -77,7 +77,7 @@
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -108,7 +108,7 @@
return;
if (info.This() == info.Holder() && lpClass->name) {
- CFX_ByteString szStringVal;
+ ByteString szStringVal;
szStringVal.Format("[object %s]", lpClass->name);
info.GetReturnValue().Set(v8::String::NewFromUtf8(
info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString,
@@ -131,7 +131,7 @@
hCallBackInfo->GetInternalField(1).As<v8::String>();
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
- CFX_ByteStringC szFxPropName = *szPropName;
+ ByteStringView szFxPropName = *szPropName;
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -143,7 +143,7 @@
void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -179,7 +179,7 @@
void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -194,7 +194,7 @@
bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -205,7 +205,7 @@
bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -228,7 +228,7 @@
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
if (DynPropQueryAdapter(lpClass, lpThisValue.get(), szFxPropName)) {
@@ -248,7 +248,7 @@
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
info.GetReturnValue().Set(
@@ -262,7 +262,7 @@
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -279,7 +279,7 @@
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
diff --git a/fxjs/cfxjse_class.h b/fxjs/cfxjse_class.h
index c3a5c84..01becfc 100644
--- a/fxjs/cfxjse_class.h
+++ b/fxjs/cfxjse_class.h
@@ -32,7 +32,7 @@
v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; }
protected:
- CFX_ByteString m_szClassName;
+ ByteString m_szClassName;
CFX_UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_lpClassDefinition;
CFX_UnownedPtr<CFXJSE_Context> m_pContext;
v8::Global<v8::FunctionTemplate> m_hTemplate;
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 87ec30f..bef7597 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -213,7 +213,7 @@
}
CFXJSE_Class* CFXJSE_Context::GetClassByName(
- const CFX_ByteStringC& szName) const {
+ const ByteStringView& szName) const {
auto pClass =
std::find_if(m_rgClasses.begin(), m_rgClasses.end(),
[szName](const std::unique_ptr<CFXJSE_Class>& item) {
diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h
index c00b76b..8ed8760 100644
--- a/fxjs/cfxjse_context.h
+++ b/fxjs/cfxjse_context.h
@@ -31,7 +31,7 @@
v8::Local<v8::Context> GetContext();
std::unique_ptr<CFXJSE_Value> GetGlobalObject();
void AddClass(std::unique_ptr<CFXJSE_Class> pClass);
- CFXJSE_Class* GetClassByName(const CFX_ByteStringC& szName) const;
+ CFXJSE_Class* GetClassByName(const ByteStringView& szName) const;
void EnableCompatibleMode();
bool ExecuteScript(const char* szScript,
CFXJSE_Value* lpRetValue,
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index c2eaa40..93e568c 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -52,7 +52,7 @@
} // namespace
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) {
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
ASSERT(pIsolate);
@@ -126,7 +126,7 @@
m_hValue.Reset(m_pIsolate, pValue);
}
-bool CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -144,7 +144,7 @@
hPropValue);
}
-bool CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -187,7 +187,7 @@
return true;
}
-bool CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) {
+bool CFXJSE_Value::DeleteObjectProperty(const ByteStringView& szPropName) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
@@ -200,7 +200,7 @@
return true;
}
-bool CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
@@ -218,7 +218,7 @@
.FromMaybe(false));
}
-bool CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -463,13 +463,13 @@
return static_cast<int32_t>(hValue->NumberValue());
}
-CFX_ByteString CFXJSE_Value::ToString() const {
+ByteString CFXJSE_Value::ToString() const {
ASSERT(!m_hValue.IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
v8::Local<v8::String> hString = hValue->ToString();
v8::String::Utf8Value hStringVal(hString);
- return CFX_ByteString(*hStringVal);
+ return ByteString(*hStringVal);
}
void CFXJSE_Value::SetUndefined() {
@@ -502,7 +502,7 @@
m_hValue.Reset(m_pIsolate, hValue);
}
-void CFXJSE_Value::SetString(const CFX_ByteStringC& szString) {
+void CFXJSE_Value::SetString(const ByteStringView& szString) {
CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::String::NewFromUtf8(
m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()),
diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h
index 31b751d..f506857 100644
--- a/fxjs/cfxjse_value.h
+++ b/fxjs/cfxjse_value.h
@@ -38,9 +38,9 @@
float ToFloat() const;
double ToDouble() const;
int32_t ToInteger() const;
- CFX_ByteString ToString() const;
- CFX_WideString ToWideString() const {
- return CFX_WideString::FromUTF8(ToString().AsStringC());
+ ByteString ToString() const;
+ WideString ToWideString() const {
+ return WideString::FromUTF8(ToString().AsStringView());
}
CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const;
@@ -49,7 +49,7 @@
void SetBoolean(bool bBoolean);
void SetInteger(int32_t nInteger);
void SetDouble(double dDouble);
- void SetString(const CFX_ByteStringC& szString);
+ void SetString(const ByteStringView& szString);
void SetFloat(float fFloat);
void SetJSObject();
@@ -58,16 +58,16 @@
void SetArray(const std::vector<std::unique_ptr<CFXJSE_Value>>& values);
void SetDate(double dDouble);
- bool GetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
- bool SetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
bool SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
- bool DeleteObjectProperty(const CFX_ByteStringC& szPropName);
- bool HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool DeleteObjectProperty(const ByteStringView& szPropName);
+ bool HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter);
- bool SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis);
bool Call(CFXJSE_Value* lpReceiver,
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index 219ad51..4c63988 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -460,12 +460,12 @@
m_isolate->SetData(g_embedderDataSlot, nullptr);
}
-int CFXJS_Engine::Execute(const CFX_WideString& script, FXJSErr* pError) {
+int CFXJS_Engine::Execute(const WideString& script, FXJSErr* pError) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::TryCatch try_catch(m_isolate);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::Local<v8::Script> compiled_script;
- if (!v8::Script::Compile(context, NewString(script.AsStringC()))
+ if (!v8::Script::Compile(context, NewString(script.AsStringView()))
.ToLocal(&compiled_script)) {
v8::String::Utf8Value error(try_catch.Exception());
// TODO(tsepez): return error via pError->message.
@@ -527,8 +527,8 @@
return context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
}
-void CFXJS_Engine::Error(const CFX_WideString& message) {
- m_isolate->ThrowException(NewString(message.AsStringC()));
+void CFXJS_Engine::Error(const WideString& message) {
+ m_isolate->ThrowException(NewString(message.AsStringView()));
}
void CFXJS_Engine::SetObjectPrivate(v8::Local<v8::Object> pObj, void* p) {
@@ -555,28 +555,28 @@
v8::Local<v8::Value> CFXJS_Engine::GetObjectProperty(
v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName) {
+ const WideString& wsPropertyName) {
if (pObj.IsEmpty())
return v8::Local<v8::Value>();
v8::Local<v8::Value> val;
if (!pObj->Get(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()))
+ NewString(wsPropertyName.AsStringView()))
.ToLocal(&val))
return v8::Local<v8::Value>();
return val;
}
-std::vector<CFX_WideString> CFXJS_Engine::GetObjectPropertyNames(
+std::vector<WideString> CFXJS_Engine::GetObjectPropertyNames(
v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
v8::Local<v8::Array> val;
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
if (!pObj->GetPropertyNames(context).ToLocal(&val))
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
- std::vector<CFX_WideString> result;
+ std::vector<WideString> result;
for (uint32_t i = 0; i < val->Length(); ++i) {
result.push_back(ToWideString(val->Get(context, i).ToLocalChecked()));
}
@@ -585,12 +585,12 @@
}
void CFXJS_Engine::PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName,
+ const WideString& wsPropertyName,
v8::Local<v8::Value> pPut) {
if (pObj.IsEmpty())
return;
pObj->Set(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()), pPut)
+ NewString(wsPropertyName.AsStringView()), pPut)
.FromJust();
}
@@ -649,18 +649,18 @@
return v8::Boolean::New(m_isolate, b);
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_ByteStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const ByteStringView& str) {
v8::Isolate* pIsolate = m_isolate ? m_isolate : v8::Isolate::GetCurrent();
return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
v8::NewStringType::kNormal, str.GetLength())
.ToLocalChecked();
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_WideStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const WideStringView& str) {
// Conversion from pdfium's wchar_t wide-strings to v8's uint16_t
// wide-strings isn't handled by v8, so use UTF8 as a common
// intermediate format.
- return NewString(FX_UTF8Encode(str).AsStringC());
+ return NewString(FX_UTF8Encode(str).AsStringView());
}
v8::Local<v8::Value> CFXJS_Engine::NewNull() {
@@ -703,15 +703,15 @@
return maybe_number.ToLocalChecked()->Value();
}
-CFX_WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
+WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
if (pValue.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::MaybeLocal<v8::String> maybe_string = pValue->ToString(context);
if (maybe_string.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::String::Utf8Value s(maybe_string.ToLocalChecked());
- return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length()));
+ return WideString::FromUTF8(ByteStringView(*s, s.length()));
}
v8::Local<v8::Object> CFXJS_Engine::ToObject(v8::Local<v8::Value> pValue) {
@@ -728,11 +728,11 @@
return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
}
-void CFXJS_Engine::SetConstArray(const CFX_WideString& name,
+void CFXJS_Engine::SetConstArray(const WideString& name,
v8::Local<v8::Array> array) {
m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array);
}
-v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) {
+v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const WideString& name) {
return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]);
}
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index cdec942..457843f 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -174,7 +174,7 @@
void ReleaseEngine();
// Called after FXJS_InitializeEngine call made.
- int Execute(const CFX_WideString& script, FXJSErr* perror);
+ int Execute(const WideString& script, FXJSErr* perror);
v8::Local<v8::Context> NewLocalContext();
v8::Local<v8::Context> GetPersistentContext();
@@ -186,15 +186,15 @@
v8::Local<v8::Number> NewNumber(double number);
v8::Local<v8::Number> NewNumber(float number);
v8::Local<v8::Boolean> NewBoolean(bool b);
- v8::Local<v8::String> NewString(const CFX_ByteStringC& str);
- v8::Local<v8::String> NewString(const CFX_WideStringC& str);
+ v8::Local<v8::String> NewString(const ByteStringView& str);
+ v8::Local<v8::String> NewString(const WideStringView& str);
v8::Local<v8::Date> NewDate(double d);
v8::Local<v8::Object> NewFxDynamicObj(int nObjDefnID, bool bStatic = false);
int ToInt32(v8::Local<v8::Value> pValue);
bool ToBoolean(v8::Local<v8::Value> pValue);
double ToDouble(v8::Local<v8::Value> pValue);
- CFX_WideString ToWideString(v8::Local<v8::Value> pValue);
+ WideString ToWideString(v8::Local<v8::Value> pValue);
v8::Local<v8::Object> ToObject(v8::Local<v8::Value> pValue);
v8::Local<v8::Array> ToArray(v8::Local<v8::Value> pValue);
@@ -207,12 +207,11 @@
v8::Local<v8::Value> pValue);
// Objects.
- std::vector<CFX_WideString> GetObjectPropertyNames(
- v8::Local<v8::Object> pObj);
+ std::vector<WideString> GetObjectPropertyNames(v8::Local<v8::Object> pObj);
v8::Local<v8::Value> GetObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName);
+ const WideString& PropertyName);
void PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName,
+ const WideString& PropertyName,
v8::Local<v8::Value> pValue);
// Native object binding.
@@ -221,10 +220,10 @@
static void FreeObjectPrivate(void* p);
static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
- void SetConstArray(const CFX_WideString& name, v8::Local<v8::Array> array);
- v8::Local<v8::Array> GetConstArray(const CFX_WideString& name);
+ void SetConstArray(const WideString& name, v8::Local<v8::Array> array);
+ v8::Local<v8::Array> GetConstArray(const WideString& name);
- void Error(const CFX_WideString& message);
+ void Error(const WideString& message);
protected:
CFXJS_Engine();
@@ -235,7 +234,7 @@
v8::Isolate* m_isolate;
v8::Global<v8::Context> m_V8PersistentContext;
std::vector<v8::Global<v8::Object>*> m_StaticObjects;
- std::map<CFX_WideString, v8::Global<v8::Array>> m_ConstArrays;
+ std::map<WideString, v8::Global<v8::Array>> m_ConstArrays;
};
#endif // FXJS_FXJS_V8_H_
diff --git a/fxjs/fxjs_v8_embeddertest.cpp b/fxjs/fxjs_v8_embeddertest.cpp
index 5a8ee63..53fe8f2 100644
--- a/fxjs/fxjs_v8_embeddertest.cpp
+++ b/fxjs/fxjs_v8_embeddertest.cpp
@@ -19,7 +19,7 @@
class FXJSV8EmbedderTest : public JSEmbedderTest {
public:
- void ExecuteInCurrentContext(const CFX_WideString& script) {
+ void ExecuteInCurrentContext(const WideString& script) {
FXJSErr error;
int sts = engine()->Execute(script, &error);
EXPECT_EQ(0, sts);
@@ -37,7 +37,7 @@
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -52,13 +52,13 @@
engine2.InitializeEngine();
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript0));
+ ExecuteInCurrentContext(WideString(kScript0));
CheckAssignmentInCurrentContext(kExpected0);
{
v8::Local<v8::Context> context1 = engine1.NewLocalContext();
v8::Context::Scope context_scope1(context1);
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -67,7 +67,7 @@
{
v8::Local<v8::Context> context2 = engine2.NewLocalContext();
v8::Context::Scope context_scope2(context2);
- ExecuteInCurrentContext(CFX_WideString(kScript2));
+ ExecuteInCurrentContext(WideString(kScript2));
CheckAssignmentInCurrentContext(kExpected2);
}
diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h
index 8fc514b..4864813 100644
--- a/fxjs/fxjse.h
+++ b/fxjs/fxjse.h
@@ -31,16 +31,16 @@
};
typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn);
typedef bool (*FXJSE_PropDeleter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName);
+ const ByteStringView& szPropName);
enum FXJSE_ClassPropTypes {
FXJSE_ClassPropType_None,
@@ -79,6 +79,6 @@
v8::Isolate* FXJSE_Runtime_Create_Own();
void FXJSE_Runtime_Release(v8::Isolate* pIsolate);
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message);
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message);
#endif // FXJS_FXJSE_H_
diff --git a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
index e791102..3334e86 100644
--- a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
@@ -27,8 +27,8 @@
barcode.SetHeight(298);
barcode.SetWidth(418);
- CFX_WideStringC content(reinterpret_cast<const wchar_t*>(data),
- size / sizeof(wchar_t));
+ WideStringView content(reinterpret_cast<const wchar_t*>(data),
+ size / sizeof(wchar_t));
if (!barcode.Encode(content))
return 0;
diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc
index 36b2942..74745a2 100644
--- a/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -11,8 +11,8 @@
#include "core/fxcrt/fx_string.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CFX_WideString input = CFX_WideString::FromUTF8(
- CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
+ WideString input =
+ WideString::FromUTF8(ByteStringView(data, static_cast<FX_STRSIZE>(size)));
// If we convert the input into an empty string bail out.
if (input.GetLength() == 0)
diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
index de56106..438d102 100644
--- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc
+++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
@@ -16,8 +16,8 @@
return 0;
CFX_WideTextBuf js;
- CFX_WideString input =
- CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
- CXFA_FM2JSContext::Translate(input.AsStringC(), &js);
+ WideString input =
+ WideString::FromUTF8(ByteStringView(data, safe_size.ValueOrDie()));
+ CXFA_FM2JSContext::Translate(input.AsStringView(), &js);
return 0;
}
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 0ebb747..b32ec7d 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -105,8 +105,8 @@
}
std::string GetPlatformString(FPDF_WIDESTRING wstr) {
- CFX_WideString wide_string =
- CFX_WideString::FromUTF16LE(wstr, CFX_WideString::WStringLength(wstr));
+ WideString wide_string =
+ WideString::FromUTF16LE(wstr, WideString::WStringLength(wstr));
return std::string(wide_string.UTF8Encode().c_str());
}
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index a11806f..3aee49c 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -52,7 +52,7 @@
return true;
}
-bool XFAJSEmbedderTest::Execute(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::Execute(const ByteStringView& input) {
if (ExecuteHelper(input)) {
return true;
}
@@ -68,13 +68,13 @@
return false;
}
-bool XFAJSEmbedderTest::ExecuteSilenceFailure(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::ExecuteSilenceFailure(const ByteStringView& input) {
return ExecuteHelper(input);
}
-bool XFAJSEmbedderTest::ExecuteHelper(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::ExecuteHelper(const ByteStringView& input) {
value_ = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
return script_context_->RunScript(XFA_SCRIPTLANGTYPE_Formcalc,
- CFX_WideString::FromUTF8(input).AsStringC(),
+ WideString::FromUTF8(input).AsStringView(),
value_.get(), GetXFADocument()->GetRoot());
}
diff --git a/testing/xfa_js_embedder_test.h b/testing/xfa_js_embedder_test.h
index 1dc06f0..362db47 100644
--- a/testing/xfa_js_embedder_test.h
+++ b/testing/xfa_js_embedder_test.h
@@ -32,8 +32,8 @@
v8::Isolate* GetIsolate() const { return isolate_; }
CXFA_Document* GetXFADocument();
- bool Execute(const CFX_ByteStringC& input);
- bool ExecuteSilenceFailure(const CFX_ByteStringC& input);
+ bool Execute(const ByteStringView& input);
+ bool ExecuteSilenceFailure(const ByteStringView& input);
CFXJSE_Value* GetValue() const { return value_.get(); }
@@ -43,7 +43,7 @@
v8::Isolate* isolate_;
CXFA_ScriptContext* script_context_;
- bool ExecuteHelper(const CFX_ByteStringC& input);
+ bool ExecuteHelper(const ByteStringView& input);
};
#endif // TESTING_XFA_JS_EMBEDDER_TEST_H_
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 9fc7990..999380b 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -38,7 +38,7 @@
public:
InsertOperation(CFDE_TextEditEngine* engine,
size_t start_idx,
- const CFX_WideString& added_text)
+ const WideString& added_text)
: engine_(engine), start_idx_(start_idx), added_text_(added_text) {}
~InsertOperation() override {}
@@ -56,14 +56,14 @@
private:
CFX_UnownedPtr<CFDE_TextEditEngine> engine_;
size_t start_idx_;
- CFX_WideString added_text_;
+ WideString added_text_;
};
class DeleteOperation : public CFDE_TextEditEngine::Operation {
public:
DeleteOperation(CFDE_TextEditEngine* engine,
size_t start_idx,
- const CFX_WideString& removed_text)
+ const WideString& removed_text)
: engine_(engine), start_idx_(start_idx), removed_text_(removed_text) {}
~DeleteOperation() override {}
@@ -81,15 +81,15 @@
private:
CFX_UnownedPtr<CFDE_TextEditEngine> engine_;
size_t start_idx_;
- CFX_WideString removed_text_;
+ WideString removed_text_;
};
class ReplaceOperation : public CFDE_TextEditEngine::Operation {
public:
ReplaceOperation(CFDE_TextEditEngine* engine,
size_t start_idx,
- const CFX_WideString& removed_text,
- const CFX_WideString& added_text)
+ const WideString& removed_text,
+ const WideString& added_text)
: insert_op_(engine, start_idx, added_text),
delete_op_(engine, start_idx, removed_text) {}
@@ -195,7 +195,7 @@
}
void CFDE_TextEditEngine::AdjustGap(size_t idx, size_t length) {
- static const size_t char_size = sizeof(CFX_WideString::CharType);
+ static const size_t char_size = sizeof(WideString::CharType);
// Move the gap, if necessary.
if (idx < gap_position_) {
@@ -222,7 +222,7 @@
}
}
-size_t CFDE_TextEditEngine::CountCharsExceedingSize(const CFX_WideString& text,
+size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text,
size_t num_to_check) {
if (!limit_horizontal_area_ && !limit_vertical_area_)
return 0;
@@ -245,7 +245,7 @@
text_out->SetStyles(style);
size_t length = text.GetLength();
- CFX_WideStringC temp(text.c_str(), length);
+ WideStringView temp(text.c_str(), length);
float vertical_height = line_spacing_ * visible_line_count_;
size_t chars_exceeding_size = 0;
@@ -253,7 +253,7 @@
for (size_t i = 0; i < num_to_check; i++) {
// This does a lot of string copying ....
// TODO(dsinclair): make CalcLogicSize take a WideStringC instead.
- text_out->CalcLogicSize(CFX_WideString(temp), text_rect);
+ text_out->CalcLogicSize(WideString(temp), text_rect);
if (limit_horizontal_area_ && text_rect.width <= available_width_)
break;
@@ -269,7 +269,7 @@
}
void CFDE_TextEditEngine::Insert(size_t idx,
- const CFX_WideString& text,
+ const WideString& text,
RecordOperation add_operation) {
if (idx > text_length_)
idx = text_length_;
@@ -289,15 +289,15 @@
AdjustGap(idx, length);
if (validation_enabled_ || limit_horizontal_area_ || limit_vertical_area_) {
- CFX_WideString str;
+ WideString str;
if (gap_position_ > 0)
- str += CFX_WideStringC(content_.data(), gap_position_);
+ str += WideStringView(content_.data(), gap_position_);
str += text;
if (text_length_ - gap_position_ > 0) {
- str += CFX_WideStringC(content_.data() + gap_position_ + gap_size_,
- text_length_ - gap_position_);
+ str += WideStringView(content_.data() + gap_position_ + gap_size_,
+ text_length_ - gap_position_);
}
if (validation_enabled_ && delegate_ && !delegate_->OnValidate(str)) {
@@ -328,12 +328,12 @@
pdfium::MakeUnique<InsertOperation>(this, gap_position_, text));
}
- CFX_WideString previous_text;
+ WideString previous_text;
if (delegate_)
previous_text = GetText();
// Copy the new text into the gap.
- static const size_t char_size = sizeof(CFX_WideString::CharType);
+ static const size_t char_size = sizeof(WideString::CharType);
memcpy(content_.data() + gap_position_, text.c_str(), length * char_size);
gap_position_ += length;
gap_size_ -= length;
@@ -623,32 +623,32 @@
selection_.end_idx = end_idx;
}
-CFX_WideString CFDE_TextEditEngine::GetSelectedText() const {
+WideString CFDE_TextEditEngine::GetSelectedText() const {
if (!has_selection_)
return L"";
- CFX_WideString text;
+ WideString text;
if (selection_.start_idx < gap_position_) {
if (selection_.end_idx < gap_position_) {
- text += CFX_WideStringC(content_.data() + selection_.start_idx,
- selection_.end_idx - selection_.start_idx + 1);
+ text += WideStringView(content_.data() + selection_.start_idx,
+ selection_.end_idx - selection_.start_idx + 1);
return text;
}
- text += CFX_WideStringC(content_.data() + selection_.start_idx,
- gap_position_ - selection_.start_idx);
- text += CFX_WideStringC(
+ text += WideStringView(content_.data() + selection_.start_idx,
+ gap_position_ - selection_.start_idx);
+ text += WideStringView(
content_.data() + gap_position_ + gap_size_,
selection_.end_idx - (gap_position_ - selection_.start_idx) + 1);
return text;
}
- text += CFX_WideStringC(content_.data() + gap_size_ + selection_.start_idx,
- selection_.end_idx - selection_.start_idx + 1);
+ text += WideStringView(content_.data() + gap_size_ + selection_.start_idx,
+ selection_.end_idx - selection_.start_idx + 1);
return text;
}
-CFX_WideString CFDE_TextEditEngine::DeleteSelectedText(
+WideString CFDE_TextEditEngine::DeleteSelectedText(
RecordOperation add_operation) {
if (!has_selection_)
return L"";
@@ -657,24 +657,24 @@
selection_.end_idx - selection_.start_idx + 1, add_operation);
}
-CFX_WideString CFDE_TextEditEngine::Delete(size_t start_idx,
- size_t length,
- RecordOperation add_operation) {
+WideString CFDE_TextEditEngine::Delete(size_t start_idx,
+ size_t length,
+ RecordOperation add_operation) {
if (start_idx >= text_length_)
return L"";
length = std::min(length, text_length_ - start_idx);
AdjustGap(start_idx + length, 0);
- CFX_WideString ret;
- ret += CFX_WideStringC(content_.data() + start_idx, length);
+ WideString ret;
+ ret += WideStringView(content_.data() + start_idx, length);
if (add_operation == RecordOperation::kInsertRecord) {
AddOperationRecord(
pdfium::MakeUnique<DeleteOperation>(this, start_idx, ret));
}
- CFX_WideString previous_text = GetText();
+ WideString previous_text = GetText();
gap_position_ = start_idx;
gap_size_ += length;
@@ -688,23 +688,23 @@
return ret;
}
-void CFDE_TextEditEngine::ReplaceSelectedText(const CFX_WideString& rep) {
+void CFDE_TextEditEngine::ReplaceSelectedText(const WideString& rep) {
size_t start_idx = selection_.start_idx;
- CFX_WideString txt = DeleteSelectedText(RecordOperation::kSkipRecord);
+ WideString txt = DeleteSelectedText(RecordOperation::kSkipRecord);
Insert(gap_position_, rep, RecordOperation::kSkipRecord);
AddOperationRecord(
pdfium::MakeUnique<ReplaceOperation>(this, start_idx, txt, rep));
}
-CFX_WideString CFDE_TextEditEngine::GetText() const {
- CFX_WideString str;
+WideString CFDE_TextEditEngine::GetText() const {
+ WideString str;
if (gap_position_ > 0)
- str += CFX_WideStringC(content_.data(), gap_position_);
+ str += WideStringView(content_.data(), gap_position_);
if (text_length_ - gap_position_ > 0) {
- str += CFX_WideStringC(content_.data() + gap_position_ + gap_size_,
- text_length_ - gap_position_);
+ str += WideStringView(content_.data() + gap_position_ + gap_size_,
+ text_length_ - gap_position_);
}
return str;
}
diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h
index aa8a243..750b62a 100644
--- a/xfa/fde/cfde_texteditengine.h
+++ b/xfa/fde/cfde_texteditengine.h
@@ -66,9 +66,9 @@
virtual ~Delegate() = default;
virtual void NotifyTextFull() = 0;
virtual void OnCaretChanged() = 0;
- virtual void OnTextChanged(const CFX_WideString& prevText) = 0;
+ virtual void OnTextChanged(const WideString& prevText) = 0;
virtual void OnSelChanged() = 0;
- virtual bool OnValidate(const CFX_WideString& wsText) = 0;
+ virtual bool OnValidate(const WideString& wsText) = 0;
virtual void SetScrollOffset(float fScrollOffset) = 0;
};
@@ -84,13 +84,13 @@
void Clear();
void Insert(size_t idx,
- const CFX_WideString& text,
+ const WideString& text,
RecordOperation add_operation = RecordOperation::kInsertRecord);
- CFX_WideString Delete(
+ WideString Delete(
size_t start_idx,
size_t length,
RecordOperation add_operation = RecordOperation::kInsertRecord);
- CFX_WideString GetText() const;
+ WideString GetText() const;
size_t GetLength() const;
// Non-const so we can force a layout.
@@ -147,10 +147,10 @@
std::pair<size_t, size_t> GetSelection() const {
return {selection_.start_idx, selection_.end_idx};
}
- CFX_WideString GetSelectedText() const;
- CFX_WideString DeleteSelectedText(
+ WideString GetSelectedText() const;
+ WideString DeleteSelectedText(
RecordOperation add_operation = RecordOperation::kInsertRecord);
- void ReplaceSelectedText(const CFX_WideString& str);
+ void ReplaceSelectedText(const WideString& str);
void Layout();
@@ -183,8 +183,7 @@
void SetCombTextWidth();
void AdjustGap(size_t idx, size_t length);
void RebuildPieces();
- size_t CountCharsExceedingSize(const CFX_WideString& str,
- size_t num_to_check);
+ size_t CountCharsExceedingSize(const WideString& str, size_t num_to_check);
void AddOperationRecord(std::unique_ptr<Operation> op);
bool IsAlignedRight() const {
@@ -210,7 +209,7 @@
FX_ARGB font_color_;
float font_size_;
float line_spacing_;
- std::vector<CFX_WideString::CharType> content_;
+ std::vector<WideString::CharType> content_;
size_t text_length_;
size_t gap_position_;
size_t gap_size_;
diff --git a/xfa/fde/cfde_texteditengine_unittest.cpp b/xfa/fde/cfde_texteditengine_unittest.cpp
index 2084914..48ed647 100644
--- a/xfa/fde/cfde_texteditengine_unittest.cpp
+++ b/xfa/fde/cfde_texteditengine_unittest.cpp
@@ -20,9 +20,9 @@
void NotifyTextFull() override { text_is_full = true; }
void OnCaretChanged() override {}
- void OnTextChanged(const CFX_WideString& prevText) override {}
+ void OnTextChanged(const WideString& prevText) override {}
void OnSelChanged() override {}
- bool OnValidate(const CFX_WideString& wsText) override {
+ bool OnValidate(const WideString& wsText) override {
return !fail_validation;
}
void SetScrollOffset(float fScrollOffset) override {}
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 7ccc968..3cf4ed3 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -191,13 +191,13 @@
m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
}
-void CFDE_TextOut::CalcLogicSize(const CFX_WideString& str, CFX_SizeF& size) {
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF& size) {
CFX_RectF rtText(0.0f, 0.0f, size.width, size.height);
CalcLogicSize(str, rtText);
size = rtText.Size();
}
-void CFDE_TextOut::CalcLogicSize(const CFX_WideString& str, CFX_RectF& rect) {
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) {
if (str.IsEmpty()) {
rect.width = 0.0f;
rect.height = 0.0f;
@@ -278,7 +278,7 @@
}
void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device,
- const CFX_WideStringC& str,
+ const WideStringView& str,
const CFX_RectF& rect) {
ASSERT(m_pFont && m_fFontSize >= 1.0f);
@@ -292,7 +292,7 @@
m_ttoLines.clear();
m_wsText.clear();
- LoadText(CFX_WideString(str), rect);
+ LoadText(WideString(str), rect);
Reload(rect);
DoAlignment(rect);
@@ -321,7 +321,7 @@
device->RestoreState(false);
}
-void CFDE_TextOut::LoadText(const CFX_WideString& str, const CFX_RectF& rect) {
+void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) {
ASSERT(!str.IsEmpty());
m_wsText = str;
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 89c8eac..b936eb4 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -95,10 +95,10 @@
void SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
void SetLineBreakTolerance(float fTolerance);
- void CalcLogicSize(const CFX_WideString& str, CFX_SizeF& size);
- void CalcLogicSize(const CFX_WideString& str, CFX_RectF& rect);
+ void CalcLogicSize(const WideString& str, CFX_SizeF& size);
+ void CalcLogicSize(const WideString& str, CFX_RectF& rect);
void DrawLogicText(CFX_RenderDevice* device,
- const CFX_WideStringC& str,
+ const WideStringView& str,
const CFX_RectF& rect);
int32_t GetTotalLines() const { return m_iTotalLines; }
@@ -107,7 +107,7 @@
float& fStartPos,
float& fWidth,
float& fHeight);
- void LoadText(const CFX_WideString& str, const CFX_RectF& rect);
+ void LoadText(const WideString& str, const CFX_RectF& rect);
void Reload(const CFX_RectF& rect);
void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect);
@@ -131,7 +131,7 @@
std::vector<int32_t> m_CharWidths;
FX_ARGB m_TxtColor;
uint32_t m_dwTxtBkStyles;
- CFX_WideString m_wsText;
+ WideString m_wsText;
CFX_Matrix m_Matrix;
std::deque<CFDE_TTOLine> m_ttoLines;
int32_t m_iCurLine;
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp
index df95a35..87b0769 100644
--- a/xfa/fgas/crt/cfgas_formatstring.cpp
+++ b/xfa/fgas/crt/cfgas_formatstring.cpp
@@ -97,10 +97,10 @@
return iKeyValue;
}
-CFX_WideString GetLiteralText(const wchar_t* pStrPattern,
- int32_t* iPattern,
- int32_t iLenPattern) {
- CFX_WideString wsOutput;
+WideString GetLiteralText(const wchar_t* pStrPattern,
+ int32_t* iPattern,
+ int32_t iLenPattern) {
+ WideString wsOutput;
if (pStrPattern[*iPattern] != '\'')
return wsOutput;
@@ -135,9 +135,9 @@
return wsOutput;
}
-CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern,
- int32_t* iPattern) {
- CFX_WideString wsOutput;
+WideString GetLiteralTextReverse(const wchar_t* pStrPattern,
+ int32_t* iPattern) {
+ WideString wsOutput;
if (pStrPattern[*iPattern] != '\'')
return wsOutput;
@@ -173,8 +173,8 @@
return wsOutput;
}
-bool GetNumericDotIndex(const CFX_WideString& wsNum,
- const CFX_WideString& wsDotSymbol,
+bool GetNumericDotIndex(const WideString& wsNum,
+ const WideString& wsDotSymbol,
int32_t* iDotIndex) {
int32_t ccf = 0;
int32_t iLenf = wsNum.GetLength();
@@ -221,8 +221,8 @@
return true;
}
-bool ParseLocaleDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsDatePattern,
+bool ParseLocaleDate(const WideString& wsDate,
+ const WideString& wsDatePattern,
IFX_Locale* pLocale,
CFX_DateTime* datetime,
int32_t* cc) {
@@ -234,10 +234,10 @@
int32_t len = wsDate.GetLength();
const wchar_t* strf = wsDatePattern.c_str();
int32_t lenf = wsDatePattern.GetLength();
- CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
+ WideStringView wsDateSymbols(gs_wsDateSymbols);
while (*cc < len && ccf < lenf) {
if (strf[ccf] == '\'') {
- CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
+ WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
int32_t iLiteralLen = wsLiteral.GetLength();
if (*cc + iLiteralLen > len ||
wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) {
@@ -254,7 +254,7 @@
continue;
}
- CFX_WideString symbol;
+ WideString symbol;
symbol.Reserve(4);
symbol += strf[ccf++];
while (ccf < lenf && strf[ccf] == symbol[0])
@@ -273,7 +273,7 @@
return false;
} else if (symbol == L"MMM" || symbol == L"MMMM") {
for (uint16_t i = 0; i < 12; i++) {
- CFX_WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM");
+ WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM");
if (wsMonthName.IsEmpty())
continue;
if (!wcsncmp(wsMonthName.c_str(), str + *cc, wsMonthName.GetLength())) {
@@ -284,7 +284,7 @@
}
} else if (symbol == L"EEE" || symbol == L"EEEE") {
for (uint16_t i = 0; i < 7; i++) {
- CFX_WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE");
+ WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE");
if (wsDayName.IsEmpty())
continue;
if (!wcsncmp(wsDayName.c_str(), str + *cc, wsDayName.GetLength())) {
@@ -338,8 +338,8 @@
*wMinute = iMinuteDiff % 60;
}
-bool ParseLocaleTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsTimePattern,
+bool ParseLocaleTime(const WideString& wsTime,
+ const WideString& wsTimePattern,
IFX_Locale* pLocale,
CFX_DateTime* datetime,
int32_t* cc) {
@@ -354,10 +354,10 @@
int lenf = wsTimePattern.GetLength();
bool bHasA = false;
bool bPM = false;
- CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
+ WideStringView wsTimeSymbols(gs_wsTimeSymbols);
while (*cc < len && ccf < lenf) {
if (strf[ccf] == '\'') {
- CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
+ WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
int32_t iLiteralLen = wsLiteral.GetLength();
if (*cc + iLiteralLen > len ||
wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) {
@@ -375,7 +375,7 @@
continue;
}
- CFX_WideString symbol;
+ WideString symbol;
symbol.Reserve(4);
symbol += strf[ccf++];
while (ccf < lenf && strf[ccf] == symbol[0])
@@ -415,16 +415,16 @@
if (!ExtractCountDigits(str, len, 3, cc, &millisecond))
return false;
} else if (symbol == L"A") {
- CFX_WideString wsAM = pLocale->GetMeridiemName(true);
- CFX_WideString wsPM = pLocale->GetMeridiemName(false);
+ WideString wsAM = pLocale->GetMeridiemName(true);
+ WideString wsPM = pLocale->GetMeridiemName(false);
if ((*cc + pdfium::base::checked_cast<int32_t>(wsAM.GetLength()) <=
len) &&
- (CFX_WideStringC(str + *cc, wsAM.GetLength()) == wsAM)) {
+ (WideStringView(str + *cc, wsAM.GetLength()) == wsAM)) {
*cc += wsAM.GetLength();
bHasA = true;
} else if ((*cc + pdfium::base::checked_cast<int32_t>(wsPM.GetLength()) <=
len) &&
- (CFX_WideStringC(str + *cc, wsPM.GetLength()) == wsPM)) {
+ (WideStringView(str + *cc, wsPM.GetLength()) == wsPM)) {
*cc += wsPM.GetLength();
bHasA = true;
bPM = true;
@@ -433,7 +433,7 @@
if (*cc + 3 > len)
continue;
- CFX_WideString tz(str[(*cc)++]);
+ WideString tz(str[(*cc)++]);
tz += str[(*cc)++];
tz += str[(*cc)++];
if (tz == L"GMT") {
@@ -480,7 +480,7 @@
return !!(*cc);
}
-int32_t GetNumTrailingLimit(const CFX_WideString& wsFormat,
+int32_t GetNumTrailingLimit(const WideString& wsFormat,
int iDotPos,
bool* bTrimTailZeros) {
if (iDotPos < 0)
@@ -553,23 +553,23 @@
return week_index;
}
-CFX_WideString NumToString(size_t fmt_size, int32_t value) {
- CFX_WideString str;
+WideString NumToString(size_t fmt_size, int32_t value) {
+ WideString str;
str.Format(fmt_size == 1 ? L"%d" : fmt_size == 2 ? L"%02d" : L"%03d", value);
return str;
}
-CFX_WideString DateFormat(const CFX_WideString& wsDatePattern,
- IFX_Locale* pLocale,
- const CFX_DateTime& datetime) {
- CFX_WideString wsResult;
+WideString DateFormat(const WideString& wsDatePattern,
+ IFX_Locale* pLocale,
+ const CFX_DateTime& datetime) {
+ WideString wsResult;
int32_t year = datetime.GetYear();
uint8_t month = datetime.GetMonth();
uint8_t day = datetime.GetDay();
int32_t ccf = 0;
const wchar_t* strf = wsDatePattern.c_str();
int32_t lenf = wsDatePattern.GetLength();
- CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
+ WideStringView wsDateSymbols(gs_wsDateSymbols);
while (ccf < lenf) {
if (strf[ccf] == '\'') {
wsResult += GetLiteralText(strf, &ccf, lenf);
@@ -581,7 +581,7 @@
continue;
}
- CFX_WideString symbol;
+ WideString symbol;
symbol.Reserve(4);
symbol += strf[ccf++];
while (ccf < lenf && strf[ccf] == symbol[0])
@@ -621,10 +621,10 @@
return wsResult;
}
-CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern,
- IFX_Locale* pLocale,
- const CFX_DateTime& datetime) {
- CFX_WideString wsResult;
+WideString TimeFormat(const WideString& wsTimePattern,
+ IFX_Locale* pLocale,
+ const CFX_DateTime& datetime) {
+ WideString wsResult;
uint8_t hour = datetime.GetHour();
uint8_t minute = datetime.GetMinute();
uint8_t second = datetime.GetSecond();
@@ -639,7 +639,7 @@
bPM = true;
}
- CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
+ WideStringView wsTimeSymbols(gs_wsTimeSymbols);
while (ccf < lenf) {
if (strf[ccf] == '\'') {
wsResult += GetLiteralText(strf, &ccf, lenf);
@@ -651,7 +651,7 @@
continue;
}
- CFX_WideString symbol;
+ WideString symbol;
symbol.Reserve(4);
symbol += strf[ccf++];
while (ccf < lenf && strf[ccf] == symbol[0])
@@ -685,7 +685,7 @@
if (tz.tzHour != 0 || tz.tzMinute != 0) {
wsResult += tz.tzHour < 0 ? L"-" : L"+";
- CFX_WideString wsTimezone;
+ WideString wsTimezone;
wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute);
wsResult += wsTimezone;
}
@@ -694,16 +694,16 @@
return wsResult;
}
-CFX_WideString FormatDateTimeInternal(const CFX_DateTime& dt,
- const CFX_WideString& wsDatePattern,
- const CFX_WideString& wsTimePattern,
- bool bDateFirst,
- IFX_Locale* pLocale) {
- CFX_WideString wsDateOut;
+WideString FormatDateTimeInternal(const CFX_DateTime& dt,
+ const WideString& wsDatePattern,
+ const WideString& wsTimePattern,
+ bool bDateFirst,
+ IFX_Locale* pLocale) {
+ WideString wsDateOut;
if (!wsDatePattern.IsEmpty())
wsDateOut = DateFormat(wsDatePattern, pLocale, dt);
- CFX_WideString wsTimeOut;
+ WideString wsTimeOut;
if (!wsTimePattern.IsEmpty())
wsTimeOut = TimeFormat(wsTimePattern, pLocale, dt);
@@ -712,8 +712,7 @@
} // namespace
-bool FX_DateFromCanonical(const CFX_WideString& wsDate,
- CFX_DateTime* datetime) {
+bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime) {
const wchar_t* str = wsDate.c_str();
int len = wsDate.GetLength();
if (len > 10)
@@ -762,7 +761,7 @@
return true;
}
-bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
+bool FX_TimeFromCanonical(const WideStringView& wsTime,
CFX_DateTime* datetime,
IFX_Locale* pLocale) {
if (wsTime.GetLength() == 0)
@@ -840,8 +839,8 @@
CFGAS_FormatString::~CFGAS_FormatString() {}
void CFGAS_FormatString::SplitFormatString(
- const CFX_WideString& wsFormatString,
- std::vector<CFX_WideString>* wsPatterns) {
+ const WideString& wsFormatString,
+ std::vector<WideString>* wsPatterns) {
int32_t iStrLen = wsFormatString.GetLength();
const wchar_t* pStr = wsFormatString.c_str();
const wchar_t* pToken = pStr;
@@ -849,32 +848,31 @@
bool iQuote = false;
while (true) {
if (pStr >= pEnd) {
- wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken));
+ wsPatterns->push_back(WideString(pToken, pStr - pToken));
return;
}
if (*pStr == '\'') {
iQuote = !iQuote;
} else if (*pStr == L'|' && !iQuote) {
- wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken));
+ wsPatterns->push_back(WideString(pToken, pStr - pToken));
pToken = pStr + 1;
}
pStr++;
}
}
-FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(
- const CFX_WideString& wsPattern) {
+FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(const WideString& wsPattern) {
FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
int32_t ccf = 0;
int32_t iLenf = wsPattern.GetLength();
const wchar_t* pStr = wsPattern.c_str();
bool bBraceOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
+ WideStringView wsConstChars(gs_wsConstChars);
while (ccf < iLenf) {
if (pStr[ccf] == '\'') {
GetLiteralText(pStr, &ccf, iLenf);
} else if (!bBraceOpen && !wsConstChars.Contains(pStr[ccf])) {
- CFX_WideString wsCategory(pStr[ccf]);
+ WideString wsCategory(pStr[ccf]);
ccf++;
while (true) {
if (ccf == iLenf)
@@ -889,7 +887,7 @@
ccf++;
}
- uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false);
+ uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringView(), false);
if (dwHash == FX_LOCALECATEGORY_DateHash) {
if (eCategory == FX_LOCALECATEGORY_Time)
return FX_LOCALECATEGORY_DateTime;
@@ -917,22 +915,21 @@
return eCategory;
}
-CFX_WideString CFGAS_FormatString::GetTextFormat(
- const CFX_WideString& wsPattern,
- const CFX_WideStringC& wsCategory) {
+WideString CFGAS_FormatString::GetTextFormat(const WideString& wsPattern,
+ const WideStringView& wsCategory) {
int32_t ccf = 0;
int32_t iLenf = wsPattern.GetLength();
const wchar_t* pStr = wsPattern.c_str();
bool bBrackOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
- CFX_WideString wsPurgePattern;
+ WideStringView wsConstChars(gs_wsConstChars);
+ WideString wsPurgePattern;
while (ccf < iLenf) {
if (pStr[ccf] == '\'') {
int32_t iCurChar = ccf;
GetLiteralText(pStr, &ccf, iLenf);
- wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1);
} else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) {
- CFX_WideString wsSearchCategory(pStr[ccf]);
+ WideString wsSearchCategory(pStr[ccf]);
ccf++;
while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
pStr[ccf] != '(') {
@@ -965,11 +962,10 @@
return wsPurgePattern;
}
-IFX_Locale* CFGAS_FormatString::GetNumericFormat(
- const CFX_WideString& wsPattern,
- int32_t* iDotIndex,
- uint32_t* dwStyle,
- CFX_WideString* wsPurgePattern) {
+IFX_Locale* CFGAS_FormatString::GetNumericFormat(const WideString& wsPattern,
+ int32_t* iDotIndex,
+ uint32_t* dwStyle,
+ WideString* wsPurgePattern) {
*dwStyle = 0;
IFX_Locale* pLocale = nullptr;
int32_t ccf = 0;
@@ -977,14 +973,14 @@
const wchar_t* pStr = wsPattern.c_str();
bool bFindDot = false;
bool bBrackOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
+ WideStringView wsConstChars(gs_wsConstChars);
while (ccf < iLenf) {
if (pStr[ccf] == '\'') {
int32_t iCurChar = ccf;
GetLiteralText(pStr, &ccf, iLenf);
- *wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ *wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1);
} else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) {
- CFX_WideString wsCategory(pStr[ccf]);
+ WideString wsCategory(pStr[ccf]);
ccf++;
while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
pStr[ccf] != '(') {
@@ -999,7 +995,7 @@
while (ccf < iLenf) {
if (pStr[ccf] == '(') {
ccf++;
- CFX_WideString wsLCID;
+ WideString wsLCID;
while (ccf < iLenf && pStr[ccf] != ')')
wsLCID += pStr[ccf++];
@@ -1008,13 +1004,13 @@
bBrackOpen = true;
break;
} else if (pStr[ccf] == '.') {
- CFX_WideString wsSubCategory;
+ WideString wsSubCategory;
ccf++;
while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{')
wsSubCategory += pStr[ccf++];
uint32_t dwSubHash =
- FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
+ FX_HashCode_GetW(wsSubCategory.AsStringView(), false);
FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal;
for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) {
if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) {
@@ -1068,14 +1064,14 @@
return pLocale;
}
-bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsValue) {
+bool CFGAS_FormatString::ParseText(const WideString& wsSrcText,
+ const WideString& wsPattern,
+ WideString* wsValue) {
wsValue->clear();
if (wsSrcText.IsEmpty() || wsPattern.IsEmpty())
return false;
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text");
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"text");
if (wsTextFormat.IsEmpty())
return false;
@@ -1088,7 +1084,7 @@
while (iPattern < iLenPattern && iText < iLenText) {
switch (pStrPattern[iPattern]) {
case '\'': {
- CFX_WideString wsLiteral =
+ WideString wsLiteral =
GetLiteralText(pStrPattern, &iPattern, iLenPattern);
int32_t iLiteralLen = wsLiteral.GetLength();
if (iText + iLiteralLen > iLenText ||
@@ -1141,28 +1137,28 @@
return iPattern == iLenPattern && iText == iLenText;
}
-bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsValue) {
+bool CFGAS_FormatString::ParseNum(const WideString& wsSrcNum,
+ const WideString& wsPattern,
+ WideString* wsValue) {
wsValue->clear();
if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty())
return false;
int32_t dot_index_f = -1;
uint32_t dwFormatStyle = 0;
- CFX_WideString wsNumFormat;
+ WideString wsNumFormat;
IFX_Locale* pLocale =
GetNumericFormat(wsPattern, &dot_index_f, &dwFormatStyle, &wsNumFormat);
if (!pLocale || wsNumFormat.IsEmpty())
return false;
int32_t iExponent = 0;
- CFX_WideString wsDotSymbol =
+ WideString wsDotSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
- CFX_WideString wsGroupSymbol =
+ WideString wsGroupSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
int32_t iGroupLen = wsGroupSymbol.GetLength();
- CFX_WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus);
+ WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus);
int32_t iMinusLen = wsMinus.GetLength();
const wchar_t* str = wsSrcNum.c_str();
int len = wsSrcNum.GetLength();
@@ -1192,7 +1188,7 @@
while (ccf >= 0 && cc >= 0) {
switch (strf[ccf]) {
case '\'': {
- CFX_WideString wsLiteral = GetLiteralTextReverse(strf, &ccf);
+ WideString wsLiteral = GetLiteralTextReverse(strf, &ccf);
int32_t iLiteralLen = wsLiteral.GetLength();
cc -= iLiteralLen - 1;
if (cc < 0 || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen))
@@ -1265,7 +1261,7 @@
break;
}
case '$': {
- CFX_WideString wsSymbol =
+ WideString wsSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol);
int32_t iSymbolLen = wsSymbol.GetLength();
cc -= iSymbolLen - 1;
@@ -1307,7 +1303,7 @@
}
break;
case '%': {
- CFX_WideString wsSymbol =
+ WideString wsSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent);
int32_t iSysmbolLen = wsSymbol.GetLength();
cc -= iSysmbolLen - 1;
@@ -1371,7 +1367,7 @@
while (cc < len && ccf < lenf) {
switch (strf[ccf]) {
case '\'': {
- CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
+ WideString wsLiteral = GetLiteralText(strf, &ccf, lenf);
int32_t iLiteralLen = wsLiteral.GetLength();
if (cc + iLiteralLen > len ||
wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
@@ -1441,7 +1437,7 @@
break;
}
case '$': {
- CFX_WideString wsSymbol =
+ WideString wsSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol);
int32_t iSymbolLen = wsSymbol.GetLength();
if (cc + iSymbolLen > len ||
@@ -1483,7 +1479,7 @@
case 'v':
return false;
case '%': {
- CFX_WideString wsSymbol =
+ WideString wsSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent);
int32_t iSysmbolLen = wsSymbol.GetLength();
if (cc + iSysmbolLen <= len &&
@@ -1532,7 +1528,7 @@
return false;
}
if (iExponent || bHavePercentSymbol) {
- CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringC());
+ CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringView());
if (iExponent) {
decimal = decimal *
CFX_Decimal(FXSYS_pow(10, static_cast<float>(iExponent)), 3);
@@ -1549,27 +1545,27 @@
}
FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat(
- const CFX_WideString& wsPattern,
+ const WideString& wsPattern,
IFX_Locale** pLocale,
- CFX_WideString* wsDatePattern,
- CFX_WideString* wsTimePattern) {
+ WideString* wsDatePattern,
+ WideString* wsTimePattern) {
*pLocale = nullptr;
- CFX_WideString wsTempPattern;
+ WideString wsTempPattern;
FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
int32_t ccf = 0;
int32_t iLenf = wsPattern.GetLength();
const wchar_t* pStr = wsPattern.c_str();
int32_t iFindCategory = 0;
bool bBraceOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
+ WideStringView wsConstChars(gs_wsConstChars);
while (ccf < iLenf) {
if (pStr[ccf] == '\'') {
int32_t iCurChar = ccf;
GetLiteralText(pStr, &ccf, iLenf);
- wsTempPattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ wsTempPattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1);
} else if (!bBraceOpen && iFindCategory != 3 &&
!wsConstChars.Contains(pStr[ccf])) {
- CFX_WideString wsCategory(pStr[ccf]);
+ WideString wsCategory(pStr[ccf]);
ccf++;
while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
pStr[ccf] != '(') {
@@ -1602,7 +1598,7 @@
while (ccf < iLenf) {
if (pStr[ccf] == '(') {
ccf++;
- CFX_WideString wsLCID;
+ WideString wsLCID;
while (ccf < iLenf && pStr[ccf] != ')')
wsLCID += pStr[ccf++];
@@ -1611,13 +1607,13 @@
bBraceOpen = true;
break;
} else if (pStr[ccf] == '.') {
- CFX_WideString wsSubCategory;
+ WideString wsSubCategory;
ccf++;
while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{')
wsSubCategory += pStr[ccf++];
uint32_t dwSubHash =
- FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
+ FX_HashCode_GetW(wsSubCategory.AsStringView(), false);
FX_LOCALEDATETIMESUBCATEGORY eSubCategory =
FX_LOCALEDATETIMESUBCATEGORY_Medium;
for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) {
@@ -1685,16 +1681,16 @@
return (FX_DATETIMETYPE)iFindCategory;
}
-bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
+bool CFGAS_FormatString::ParseDateTime(const WideString& wsSrcDateTime,
+ const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
CFX_DateTime* dtValue) {
dtValue->Reset();
if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty())
return false;
- CFX_WideString wsDatePattern;
- CFX_WideString wsTimePattern;
+ WideString wsDatePattern;
+ WideString wsTimePattern;
IFX_Locale* pLocale = nullptr;
FX_DATETIMETYPE eCategory =
GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern);
@@ -1730,9 +1726,9 @@
return true;
}
-bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) {
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero");
+bool CFGAS_FormatString::ParseZero(const WideString& wsSrcText,
+ const WideString& wsPattern) {
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"zero");
int32_t iText = 0;
int32_t iPattern = 0;
@@ -1742,7 +1738,7 @@
int32_t iLenPattern = wsTextFormat.GetLength();
while (iPattern < iLenPattern && iText < iLenText) {
if (pStrPattern[iPattern] == '\'') {
- CFX_WideString wsLiteral =
+ WideString wsLiteral =
GetLiteralText(pStrPattern, &iPattern, iLenPattern);
int32_t iLiteralLen = wsLiteral.GetLength();
if (iText + iLiteralLen > iLenText ||
@@ -1762,9 +1758,9 @@
return iPattern == iLenPattern && iText == iLenText;
}
-bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) {
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null");
+bool CFGAS_FormatString::ParseNull(const WideString& wsSrcText,
+ const WideString& wsPattern) {
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"null");
int32_t iText = 0;
int32_t iPattern = 0;
@@ -1774,7 +1770,7 @@
int32_t iLenPattern = wsTextFormat.GetLength();
while (iPattern < iLenPattern && iText < iLenText) {
if (pStrPattern[iPattern] == '\'') {
- CFX_WideString wsLiteral =
+ WideString wsLiteral =
GetLiteralText(pStrPattern, &iPattern, iLenPattern);
int32_t iLiteralLen = wsLiteral.GetLength();
if (iText + iLiteralLen > iLenText ||
@@ -1794,9 +1790,9 @@
return iPattern == iLenPattern && iText == iLenText;
}
-bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput) {
+bool CFGAS_FormatString::FormatText(const WideString& wsSrcText,
+ const WideString& wsPattern,
+ WideString* wsOutput) {
if (wsPattern.IsEmpty())
return false;
@@ -1804,7 +1800,7 @@
if (iLenText == 0)
return false;
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text");
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"text");
int32_t iText = 0;
int32_t iPattern = 0;
@@ -1856,15 +1852,15 @@
return iText == iLenText;
}
-bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput) {
+bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum,
+ const WideString& wsPattern,
+ WideString* wsOutput) {
if (wsInputNum.IsEmpty() || wsPattern.IsEmpty())
return false;
int32_t dot_index_f = -1;
uint32_t dwNumStyle = 0;
- CFX_WideString wsNumFormat;
+ WideString wsNumFormat;
IFX_Locale* pLocale =
GetNumericFormat(wsPattern, &dot_index_f, &dwNumStyle, &wsNumFormat);
if (!pLocale || wsNumFormat.IsEmpty())
@@ -1873,12 +1869,12 @@
int32_t cc = 0, ccf = 0;
const wchar_t* strf = wsNumFormat.c_str();
int lenf = wsNumFormat.GetLength();
- CFX_WideString wsSrcNum(wsInputNum);
+ WideString wsSrcNum(wsInputNum);
wsSrcNum.TrimLeft('0');
if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.')
wsSrcNum.InsertAtFront('0');
- CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringC());
+ CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringView());
if (dwNumStyle & FX_NUMSTYLE_Percent) {
decimal = decimal * CFX_Decimal(100);
wsSrcNum = decimal;
@@ -1937,7 +1933,7 @@
wsSrcNum.TrimRight(L".");
}
- CFX_WideString wsGroupSymbol =
+ WideString wsGroupSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
bool bNeg = false;
if (wsSrcNum[0] == '-') {
@@ -2010,7 +2006,7 @@
ccf--;
break;
case 'E': {
- CFX_WideString wsExp;
+ WideString wsExp;
wsExp.Format(L"E%+d", exponent);
*wsOutput = wsExp + *wsOutput;
ccf--;
@@ -2114,7 +2110,7 @@
return true;
}
- CFX_WideString wsDotSymbol =
+ WideString wsDotSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
if (strf[dot_index_f] == 'V') {
*wsOutput += wsDotSymbol;
@@ -2168,7 +2164,7 @@
ccf++;
break;
case 'E': {
- CFX_WideString wsExp;
+ WideString wsExp;
wsExp.Format(L"E%+d", exponent);
*wsOutput += wsExp;
ccf++;
@@ -2247,23 +2243,23 @@
return true;
}
-bool CFGAS_FormatString::FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput) {
+bool CFGAS_FormatString::FormatNum(const WideString& wsSrcNum,
+ const WideString& wsPattern,
+ WideString* wsOutput) {
if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty())
return false;
- return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput);
+ return FormatStrNum(wsSrcNum.AsStringView(), wsPattern, wsOutput);
}
-bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
+bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime,
+ const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- CFX_WideString* wsOutput) {
+ WideString* wsOutput) {
if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty())
return false;
- CFX_WideString wsDatePattern;
- CFX_WideString wsTimePattern;
+ WideString wsDatePattern;
+ WideString wsTimePattern;
IFX_Locale* pLocale = nullptr;
FX_DATETIMETYPE eCategory =
GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern);
@@ -2290,15 +2286,15 @@
return true;
}
if (eCategory == FX_DATETIMETYPE_Time &&
- FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), &dt, pLocale)) {
+ FX_TimeFromCanonical(wsSrcDateTime.AsStringView(), &dt, pLocale)) {
*wsOutput = FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern, true,
pLocale);
return true;
}
} else {
- CFX_WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value());
- CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1,
- wsSrcDateTime.GetLength() - iT.value() - 1);
+ WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value());
+ WideStringView wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1,
+ wsSrcDateTime.GetLength() - iT.value() - 1);
if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty())
return false;
if (FX_DateFromCanonical(wsSrcDate, &dt) &&
@@ -2312,12 +2308,12 @@
return false;
}
-bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput) {
+bool CFGAS_FormatString::FormatZero(const WideString& wsPattern,
+ WideString* wsOutput) {
if (wsPattern.IsEmpty())
return false;
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero");
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"zero");
int32_t iPattern = 0;
const wchar_t* pStrPattern = wsTextFormat.c_str();
int32_t iLenPattern = wsTextFormat.GetLength();
@@ -2334,12 +2330,12 @@
return true;
}
-bool CFGAS_FormatString::FormatNull(const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput) {
+bool CFGAS_FormatString::FormatNull(const WideString& wsPattern,
+ WideString* wsOutput) {
if (wsPattern.IsEmpty())
return false;
- CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null");
+ WideString wsTextFormat = GetTextFormat(wsPattern, L"null");
int32_t iPattern = 0;
const wchar_t* pStrPattern = wsTextFormat.c_str();
int32_t iLenPattern = wsTextFormat.GetLength();
diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h
index c91f435..5eae25d 100644
--- a/xfa/fgas/crt/cfgas_formatstring.h
+++ b/xfa/fgas/crt/cfgas_formatstring.h
@@ -12,8 +12,8 @@
#include "core/fxcrt/ifx_locale.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
-bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime);
-bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
+bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime);
+bool FX_TimeFromCanonical(const WideStringView& wsTime,
CFX_DateTime* datetime,
IFX_Locale* pLocale);
@@ -22,52 +22,50 @@
explicit CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr);
~CFGAS_FormatString();
- void SplitFormatString(const CFX_WideString& wsFormatString,
- std::vector<CFX_WideString>* wsPatterns);
- FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
+ void SplitFormatString(const WideString& wsFormatString,
+ std::vector<WideString>* wsPatterns);
+ FX_LOCALECATEGORY GetCategory(const WideString& wsPattern);
- bool ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsValue);
- bool ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsValue);
- bool ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
+ bool ParseText(const WideString& wsSrcText,
+ const WideString& wsPattern,
+ WideString* wsValue);
+ bool ParseNum(const WideString& wsSrcNum,
+ const WideString& wsPattern,
+ WideString* wsValue);
+ bool ParseDateTime(const WideString& wsSrcDateTime,
+ const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
CFX_DateTime* dtValue);
- bool ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
- bool ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
+ bool ParseZero(const WideString& wsSrcText, const WideString& wsPattern);
+ bool ParseNull(const WideString& wsSrcText, const WideString& wsPattern);
- bool FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput);
- bool FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput);
- bool FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
+ bool FormatText(const WideString& wsSrcText,
+ const WideString& wsPattern,
+ WideString* wsOutput);
+ bool FormatNum(const WideString& wsSrcNum,
+ const WideString& wsPattern,
+ WideString* wsOutput);
+ bool FormatDateTime(const WideString& wsSrcDateTime,
+ const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- CFX_WideString* wsOutput);
- bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString* wsOutput);
- bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString* wsOutput);
+ WideString* wsOutput);
+ bool FormatZero(const WideString& wsPattern, WideString* wsOutput);
+ bool FormatNull(const WideString& wsPattern, WideString* wsOutput);
private:
- CFX_WideString GetTextFormat(const CFX_WideString& wsPattern,
- const CFX_WideStringC& wsCategory);
- IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern,
+ WideString GetTextFormat(const WideString& wsPattern,
+ const WideStringView& wsCategory);
+ IFX_Locale* GetNumericFormat(const WideString& wsPattern,
int32_t* iDotIndex,
uint32_t* dwStyle,
- CFX_WideString* wsPurgePattern);
- bool FormatStrNum(const CFX_WideStringC& wsInputNum,
- const CFX_WideString& wsPattern,
- CFX_WideString* wsOutput);
- FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern,
+ WideString* wsPurgePattern);
+ bool FormatStrNum(const WideStringView& wsInputNum,
+ const WideString& wsPattern,
+ WideString* wsOutput);
+ FX_DATETIMETYPE GetDateTimeFormat(const WideString& wsPattern,
IFX_Locale** pLocale,
- CFX_WideString* wsDatePattern,
- CFX_WideString* wsTimePattern);
+ WideString* wsDatePattern,
+ WideString* wsTimePattern);
CXFA_LocaleMgr* m_pLocaleMgr;
};
diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp
index 3adcedf..b3d42f6 100644
--- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp
+++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp
@@ -43,7 +43,7 @@
// Note, this re-creates the fmt on each call. If you need to multiple
// times store it locally.
- CFGAS_FormatString* fmt(const CFX_WideString& locale) {
+ CFGAS_FormatString* fmt(const WideString& locale) {
mgr_ = pdfium::MakeUnique<CXFA_LocaleMgr>(nullptr, locale);
fmt_ = pdfium::MakeUnique<CFGAS_FormatString>(mgr_.get());
return fmt_.get();
@@ -112,7 +112,7 @@
// of DDD, DDDD, MMM, MMMM, E, e, gg, YYY, YYYYY.
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->FormatDateTime(tests[i].input, tests[i].pattern,
FX_DATETIMETYPE_Date, &result));
@@ -161,7 +161,7 @@
SetTZ("UTC+2");
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->FormatDateTime(tests[i].input, tests[i].pattern,
FX_DATETIMETYPE_Time, &result));
@@ -191,7 +191,7 @@
L"At 10:30 GMT on Jul 16, 1999"}};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->FormatDateTime(tests[i].input, tests[i].pattern,
FX_DATETIMETYPE_TimeDate, &result));
@@ -288,7 +288,7 @@
// }
TEST_F(CFGAS_FormatStringTest, SplitFormatString) {
- std::vector<CFX_WideString> results;
+ std::vector<WideString> results;
fmt(L"en")->SplitFormatString(
L"null{'No data'} | null{} | text{999*9999} | text{999*999*9999}",
&results);
@@ -416,7 +416,7 @@
};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->ParseNum(tests[i].input, tests[i].pattern, &result))
<< " TEST: " << i;
@@ -512,7 +512,7 @@
};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->FormatNum(tests[i].input, tests[i].pattern, &result))
<< " TEST: " << i;
@@ -538,7 +538,7 @@
{L"en", L"A1C-1234-D text", L"000-9999-X 'text'", L"A1C1234D"}};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->ParseText(tests[i].input, tests[i].pattern, &result));
EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i;
@@ -547,7 +547,7 @@
TEST_F(CFGAS_FormatStringTest, InvalidTextParse) {
// Input does not match mask.
- CFX_WideString result;
+ WideString result;
EXPECT_FALSE(fmt(L"en")->ParseText(L"123-4567-8", L"AAA-9999-X", &result));
}
@@ -568,7 +568,7 @@
};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)
->FormatText(tests[i].input, tests[i].pattern, &result));
EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i;
@@ -599,7 +599,7 @@
} tests[] = {{L"en", L"null{'n/a'}", L"n/a"}, {L"en", L"null{}", L""}};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(fmt(tests[i].locale)->FormatNull(tests[i].pattern, &result));
EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i;
}
@@ -635,7 +635,7 @@
{L"en", L"0", L"zero{}", L""}};
for (size_t i = 0; i < FX_ArraySize(tests); ++i) {
- CFX_WideString result;
+ WideString result;
EXPECT_TRUE(
fmt(tests[i].locale)
->FormatZero(/* tests[i].input,*/ tests[i].pattern, &result));
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 9cb772e..f2405e9 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -172,14 +172,14 @@
uint32_t GetFontFamilyHash(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
- CFX_WideString wsFont(pszFontFamily);
+ WideString wsFont(pszFontFamily);
if (dwFontStyles & FX_FONTSTYLE_Bold)
wsFont += L"Bold";
if (dwFontStyles & FX_FONTSTYLE_Italic)
wsFont += L"Italic";
wsFont += wCodePage;
- return FX_HashCode_GetW(wsFont.AsStringC(), false);
+ return FX_HashCode_GetW(wsFont.AsStringView(), false);
}
} // namespace
@@ -307,8 +307,8 @@
void* buffer[3] = {pSrcFont.Get(), (void*)(uintptr_t)dwFontStyles,
(void*)(uintptr_t)wCodePage};
- uint32_t dwHash = FX_HashCode_GetA(
- CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false);
+ uint32_t dwHash =
+ FX_HashCode_GetA(ByteStringView((uint8_t*)buffer, sizeof(buffer)), false);
auto it = m_DeriveFonts.find(dwHash);
if (it != m_DeriveFonts.end() && it->second)
return it->second;
@@ -627,7 +627,7 @@
CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {}
-CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
+ByteString CFX_FontSourceEnum_File::GetNextFile() {
FX_FileHandle* pCurHandle =
!m_FolderQueue.empty() ? m_FolderQueue.back().pFileHandle : nullptr;
if (!pCurHandle) {
@@ -639,10 +639,10 @@
hpp.bsParentPath = m_FolderPaths.back();
m_FolderQueue.push_back(hpp);
}
- CFX_ByteString bsName;
+ ByteString bsName;
bool bFolder;
- CFX_ByteString bsFolderSeparator =
- CFX_ByteString::FromUnicode(CFX_WideString(kFolderSeparator));
+ ByteString bsFolderSeparator =
+ ByteString::FromUnicode(WideString(kFolderSeparator));
while (true) {
if (!FX_GetNextFile(pCurHandle, &bsName, &bFolder)) {
FX_CloseFolder(pCurHandle);
@@ -684,7 +684,7 @@
if (m_wsNext.GetLength() == 0)
return nullptr;
- auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringC());
+ auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringView());
m_wsNext = GetNextFile().UTF8Decode();
return pAccess;
}
@@ -722,8 +722,8 @@
if (!pFontStream)
continue;
- CFX_WideString wsFaceName =
- CFX_WideString::FromLocal(pFontMapper->GetFaceName(i).c_str());
+ WideString wsFaceName =
+ WideString::FromLocal(pFontMapper->GetFaceName(i).c_str());
RegisterFaces(pFontStream, &wsFaceName);
}
return !m_InstalledFonts.empty();
@@ -759,10 +759,10 @@
uint16_t wCodePage,
uint32_t dwFontStyles,
const wchar_t* pszFontFamily) {
- CFX_ByteString bsHash;
+ ByteString bsHash;
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
- bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily));
- uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
+ bsHash += FX_UTF8Encode(WideStringView(pszFontFamily));
+ uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false);
std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash];
if (!pFontArray->empty())
return (*pFontArray)[0];
@@ -773,7 +773,7 @@
auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>();
sortedFontInfos = pNewFonts.get();
MatchFonts(sortedFontInfos, wCodePage, dwFontStyles,
- CFX_WideString(pszFontFamily), 0);
+ WideString(pszFontFamily), 0);
m_Hash2CandidateList[dwHash] = std::move(pNewFonts);
}
if (sortedFontInfos->empty())
@@ -800,13 +800,13 @@
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode);
uint16_t wCodePage = x ? x->wCodePage : 0xFFFF;
uint16_t wBitField = x ? x->wBitField : 0x03E7;
- CFX_ByteString bsHash;
+ ByteString bsHash;
if (wCodePage == 0xFFFF)
bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles);
else
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
- bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily));
- uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
+ bsHash += FX_UTF8Encode(WideStringView(pszFontFamily));
+ uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false);
std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash];
for (size_t i = 0; i < pFonts->size(); ++i) {
if (VerifyUnicode((*pFonts)[i], wUnicode))
@@ -818,7 +818,7 @@
auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>();
sortedFontInfos = pNewFonts.get();
MatchFonts(sortedFontInfos, wCodePage, dwFontStyles,
- CFX_WideString(pszFontFamily), wUnicode);
+ WideString(pszFontFamily), wUnicode);
m_Hash2CandidateList[dwHash] = std::move(pNewFonts);
}
for (const auto& info : *sortedFontInfos) {
@@ -876,7 +876,7 @@
}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(
- const CFX_WideString& wsFaceName,
+ const WideString& wsFaceName,
int32_t iFaceIndex,
int32_t* pFaceCount) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
@@ -993,7 +993,7 @@
}
CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream(
- const CFX_ByteString& bsFaceName) {
+ const ByteString& bsFaceName) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
if (!pFontMapper)
@@ -1015,7 +1015,7 @@
std::vector<CFX_FontDescriptorInfo>* pMatchedFonts,
uint16_t wCodePage,
uint32_t dwFontStyles,
- const CFX_WideString& FontName,
+ const WideString& FontName,
wchar_t wcUnicode) {
pMatchedFonts->clear();
for (const auto& pFont : m_InstalledFonts) {
@@ -1033,7 +1033,7 @@
int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled,
uint16_t wCodePage,
uint32_t dwFontStyles,
- const CFX_WideString& FontName,
+ const WideString& FontName,
wchar_t wcUnicode) {
int32_t nPenalty = 30000;
if (FontName.GetLength() != 0) {
@@ -1122,8 +1122,7 @@
}
}
-void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace,
- const CFX_WideString* pFaceName) {
+void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) {
if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0)
return;
@@ -1147,18 +1146,17 @@
table.clear();
}
GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames);
- pFont->m_wsFamilyNames.push_back(
- CFX_ByteString(pFace->family_name).UTF8Decode());
+ pFont->m_wsFamilyNames.push_back(ByteString(pFace->family_name).UTF8Decode());
pFont->m_wsFaceName =
pFaceName ? *pFaceName
- : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace));
+ : WideString::FromLocal(FXFT_Get_Postscript_Name(pFace));
pFont->m_nFaceIndex = pFace->face_index;
m_InstalledFonts.push_back(std::move(pFont));
}
void CFGAS_FontMgr::RegisterFaces(
const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream,
- const CFX_WideString* pFaceName) {
+ const WideString* pFaceName) {
int32_t index = 0;
int32_t num_faces = 0;
do {
@@ -1194,12 +1192,12 @@
}
void CFGAS_FontMgr::GetNames(const uint8_t* name_table,
- std::vector<CFX_WideString>& Names) {
+ std::vector<WideString>& Names) {
if (!name_table)
return;
uint8_t* lpTable = (uint8_t*)name_table;
- CFX_WideString wsFamily;
+ WideString wsFamily;
uint8_t* sp = lpTable + 2;
uint8_t* lpNameRecord = lpTable + 6;
uint16_t nNameCount = GetUInt16(sp);
@@ -1267,8 +1265,8 @@
CSB[1] = pOS2->ulCodePageRange2;
}
-int32_t CFGAS_FontMgr::IsPartName(const CFX_WideString& Name1,
- const CFX_WideString& Name2) {
+int32_t CFGAS_FontMgr::IsPartName(const WideString& Name1,
+ const WideString& Name2) {
if (Name1.Contains(Name2.c_str()))
return 1;
return 0;
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index ca3cf1c..8e97036 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -131,8 +131,8 @@
~CFX_FontDescriptor();
int32_t m_nFaceIndex;
- CFX_WideString m_wsFaceName;
- std::vector<CFX_WideString> m_wsFamilyNames;
+ WideString m_wsFaceName;
+ std::vector<WideString> m_wsFamilyNames;
uint32_t m_dwFontStyles;
uint32_t m_dwUsb[4];
uint32_t m_dwCsb[2];
@@ -161,7 +161,7 @@
bsParentPath = x.bsParentPath;
}
FX_FileHandle* pFileHandle;
- CFX_ByteString bsParentPath;
+ ByteString bsParentPath;
};
class CFX_FontSourceEnum_File {
@@ -173,11 +173,11 @@
CFX_RetainPtr<CFX_CRTFileAccess> GetNext();
private:
- CFX_ByteString GetNextFile();
+ ByteString GetNextFile();
- CFX_WideString m_wsNext;
+ WideString m_wsNext;
std::vector<FX_HandleParentPath> m_FolderQueue;
- std::vector<CFX_ByteString> m_FolderPaths;
+ std::vector<ByteString> m_FolderPaths;
};
class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> {
@@ -203,28 +203,28 @@
bool EnumFonts();
bool EnumFontsFromFontMapper();
bool EnumFontsFromFiles();
- void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName);
+ void RegisterFace(FXFT_Face pFace, const WideString* pFaceName);
void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream,
- const CFX_WideString* pFaceName);
- void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names);
+ const WideString* pFaceName);
+ void GetNames(const uint8_t* name_table, std::vector<WideString>& Names);
std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const;
void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB);
uint32_t GetFlags(FXFT_Face pFace);
bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode);
bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
wchar_t wcUnicode);
- int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2);
+ int32_t IsPartName(const WideString& Name1, const WideString& Name2);
void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts,
uint16_t wCodePage,
uint32_t dwFontStyles,
- const CFX_WideString& FontName,
+ const WideString& FontName,
wchar_t wcUnicode = 0xFFFE);
int32_t CalcPenalty(CFX_FontDescriptor* pInstalled,
uint16_t wCodePage,
uint32_t dwFontStyles,
- const CFX_WideString& FontName,
+ const WideString& FontName,
wchar_t wcUnicode = 0xFFFE);
- CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName,
+ CFX_RetainPtr<CFGAS_GEFont> LoadFont(const WideString& wsFaceName,
int32_t iFaceIndex,
int32_t* pFaceCount);
FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream,
@@ -234,7 +234,7 @@
IFX_SystemFontInfo* pSystemFontInfo,
uint32_t index);
CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream(
- const CFX_ByteString& bsFaceName);
+ const ByteString& bsFaceName);
CFX_FontSourceEnum_File* const m_pFontSource;
std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts;
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 151aec7..c710ed9 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -102,9 +102,9 @@
uint16_t wCodePage) {
if (m_pFont)
return false;
- CFX_ByteString csFontFamily;
+ ByteString csFontFamily;
if (pszFontFamily)
- csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily);
+ csFontFamily = ByteString::FromUnicode(pszFontFamily);
uint32_t dwFlags = 0;
if (dwFontStyles & FX_FONTSTYLE_FixedPitch)
dwFlags |= FXFONT_FIXED_PITCH;
@@ -173,13 +173,13 @@
return pdfium::MakeRetain<CFGAS_GEFont>(pFont, dwFontStyles);
}
-CFX_WideString CFGAS_GEFont::GetFamilyName() const {
+WideString CFGAS_GEFont::GetFamilyName() const {
if (!m_pFont->GetSubstFont() ||
m_pFont->GetSubstFont()->m_Family.GetLength() == 0) {
- return CFX_WideString::FromLocal(m_pFont->GetFamilyName().AsStringC());
+ return WideString::FromLocal(m_pFont->GetFamilyName().AsStringView());
}
- return CFX_WideString::FromLocal(
- m_pFont->GetSubstFont()->m_Family.AsStringC());
+ return WideString::FromLocal(
+ m_pFont->GetSubstFont()->m_Family.AsStringView());
}
uint32_t CFGAS_GEFont::GetFontStyles() const {
@@ -330,7 +330,7 @@
if (!m_pFontMgr || !bRecursive)
return 0xFFFF;
- CFX_WideString wsFamily = GetFamilyName();
+ WideString wsFamily = GetFamilyName();
CFX_RetainPtr<CFGAS_GEFont> pFont =
m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str());
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index cc9e56a..13ac48f 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -89,7 +89,7 @@
bool bRecursive,
CFX_RetainPtr<CFGAS_GEFont>* ppFont,
bool bCharCode = false);
- CFX_WideString GetFamilyName() const;
+ WideString GetFamilyName() const;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
bool m_bUseLogFontStyle;
diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp
index 9eb0211..d3fce06 100644
--- a/xfa/fgas/layout/cfx_breakline.cpp
+++ b/xfa/fgas/layout/cfx_breakline.cpp
@@ -35,7 +35,7 @@
return &m_LinePieces[index];
}
-void CFX_BreakLine::GetString(CFX_WideString& wsStr) const {
+void CFX_BreakLine::GetString(WideString& wsStr) const {
int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars);
wchar_t* pBuf = wsStr.GetBuffer(iCount);
for (int32_t i = 0; i < iCount; i++)
diff --git a/xfa/fgas/layout/cfx_breakline.h b/xfa/fgas/layout/cfx_breakline.h
index 138ee31..8826976 100644
--- a/xfa/fgas/layout/cfx_breakline.h
+++ b/xfa/fgas/layout/cfx_breakline.h
@@ -24,7 +24,7 @@
int32_t CountPieces() const;
const CFX_BreakPiece* GetPiece(int32_t index) const;
- void GetString(CFX_WideString& wsStr) const;
+ void GetString(WideString& wsStr) const;
int32_t GetLineEnd() const;
void Clear();
diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp
index 70ac66e..364c117 100644
--- a/xfa/fgas/layout/cfx_breakpiece.cpp
+++ b/xfa/fgas/layout/cfx_breakpiece.cpp
@@ -34,8 +34,8 @@
return &(*m_pChars)[m_iStartChar + index];
}
-CFX_WideString CFX_BreakPiece::GetString() const {
- CFX_WideString ret;
+WideString CFX_BreakPiece::GetString() const {
+ WideString ret;
ret.Reserve(m_iChars);
for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
ret += static_cast<wchar_t>((*m_pChars)[i].char_code());
diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h
index 668245f..bbf4558 100644
--- a/xfa/fgas/layout/cfx_breakpiece.h
+++ b/xfa/fgas/layout/cfx_breakpiece.h
@@ -25,7 +25,7 @@
int32_t GetLength() const { return m_iChars; }
CFX_Char* GetChar(int32_t index) const;
- CFX_WideString GetString() const;
+ WideString GetString() const;
std::vector<int32_t> GetWidths() const;
CFX_BreakType m_dwStatus;
diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h
index 699815a..f5ad908 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.h
+++ b/xfa/fgas/layout/cfx_rtfbreak.h
@@ -31,7 +31,7 @@
FX_RTFTEXTOBJ();
~FX_RTFTEXTOBJ();
- CFX_WideString pStr;
+ WideString pStr;
std::vector<int32_t> pWidths;
CFX_RetainPtr<CFGAS_GEFont> pFont;
const CFX_RectF* pRect;
diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
index 8997edc..bda52fc 100644
--- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
@@ -39,7 +39,7 @@
TEST_F(CFX_RTFBreakTest, AddChars) {
auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab);
- CFX_WideString str(L"Input String.");
+ WideString str(L"Input String.");
for (const auto& c : str)
EXPECT_EQ(CFX_BreakType::None, b->AppendChar(c));
diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h
index 72614bc..959cd8e 100644
--- a/xfa/fgas/layout/cfx_txtbreak.h
+++ b/xfa/fgas/layout/cfx_txtbreak.h
@@ -41,7 +41,7 @@
CFDE_TextEditEngine* pEdtEngine;
const FDE_TEXTEDITPIECE* pIdentity;
- CFX_WideString wsStr;
+ WideString wsStr;
int32_t* pWidths;
int32_t iLength;
CFX_RetainPtr<CFGAS_GEFont> pFont;
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index 166827d..1f2a978 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -67,7 +67,7 @@
m_dwStatus = XFA_BCS_NeedUpdate;
}
-void CFWL_Barcode::SetText(const CFX_WideString& wsText) {
+void CFWL_Barcode::SetText(const WideString& wsText) {
m_pBarcodeEngine.reset();
m_dwStatus = XFA_BCS_NeedUpdate;
CFWL_Edit::SetText(wsText);
@@ -204,7 +204,7 @@
if (m_dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED)
m_pBarcodeEngine->SetTruncated(m_bTruncated);
- m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringC())
+ m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringView())
? XFA_BCS_EncodeSuccess
: 0;
}
diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h
index 48bdeab..2fc7960 100644
--- a/xfa/fwl/cfwl_barcode.h
+++ b/xfa/fwl/cfwl_barcode.h
@@ -49,7 +49,7 @@
void OnProcessEvent(CFWL_Event* pEvent) override;
// CFWL_Edit
- void SetText(const CFX_WideString& wsText) override;
+ void SetText(const WideString& wsText) override;
void SetType(BC_TYPE type);
bool IsProtectedType() const;
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index cbfbd9a..143d797 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -69,7 +69,7 @@
return FWL_Type::ComboBox;
}
-void CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
+void CFWL_ComboBox::AddString(const WideStringView& wsText) {
m_pListBox->AddString(wsText);
}
@@ -208,7 +208,7 @@
m_pEdit->SetThemeProvider(pThemeProvider);
}
-CFX_WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const {
+WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const {
CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(
m_pListBox->GetItem(m_pListBox.get(), iIndex));
return pItem ? pItem->GetText() : L"";
@@ -219,7 +219,7 @@
bool bClearSel = iSel < 0 || iSel >= iCount;
if (IsDropDownStyle() && m_pEdit) {
if (bClearSel) {
- m_pEdit->SetText(CFX_WideString());
+ m_pEdit->SetText(WideString());
} else {
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel);
m_pEdit->SetText(hItem ? hItem->GetText() : L"");
@@ -245,7 +245,7 @@
CFWL_Widget::RemoveStates(dwStates);
}
-void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
+void CFWL_ComboBox::SetEditText(const WideString& wsText) {
if (!m_pEdit)
return;
@@ -253,7 +253,7 @@
m_pEdit->Update();
}
-CFX_WideString CFWL_ComboBox::GetEditText() const {
+WideString CFWL_ComboBox::GetEditText() const {
if (m_pEdit)
return m_pEdit->GetText();
if (!m_pListBox)
@@ -348,7 +348,7 @@
}
void CFWL_ComboBox::MatchEditText() {
- CFX_WideString wsText = m_pEdit->GetText();
+ WideString wsText = m_pEdit->GetText();
int32_t iMatch = m_pListBox->MatchItem(wsText);
if (iMatch != m_iCurSel) {
m_pListBox->ChangeSelected(iMatch);
@@ -861,7 +861,7 @@
int32_t iCurSel = m_iCurSel;
bool bDropDown = IsDropDownStyle();
if (bDropDown && m_pEdit) {
- CFX_WideString wsText = m_pEdit->GetText();
+ WideString wsText = m_pEdit->GetText();
iCurSel = m_pListBox->MatchItem(wsText);
if (iCurSel >= 0) {
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iCurSel);
@@ -990,7 +990,7 @@
bool bMatchEqual = false;
int32_t iCurSel = m_iCurSel;
if (m_pEdit) {
- CFX_WideString wsText = m_pEdit->GetText();
+ WideString wsText = m_pEdit->GetText();
iCurSel = pComboList->MatchItem(wsText);
if (iCurSel >= 0) {
CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel);
diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h
index 7242b1f..923e2d8 100644
--- a/xfa/fwl/cfwl_combobox.h
+++ b/xfa/fwl/cfwl_combobox.h
@@ -59,16 +59,16 @@
void OnDrawWidget(CXFA_Graphics* pGraphics,
const CFX_Matrix& matrix) override;
- CFX_WideString GetTextByIndex(int32_t iIndex) const;
+ WideString GetTextByIndex(int32_t iIndex) const;
int32_t GetCurSel() const { return m_iCurSel; }
void SetCurSel(int32_t iSel);
- void AddString(const CFX_WideStringC& wsText);
+ void AddString(const WideStringView& wsText);
void RemoveAt(int32_t iIndex);
void RemoveAll();
- void SetEditText(const CFX_WideString& wsText);
- CFX_WideString GetEditText() const;
+ void SetEditText(const WideString& wsText);
+ WideString GetEditText() const;
void OpenDropDownList(bool bActivate);
@@ -83,11 +83,9 @@
return EditCanCopy();
}
bool EditCanSelectAll() const { return m_pEdit->GetTextLength() > 0; }
- bool EditCopy(CFX_WideString& wsCopy) const { return m_pEdit->Copy(wsCopy); }
- bool EditCut(CFX_WideString& wsCut) { return m_pEdit->Cut(wsCut); }
- bool EditPaste(const CFX_WideString& wsPaste) {
- return m_pEdit->Paste(wsPaste);
- }
+ bool EditCopy(WideString& wsCopy) const { return m_pEdit->Copy(wsCopy); }
+ bool EditCut(WideString& wsCut) { return m_pEdit->Cut(wsCut); }
+ bool EditPaste(const WideString& wsPaste) { return m_pEdit->Paste(wsPaste); }
void EditSelectAll() { m_pEdit->SelectAll(); }
void EditDelete() { m_pEdit->ClearText(); }
void EditDeSelect() { m_pEdit->ClearSelection(); }
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index f334f02..1180acf 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -25,14 +25,14 @@
ASSERT(pOuter);
}
-int32_t CFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
+int32_t CFWL_ComboList::MatchItem(const WideString& wsMatch) {
if (wsMatch.IsEmpty())
return -1;
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* hItem = GetItem(this, i);
- CFX_WideString wsText = hItem ? hItem->GetText() : L"";
+ WideString wsText = hItem ? hItem->GetText() : L"";
auto pos = wsText.Find(wsMatch.c_str());
if (pos.has_value() && pos.value() == 0)
return i;
diff --git a/xfa/fwl/cfwl_combolist.h b/xfa/fwl/cfwl_combolist.h
index b7ba6b5..a4d5135 100644
--- a/xfa/fwl/cfwl_combolist.h
+++ b/xfa/fwl/cfwl_combolist.h
@@ -22,7 +22,7 @@
// CFWL_ListBox.
void OnProcessMessage(CFWL_Message* pMessage) override;
- int32_t MatchItem(const CFX_WideString& wsMatch);
+ int32_t MatchItem(const WideString& wsMatch);
void ChangeSelected(int32_t iSel);
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index c8d7c5d..cd58dc7 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -160,7 +160,7 @@
m_pMonthCal->SetSelect(iYear, iMonth, iDay);
}
-void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
+void CFWL_DateTimePicker::SetEditText(const WideString& wsText) {
if (!m_pEdit)
return;
@@ -171,7 +171,7 @@
DispatchEvent(&ev);
}
-CFX_WideString CFWL_DateTimePicker::GetEditText() const {
+WideString CFWL_DateTimePicker::GetEditText() const {
return m_pEdit ? m_pEdit->GetText() : L"";
}
@@ -211,7 +211,7 @@
void CFWL_DateTimePicker::FormatDateString(int32_t iYear,
int32_t iMonth,
int32_t iDay,
- CFX_WideString& wsText) {
+ WideString& wsText) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_ShortDateFormat) ==
FWL_STYLEEXT_DTP_ShortDateFormat) {
wsText.Format(L"%d-%d-%d", iYear, iMonth, iDay);
@@ -307,7 +307,7 @@
m_iMonth = iMonth;
m_iDay = iDay;
- CFX_WideString wsText;
+ WideString wsText;
FormatDateString(m_iYear, m_iMonth, m_iDay, wsText);
m_pEdit->SetText(wsText);
m_pEdit->Update();
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index ece489e..276fea4 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -49,8 +49,8 @@
void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
- void SetEditText(const CFX_WideString& wsText);
- CFX_WideString GetEditText() const;
+ void SetEditText(const WideString& wsText);
+ WideString GetEditText() const;
bool HasSelection() const { return m_pEdit->HasSelection(); }
// Returns <start, end> indices of the selection.
@@ -75,7 +75,7 @@
void FormatDateString(int32_t iYear,
int32_t iMonth,
int32_t iDay,
- CFX_WideString& wsText);
+ WideString& wsText);
void ResetEditAlignment();
void InitProxyForm();
void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index ffe324c..1bec150 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -189,12 +189,12 @@
pGraphics->ConcatMatrix(pMatrix);
CFWL_EventCheckWord checkWordEvent(this);
- CFX_ByteString sLatinWord;
+ ByteString sLatinWord;
CXFA_Path pathSpell;
int32_t nStart = 0;
float fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
- CFX_WideString wsSpell = GetText();
+ WideString wsSpell = GetText();
int32_t nContentLen = wsSpell.GetLength();
for (int i = 0; i < nContentLen; i++) {
if (FxEditIsLatinWord(wsSpell[i])) {
@@ -270,7 +270,7 @@
m_pProperties->m_pThemeProvider = pThemeProvider;
}
-void CFWL_Edit::SetText(const CFX_WideString& wsText) {
+void CFWL_Edit::SetText(const WideString& wsText) {
m_EdtEngine.Clear();
m_EdtEngine.Insert(0, wsText);
}
@@ -279,7 +279,7 @@
return m_EdtEngine.GetLength();
}
-CFX_WideString CFWL_Edit::GetText() const {
+WideString CFWL_Edit::GetText() const {
return m_EdtEngine.GetText();
}
@@ -322,7 +322,7 @@
m_EdtEngine.SetAliasChar(wAlias);
}
-bool CFWL_Edit::Copy(CFX_WideString& wsCopy) {
+bool CFWL_Edit::Copy(WideString& wsCopy) {
if (!m_EdtEngine.HasSelection())
return false;
@@ -330,7 +330,7 @@
return true;
}
-bool CFWL_Edit::Cut(CFX_WideString& wsCut) {
+bool CFWL_Edit::Cut(WideString& wsCut) {
if (!m_EdtEngine.HasSelection())
return false;
@@ -338,7 +338,7 @@
return true;
}
-bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
+bool CFWL_Edit::Paste(const WideString& wsPaste) {
if (m_EdtEngine.HasSelection())
m_EdtEngine.ReplaceSelectedText(wsPaste);
else
@@ -396,7 +396,7 @@
}
}
-void CFWL_Edit::OnTextChanged(const CFX_WideString& prevText) {
+void CFWL_Edit::OnTextChanged(const WideString& prevText) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask)
UpdateVAlignment();
@@ -412,7 +412,7 @@
RepaintRect(GetClientRect());
}
-bool CFWL_Edit::OnValidate(const CFX_WideString& wsText) {
+bool CFWL_Edit::OnValidate(const WideString& wsText) {
CFWL_Widget* pDst = GetOuter();
if (!pDst)
pDst = this;
@@ -1050,7 +1050,7 @@
if (!m_bSetRange)
return true;
- CFX_WideString wsText = m_EdtEngine.GetText();
+ WideString wsText = m_EdtEngine.GetText();
if (wsText.IsEmpty())
return cNum != L'0';
@@ -1060,9 +1060,9 @@
return false;
int32_t nLen = wsText.GetLength();
- CFX_WideString l = wsText.Left(m_CursorPosition);
- CFX_WideString r = wsText.Right(nLen - m_CursorPosition);
- CFX_WideString wsNew = l + cNum + r;
+ WideString l = wsText.Left(m_CursorPosition);
+ WideString r = wsText.Right(nLen - m_CursorPosition);
+ WideString wsNew = l + cNum + r;
return wsNew.GetInteger() <= m_iMax;
}
@@ -1369,7 +1369,7 @@
if (pMsg->m_dwFlags & kEditingModifier)
break;
- m_EdtEngine.Insert(m_CursorPosition, CFX_WideString(c));
+ m_EdtEngine.Insert(m_CursorPosition, WideString(c));
SetCursorPosition(m_CursorPosition + 1);
break;
}
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index 310cb81..e85baaa 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -65,10 +65,10 @@
void OnDrawWidget(CXFA_Graphics* pGraphics,
const CFX_Matrix& matrix) override;
- virtual void SetText(const CFX_WideString& wsText);
+ virtual void SetText(const WideString& wsText);
int32_t GetTextLength() const;
- CFX_WideString GetText() const;
+ WideString GetText() const;
void ClearText();
void SelectAll();
@@ -80,9 +80,9 @@
int32_t GetLimit() const;
void SetLimit(int32_t nLimit);
void SetAliasChar(wchar_t wAlias);
- bool Copy(CFX_WideString& wsCopy);
- bool Cut(CFX_WideString& wsCut);
- bool Paste(const CFX_WideString& wsPaste);
+ bool Copy(WideString& wsCopy);
+ bool Cut(WideString& wsCut);
+ bool Paste(const WideString& wsPaste);
bool Undo();
bool Redo();
bool CanUndo();
@@ -93,9 +93,9 @@
// CFDE_TextEditEngine::Delegate
void NotifyTextFull() override;
void OnCaretChanged() override;
- void OnTextChanged(const CFX_WideString& prevText) override;
+ void OnTextChanged(const WideString& prevText) override;
void OnSelChanged() override;
- bool OnValidate(const CFX_WideString& wsText) override;
+ bool OnValidate(const WideString& wsText) override;
void SetScrollOffset(float fScrollOffset) override;
protected:
@@ -171,8 +171,8 @@
std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar;
std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar;
std::unique_ptr<CFWL_Caret> m_pCaret;
- CFX_WideString m_wsCache;
- CFX_WideString m_wsFont;
+ WideString m_wsCache;
+ WideString m_wsFont;
};
#endif // XFA_FWL_CFWL_EDIT_H_
diff --git a/xfa/fwl/cfwl_eventcheckword.h b/xfa/fwl/cfwl_eventcheckword.h
index 3de1e75..fafe3d3 100644
--- a/xfa/fwl/cfwl_eventcheckword.h
+++ b/xfa/fwl/cfwl_eventcheckword.h
@@ -14,7 +14,7 @@
explicit CFWL_EventCheckWord(CFWL_Widget* pSrcTarget);
~CFWL_EventCheckWord() override;
- CFX_ByteString bsWord;
+ ByteString bsWord;
bool bCheckWord;
};
diff --git a/xfa/fwl/cfwl_eventtextchanged.h b/xfa/fwl/cfwl_eventtextchanged.h
index 8ae2762..4494f08 100644
--- a/xfa/fwl/cfwl_eventtextchanged.h
+++ b/xfa/fwl/cfwl_eventtextchanged.h
@@ -14,7 +14,7 @@
explicit CFWL_EventTextChanged(CFWL_Widget* pSrcTarget);
~CFWL_EventTextChanged() override;
- CFX_WideString wsPrevText;
+ WideString wsPrevText;
};
#endif // XFA_FWL_CFWL_EVENTTEXTCHANGED_H_
diff --git a/xfa/fwl/cfwl_eventvalidate.h b/xfa/fwl/cfwl_eventvalidate.h
index 5121612..b8feff1 100644
--- a/xfa/fwl/cfwl_eventvalidate.h
+++ b/xfa/fwl/cfwl_eventvalidate.h
@@ -14,7 +14,7 @@
explicit CFWL_EventValidate(CFWL_Widget* pSrcTarget);
~CFWL_EventValidate() override;
- CFX_WideString wsInsert;
+ WideString wsInsert;
bool bValidate;
};
diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp
index 5e59f27..4761693 100644
--- a/xfa/fwl/cfwl_form.cpp
+++ b/xfa/fwl/cfwl_form.cpp
@@ -45,8 +45,8 @@
return FWL_Type::Form;
}
-bool CFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const {
- if (wsClass == CFX_WideStringC(FWL_CLASS_Form))
+bool CFWL_Form::IsInstance(const WideStringView& wsClass) const {
+ if (wsClass == WideStringView(FWL_CLASS_Form))
return true;
return CFWL_Widget::IsInstance(wsClass);
}
diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h
index 78fee4b..014ed22 100644
--- a/xfa/fwl/cfwl_form.h
+++ b/xfa/fwl/cfwl_form.h
@@ -34,7 +34,7 @@
// CFWL_Widget
FWL_Type GetClassID() const override;
- bool IsInstance(const CFX_WideStringC& wsClass) const override;
+ bool IsInstance(const WideStringView& wsClass) const override;
CFX_RectF GetClientRect() override;
void Update() override;
FWL_WidgetHit HitTest(const CFX_PointF& point) override;
diff --git a/xfa/fwl/cfwl_formproxy.cpp b/xfa/fwl/cfwl_formproxy.cpp
index 123cf25..d03c148 100644
--- a/xfa/fwl/cfwl_formproxy.cpp
+++ b/xfa/fwl/cfwl_formproxy.cpp
@@ -24,8 +24,8 @@
return FWL_Type::FormProxy;
}
-bool CFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const {
- if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy))
+bool CFWL_FormProxy::IsInstance(const WideStringView& wsClass) const {
+ if (wsClass == WideStringView(FWL_CLASS_FormProxy))
return true;
return CFWL_Form::IsInstance(wsClass);
}
diff --git a/xfa/fwl/cfwl_formproxy.h b/xfa/fwl/cfwl_formproxy.h
index 6307195..498ff42 100644
--- a/xfa/fwl/cfwl_formproxy.h
+++ b/xfa/fwl/cfwl_formproxy.h
@@ -22,7 +22,7 @@
// CFWL_Widget
FWL_Type GetClassID() const override;
- bool IsInstance(const CFX_WideStringC& wsClass) const override;
+ bool IsInstance(const WideStringView& wsClass) const override;
void Update() override;
void DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 210ec1f..0ddb65b 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -444,7 +444,7 @@
if (!pItem)
return;
- CFX_WideString wsText = pItem->GetText();
+ WideString wsText = pItem->GetText();
if (wsText.GetLength() <= 0)
return;
@@ -907,9 +907,9 @@
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
-CFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd) {
+CFWL_ListItem* CFWL_ListBox::AddString(const WideStringView& wsAdd) {
m_ItemArray.emplace_back(
- pdfium::MakeUnique<CFWL_ListItem>(CFX_WideString(wsAdd)));
+ pdfium::MakeUnique<CFWL_ListItem>(WideString(wsAdd)));
return m_ItemArray.back().get();
}
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 4704a8a..4a7818c 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -53,7 +53,7 @@
CFWL_ListItem* GetItem(const CFWL_Widget* pWidget, int32_t nIndex) const;
int32_t GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem);
- CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd);
+ CFWL_ListItem* AddString(const WideStringView& wsAdd);
void RemoveAt(int32_t iIndex);
void DeleteString(CFWL_ListItem* pItem);
void DeleteAll();
diff --git a/xfa/fwl/cfwl_listitem.cpp b/xfa/fwl/cfwl_listitem.cpp
index a8ea8a6..f8a7b75 100644
--- a/xfa/fwl/cfwl_listitem.cpp
+++ b/xfa/fwl/cfwl_listitem.cpp
@@ -6,7 +6,7 @@
#include "xfa/fwl/cfwl_listitem.h"
-CFWL_ListItem::CFWL_ListItem(const CFX_WideString& text)
+CFWL_ListItem::CFWL_ListItem(const WideString& text)
: m_dwStates(0), m_wsText(text) {
m_rtItem.Reset();
}
diff --git a/xfa/fwl/cfwl_listitem.h b/xfa/fwl/cfwl_listitem.h
index aac67fc..62c3a98 100644
--- a/xfa/fwl/cfwl_listitem.h
+++ b/xfa/fwl/cfwl_listitem.h
@@ -12,7 +12,7 @@
class CFWL_ListItem {
public:
- explicit CFWL_ListItem(const CFX_WideString& text);
+ explicit CFWL_ListItem(const WideString& text);
~CFWL_ListItem();
CFX_RectF GetRect() const { return m_rtItem; }
@@ -21,12 +21,12 @@
uint32_t GetStates() const { return m_dwStates; }
void SetStates(uint32_t dwStates) { m_dwStates = dwStates; }
- CFX_WideString GetText() const { return m_wsText; }
+ WideString GetText() const { return m_wsText; }
private:
CFX_RectF m_rtItem;
uint32_t m_dwStates;
- CFX_WideString m_wsText;
+ WideString m_wsText;
};
#endif // XFA_FWL_CFWL_LISTITEM_H_
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 11712fe..82cef65 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -32,9 +32,9 @@
namespace {
-CFX_WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme,
- CFWL_ThemePart& params,
- uint32_t day) {
+WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme,
+ CFWL_ThemePart& params,
+ uint32_t day) {
ASSERT(day < 7);
if (day == 0)
@@ -52,9 +52,9 @@
return L"Sat";
}
-CFX_WideString GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
- CFWL_ThemePart& params,
- uint32_t month) {
+WideString GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
+ CFWL_ThemePart& params,
+ uint32_t month) {
ASSERT(month < 12);
if (month == 0)
@@ -430,7 +430,7 @@
float fDayMaxW = 0.0f;
float fDayMaxH = 0.0f;
for (int day = 10; day <= 31; day++) {
- CFX_WideString wsDay;
+ WideString wsDay;
wsDay.Format(L"%d", day);
CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider, false);
fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width;
@@ -462,7 +462,7 @@
m_szHead.width + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.width * 2;
fs.width = std::max(fs.width, fMonthMaxW);
- CFX_WideString wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay);
+ WideString wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay);
m_wsToday = L"Today" + wsToday;
m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider, false);
m_szToday.height = (m_szToday.height >= m_szCell.height) ? m_szToday.height
@@ -579,7 +579,7 @@
if (iDayOfWeek >= 7)
iDayOfWeek = 0;
- CFX_WideString wsDay;
+ WideString wsDay;
wsDay.Format(L"%d", i + 1);
uint32_t dwStates = 0;
if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1))
@@ -674,21 +674,21 @@
AddSelDay(m_iDay);
}
-CFX_WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) {
+WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) {
ASSERT(iMonth > 0 && iMonth < 13);
static const wchar_t* const pMonth[] = {L"January", L"February", L"March",
L"April", L"May", L"June",
L"July", L"August", L"September",
L"October", L"November", L"December"};
- CFX_WideString wsHead;
+ WideString wsHead;
wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear);
return wsHead;
}
-CFX_WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- CFX_WideString wsToday;
+WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
+ WideString wsToday;
wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear);
return wsToday;
}
@@ -893,7 +893,7 @@
int32_t dayofweek,
uint32_t dwSt,
CFX_RectF rc,
- CFX_WideString& wsday)
+ WideString& wsday)
: iDay(day),
iDayOfWeek(dayofweek),
dwStates(dwSt),
diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h
index 6e0d471..50e6843 100644
--- a/xfa/fwl/cfwl_monthcalendar.h
+++ b/xfa/fwl/cfwl_monthcalendar.h
@@ -80,14 +80,14 @@
int32_t dayofweek,
uint32_t dwSt,
CFX_RectF rc,
- CFX_WideString& wsday);
+ WideString& wsday);
~DATEINFO();
int32_t iDay;
int32_t iDayOfWeek;
uint32_t dwStates;
CFX_RectF rect;
- CFX_WideString wsDay;
+ WideString wsDay;
};
void DrawBackground(CXFA_Graphics* pGraphics,
@@ -141,8 +141,8 @@
void RemoveSelDay();
void AddSelDay(int32_t iDay);
void JumpToToday();
- CFX_WideString GetHeadText(int32_t iYear, int32_t iMonth);
- CFX_WideString GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay);
+ WideString GetHeadText(int32_t iYear, int32_t iMonth);
+ WideString GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay);
int32_t GetDayAtPoint(const CFX_PointF& point) const;
CFX_RectF GetDayRect(int32_t iDay);
void OnLButtonDown(CFWL_MessageMouse* pMsg);
@@ -163,8 +163,8 @@
CFX_RectF m_rtTodayFlag;
CFX_RectF m_rtWeekNum;
CFX_RectF m_rtWeekNumSep;
- CFX_WideString m_wsHead;
- CFX_WideString m_wsToday;
+ WideString m_wsHead;
+ WideString m_wsToday;
std::vector<std::unique_ptr<DATEINFO>> m_arrDates;
int32_t m_iCurYear;
int32_t m_iCurMonth;
diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h
index 2a42615..91a3f38 100644
--- a/xfa/fwl/cfwl_themetext.h
+++ b/xfa/fwl/cfwl_themetext.h
@@ -15,7 +15,7 @@
public:
CFWL_ThemeText() : m_pGraphics(nullptr) {}
- CFX_WideString m_wsText;
+ WideString m_wsText;
FDE_TextStyle m_dwTTOStyles;
FDE_TextAlignment m_iTTOAlign;
CXFA_Graphics* m_pGraphics;
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 9071f0f..b9b04cf 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -63,7 +63,7 @@
m_pWidgetMgr->RemoveWidget(this);
}
-bool CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
+bool CFWL_Widget::IsInstance(const WideStringView& wsClass) const {
return false;
}
@@ -315,7 +315,7 @@
return pRet;
}
-CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
+CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
bool bMultiLine) {
if (!pTheme)
@@ -336,7 +336,7 @@
return CFX_SizeF(rect.width, rect.height);
}
-void CFWL_Widget::CalcTextRect(const CFX_WideString& wsText,
+void CFWL_Widget::CalcTextRect(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
const FDE_TextStyle& dwTTOStyles,
FDE_TextAlignment iTTOAlign,
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index 1c5f84d..16a818e 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -53,7 +53,7 @@
~CFWL_Widget() override;
virtual FWL_Type GetClassID() const = 0;
- virtual bool IsInstance(const CFX_WideStringC& wsClass) const;
+ virtual bool IsInstance(const WideStringView& wsClass) const;
virtual CFX_RectF GetAutosizedWidgetRect();
virtual CFX_RectF GetWidgetRect();
virtual CFX_RectF GetClientRect();
@@ -127,10 +127,10 @@
float GetBorderSize(bool bCX);
CFX_RectF GetRelativeRect();
IFWL_ThemeProvider* GetAvailableTheme();
- CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
+ CFX_SizeF CalcTextSize(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
bool bMultiLine);
- void CalcTextRect(const CFX_WideString& wsText,
+ void CalcTextRect(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
const FDE_TextStyle& dwTTOStyles,
FDE_TextAlignment iTTOAlign,
diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp
index 8b51f2d..9d667c6 100644
--- a/xfa/fwl/cfx_barcode.cpp
+++ b/xfa/fwl/cfx_barcode.cpp
@@ -294,7 +294,7 @@
: false;
}
-bool CFX_Barcode::Encode(const CFX_WideStringC& contents) {
+bool CFX_Barcode::Encode(const WideStringView& contents) {
return m_pBCEngine && m_pBCEngine->Encode(contents);
}
diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h
index 32a6db5..eec4648 100644
--- a/xfa/fwl/cfx_barcode.h
+++ b/xfa/fwl/cfx_barcode.h
@@ -27,7 +27,7 @@
bool Create(BC_TYPE type);
BC_TYPE GetType();
- bool Encode(const CFX_WideStringC& contents);
+ bool Encode(const WideStringView& contents);
bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix);
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
index 57438a0..6a1b9be 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.h
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -45,7 +45,7 @@
FWLTHEME_STATE GetState(uint32_t dwFWLStates);
std::unique_ptr<MCThemeData> m_pThemeData;
- CFX_WideString wsResource;
+ WideString wsResource;
private:
void SetThemeData();
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 4d6503f..1eade9c 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -53,7 +53,7 @@
pMatrix->Concat(*pGraphics->GetMatrix());
m_pTextOut->SetMatrix(*pMatrix);
m_pTextOut->DrawLogicText(pGraphics->GetRenderDevice(),
- CFX_WideStringC(pParams->m_wsText.c_str(), iLen),
+ WideStringView(pParams->m_wsText.c_str(), iLen),
pParams->m_rtPart);
}
@@ -260,14 +260,14 @@
CFWL_FontData::~CFWL_FontData() {}
-bool CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily,
+bool CFWL_FontData::Equal(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles &&
m_dwCodePage == wCodePage;
}
-bool CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
+bool CFWL_FontData::LoadFont(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t dwCodePage) {
m_wsFamily = wsFontFamily;
@@ -304,7 +304,7 @@
CFWL_FontManager::~CFWL_FontManager() {}
CFX_RetainPtr<CFGAS_GEFont> CFWL_FontManager::FindFont(
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
for (const auto& pData : m_FontsArray) {
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 229b9ea..dd36778 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -106,16 +106,16 @@
CFWL_FontData();
virtual ~CFWL_FontData();
- bool Equal(const CFX_WideStringC& wsFontFamily,
+ bool Equal(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
- bool LoadFont(const CFX_WideStringC& wsFontFamily,
+ bool LoadFont(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
CFX_RetainPtr<CFGAS_GEFont> GetFont() const { return m_pFont; }
protected:
- CFX_WideString m_wsFamily;
+ WideString m_wsFamily;
uint32_t m_dwStyles;
uint32_t m_dwCodePage;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
@@ -130,7 +130,7 @@
static CFWL_FontManager* GetInstance();
static void DestroyInstance();
- CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_WideStringC& wsFontFamily,
+ CFX_RetainPtr<CFGAS_GEFont> FindFont(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t dwCodePage);
diff --git a/xfa/fxfa/cxfa_deffontmgr.cpp b/xfa/fxfa/cxfa_deffontmgr.cpp
index db73067..7dd5de9 100644
--- a/xfa/fxfa/cxfa_deffontmgr.cpp
+++ b/xfa/fxfa/cxfa_deffontmgr.cpp
@@ -16,16 +16,16 @@
CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont(
CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
- CFX_WideString wsFontName(wsFontFamily);
+ WideString wsFontName(wsFontFamily);
CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
CFX_RetainPtr<CFGAS_GEFont> pFont =
pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage);
if (!pFont) {
const XFA_FONTINFO* pCurFont =
- XFA_GetFontINFOByFontName(wsFontName.AsStringC());
+ XFA_GetFontINFOByFontName(wsFontName.AsStringView());
if (pCurFont && pCurFont->pReplaceFont) {
uint32_t dwStyle = 0;
if (dwFontStyles & FX_FONTSTYLE_Bold) {
@@ -42,8 +42,7 @@
pNameText++;
iLength--;
}
- CFX_WideString wsReplace =
- CFX_WideString(pReplace, pNameText - pReplace);
+ WideString wsReplace = WideString(pReplace, pNameText - pReplace);
pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage);
if (pFont)
break;
@@ -61,7 +60,7 @@
CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont(
CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
diff --git a/xfa/fxfa/cxfa_deffontmgr.h b/xfa/fxfa/cxfa_deffontmgr.h
index 5f50ffb..3a5ea75 100644
--- a/xfa/fxfa/cxfa_deffontmgr.h
+++ b/xfa/fxfa/cxfa_deffontmgr.h
@@ -21,14 +21,13 @@
~CXFA_DefFontMgr();
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage = 0xFFFF);
- CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
+ CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(CXFA_FFDoc* hDoc,
+ const WideStringView& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
private:
std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_CacheFonts;
diff --git a/xfa/fxfa/cxfa_eventparam.h b/xfa/fxfa/cxfa_eventparam.h
index 1e7c12a..eafd76c 100644
--- a/xfa/fxfa/cxfa_eventparam.h
+++ b/xfa/fxfa/cxfa_eventparam.h
@@ -55,7 +55,7 @@
CXFA_WidgetAcc* m_pTarget;
XFA_EVENTTYPE m_eType;
- CFX_WideString m_wsResult;
+ WideString m_wsResult;
bool m_bCancelAction;
int32_t m_iCommitKey;
bool m_bKeyDown;
@@ -64,14 +64,14 @@
int32_t m_iSelEnd;
int32_t m_iSelStart;
bool m_bShift;
- CFX_WideString m_wsChange;
- CFX_WideString m_wsFullText;
- CFX_WideString m_wsNewContentType;
- CFX_WideString m_wsNewText;
- CFX_WideString m_wsPrevContentType;
- CFX_WideString m_wsPrevText;
- CFX_WideString m_wsSoapFaultCode;
- CFX_WideString m_wsSoapFaultString;
+ WideString m_wsChange;
+ WideString m_wsFullText;
+ WideString m_wsNewContentType;
+ WideString m_wsNewText;
+ WideString m_wsPrevContentType;
+ WideString m_wsPrevText;
+ WideString m_wsSoapFaultCode;
+ WideString m_wsSoapFaultString;
bool m_bIsFormReady;
};
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 03a7c7d..9686416 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -95,7 +95,7 @@
// static
const BarCodeInfo* CXFA_FFBarcode::GetBarcodeTypeByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
if (wsName.IsEmpty())
return nullptr;
@@ -129,7 +129,7 @@
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pFWLBarcode->SetText(wsText);
UpdateWidgetProperty();
@@ -161,8 +161,8 @@
CXFA_FFTextEdit::UpdateWidgetProperty();
auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get());
- CFX_WideString wsType = GetDataAcc()->GetBarcodeType();
- const BarCodeInfo* pBarcodeInfo = GetBarcodeTypeByName(wsType.AsStringC());
+ WideString wsType = GetDataAcc()->GetBarcodeType();
+ const BarCodeInfo* pBarcodeInfo = GetBarcodeTypeByName(wsType.AsStringView());
if (!pBarcodeInfo)
return;
diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h
index 13e5032..f03246d 100644
--- a/xfa/fxfa/cxfa_ffbarcode.h
+++ b/xfa/fxfa/cxfa_ffbarcode.h
@@ -85,7 +85,7 @@
class CXFA_FFBarcode : public CXFA_FFTextEdit {
public:
- static const BarCodeInfo* GetBarcodeTypeByName(const CFX_WideStringC& wsName);
+ static const BarCodeInfo* GetBarcodeTypeByName(const WideStringView& wsName);
explicit CXFA_FFBarcode(CXFA_WidgetAcc* pDataAcc);
~CXFA_FFBarcode() override;
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 950cab5..ca5645f 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -52,13 +52,13 @@
m_pNormalWidget->LockUpdate();
for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
- pComboBox->AddString(label.AsStringC());
+ pComboBox->AddString(label.AsStringView());
std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
if (!iSelArray.empty()) {
pComboBox->SetCurSel(iSelArray.front());
} else {
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
pComboBox->SetEditText(wsText);
}
@@ -120,15 +120,15 @@
bool CXFA_FFComboBox::IsDataChanged() {
auto* pFWLcombobox = ToComboBox(m_pNormalWidget.get());
- CFX_WideString wsText = pFWLcombobox->GetEditText();
+ WideString wsText = pFWLcombobox->GetEditText();
int32_t iCursel = pFWLcombobox->GetCurSel();
if (iCursel >= 0) {
- CFX_WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel);
+ WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel);
if (wsSel == wsText)
m_pDataAcc->GetChoiceListItem(wsText, iCursel, true);
}
- CFX_WideString wsOldValue;
+ WideString wsOldValue;
m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Raw);
if (wsOldValue == wsText)
return false;
@@ -193,7 +193,7 @@
if (!iSelArray.empty()) {
pComboBox->SetCurSel(iSelArray.front());
} else {
- CFX_WideString wsText;
+ WideString wsText;
pComboBox->SetCurSel(-1);
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
pComboBox->SetEditText(wsText);
@@ -241,16 +241,16 @@
return ToComboBox(m_pNormalWidget.get())->EditCanSelectAll();
}
-bool CXFA_FFComboBox::Copy(CFX_WideString& wsCopy) {
+bool CXFA_FFComboBox::Copy(WideString& wsCopy) {
return ToComboBox(m_pNormalWidget.get())->EditCopy(wsCopy);
}
-bool CXFA_FFComboBox::Cut(CFX_WideString& wsCut) {
+bool CXFA_FFComboBox::Cut(WideString& wsCut) {
return m_pDataAcc->IsChoiceListAllowTextEntry() &&
ToComboBox(m_pNormalWidget.get())->EditCut(wsCut);
}
-bool CXFA_FFComboBox::Paste(const CFX_WideString& wsPaste) {
+bool CXFA_FFComboBox::Paste(const WideString& wsPaste) {
return m_pDataAcc->IsChoiceListAllowTextEntry() &&
ToComboBox(m_pNormalWidget.get())->EditPaste(wsPaste);
}
@@ -273,7 +273,7 @@
AddInvalidateRect();
}
-void CXFA_FFComboBox::InsertItem(const CFX_WideStringC& wsLabel,
+void CXFA_FFComboBox::InsertItem(const WideStringView& wsLabel,
int32_t nIndex) {
ToComboBox(m_pNormalWidget.get())->AddString(wsLabel);
m_pNormalWidget->Update();
@@ -291,7 +291,7 @@
}
void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget,
- const CFX_WideString& wsChanged) {
+ const WideString& wsChanged) {
CXFA_EventParam eParam;
m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
eParam.m_wsChange = wsChanged;
@@ -335,7 +335,7 @@
break;
}
case CFWL_Event::Type::EditChanged: {
- CFX_WideString wsChanged;
+ WideString wsChanged;
OnTextChanged(m_pNormalWidget.get(), wsChanged);
break;
}
diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h
index 33e7d7c..81da2c2 100644
--- a/xfa/fxfa/cxfa_ffcombobox.h
+++ b/xfa/fxfa/cxfa_ffcombobox.h
@@ -29,9 +29,9 @@
bool CanCut() override;
bool CanPaste() override;
bool CanSelectAll() override;
- bool Copy(CFX_WideString& wsCopy) override;
- bool Cut(CFX_WideString& wsCut) override;
- bool Paste(const CFX_WideString& wsPaste) override;
+ bool Copy(WideString& wsCopy) override;
+ bool Cut(WideString& wsCut) override;
+ bool Paste(const WideString& wsPaste) override;
void SelectAll() override;
void Delete() override;
void DeSelect() override;
@@ -44,12 +44,12 @@
virtual void OpenDropDownList();
- void OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged);
+ void OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged);
void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp);
void OnPreOpen(CFWL_Widget* pWidget);
void OnPostOpen(CFWL_Widget* pWidget);
void SetItemState(int32_t nIndex, bool bSelected);
- void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex);
+ void InsertItem(const WideStringView& wsLabel, int32_t nIndex);
void DeleteItem(int32_t nIndex);
private:
@@ -62,7 +62,7 @@
uint32_t GetAlignment();
void FWLEventSelChange(CXFA_EventParam* pParam);
- CFX_WideString m_wsNewValue;
+ WideString m_wsNewValue;
IFWL_WidgetDelegate* m_pOldDelegate;
};
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index cfef664..643d384 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -45,7 +45,7 @@
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetEditText(wsText);
if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
@@ -148,7 +148,7 @@
if (IsFocused())
eType = XFA_VALUEPICTURE_Edit;
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, eType);
auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
@@ -169,9 +169,9 @@
if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged)
return true;
- CFX_WideString wsText =
+ WideString wsText =
static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText();
- CFX_WideString wsOldValue;
+ WideString wsOldValue;
m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Edit);
return wsOldValue != wsText;
}
@@ -180,13 +180,13 @@
int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- CFX_WideString wsPicture;
+ WideString wsPicture;
m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
- CFX_WideString wsDate;
+ WideString wsDate;
date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
XFA_VALUEPICTURE_Edit);
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 4d998e1..b3ff3c9 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -181,7 +181,7 @@
pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
- CFX_WideString wsTagName = pXMLElement->GetName();
+ WideString wsTagName = pXMLElement->GetName();
if (wsTagName == L"document") {
pDocumentElement = pXMLElement;
break;
@@ -197,7 +197,7 @@
pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
- CFX_WideString wsTagName = pXMLElement->GetName();
+ WideString wsTagName = pXMLElement->GetName();
if (wsTagName == L"chunk") {
pChunkElement = pXMLElement;
break;
@@ -207,7 +207,7 @@
if (!pChunkElement) {
return false;
}
- CFX_WideString wsPDFContent = pChunkElement->GetTextData();
+ WideString wsPDFContent = pChunkElement->GetTextData();
iBufferSize =
Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), nullptr);
pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1);
@@ -261,7 +261,7 @@
if (!pDynamicRender)
return;
- CFX_WideString wsType;
+ WideString wsType;
if (pDynamicRender->TryContent(wsType) && wsType == L"required")
m_dwDocType = XFA_DocType::Dynamic;
}
@@ -333,7 +333,7 @@
}
CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage(
- const CFX_WideStringC& wsName,
+ const WideStringView& wsName,
int32_t& iImageXDpi,
int32_t& iImageYDpi) {
if (!m_pPDFDoc)
@@ -360,10 +360,10 @@
return nullptr;
CPDF_NameTree nametree(pXFAImages);
- CPDF_Object* pObject = nametree.LookupValue(CFX_WideString(wsName));
+ CPDF_Object* pObject = nametree.LookupValue(WideString(wsName));
if (!pObject) {
for (size_t i = 0; i < nametree.GetCount(); i++) {
- CFX_WideString wsTemp;
+ WideString wsTemp;
CPDF_Object* pTempObject = nametree.LookupValueAndName(i, &wsTemp);
if (wsTemp == wsName) {
pObject = pTempObject;
@@ -399,7 +399,7 @@
if (!pNode)
return !!pExport->Export(pFile);
- CFX_ByteString bsChecksum;
+ ByteString bsChecksum;
if (pCSContext)
bsChecksum = pCSContext->GetChecksum();
diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h
index 984d8b6..7984d74 100644
--- a/xfa/fxfa/cxfa_ffdoc.h
+++ b/xfa/fxfa/cxfa_ffdoc.h
@@ -69,7 +69,7 @@
CPDF_Document* GetPDFDoc() const { return m_pPDFDoc.Get(); }
CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
CXFA_FFDocView* GetDocView();
- CFX_RetainPtr<CFX_DIBitmap> GetPDFNamedImage(const CFX_WideStringC& wsName,
+ CFX_RetainPtr<CFX_DIBitmap> GetPDFNamedImage(const WideStringView& wsName,
int32_t& iImageXDpi,
int32_t& iImageYDpi);
diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp
index b0a84fa..8dbc550 100644
--- a/xfa/fxfa/cxfa_ffdochandler.cpp
+++ b/xfa/fxfa/cxfa_ffdochandler.cpp
@@ -44,7 +44,7 @@
bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc,
XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
+ const WideStringView& wsScript,
CFXJSE_Value* pRetValue,
CFXJSE_Value* pThisValue) {
CXFA_Document* pXFADoc = hDoc->GetXFADoc();
diff --git a/xfa/fxfa/cxfa_ffdochandler.h b/xfa/fxfa/cxfa_ffdochandler.h
index 45b2ee0..7da03b0 100644
--- a/xfa/fxfa/cxfa_ffdochandler.h
+++ b/xfa/fxfa/cxfa_ffdochandler.h
@@ -21,7 +21,7 @@
bool RunDocScript(CXFA_FFDoc* hDoc,
XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
+ const WideStringView& wsScript,
CFXJSE_Value* pRetValue,
CFXJSE_Value* pThisObject);
};
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 95faeb3..56dfeed 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -154,12 +154,12 @@
if (pAppProvider && iCount) {
int32_t iRemain = iCount > 7 ? iCount - 7 : 0;
iCount -= iRemain;
- CFX_WideString wsMsg;
+ WideString wsMsg;
for (int32_t i = 0; i < iCount; i++) {
wsMsg += m_arrNullTestMsg[i] + L"\n";
}
if (iRemain > 0) {
- CFX_WideString wsTemp;
+ WideString wsTemp;
wsTemp.Format(
L"Message limit exceeded. Remaining %d "
L"validation errors not reported.",
@@ -259,7 +259,7 @@
return XFA_EVENTERROR_Error;
if (pParam->m_eType == XFA_EVENT_Validate) {
- CFX_WideString wsValidateStr(L"preSubmit");
+ WideString wsValidateStr(L"preSubmit");
CXFA_Node* pConfigItem =
ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
if (pConfigItem) {
@@ -478,7 +478,7 @@
return iRet;
}
-CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName,
+CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const WideString& wsName,
CXFA_FFWidget* pRefWidget) {
CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr;
CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
@@ -486,9 +486,9 @@
}
CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
- const CFX_WideString& wsName,
+ const WideString& wsName,
CXFA_WidgetAcc* pRefWidgetAcc) {
- CFX_WideString wsExpression;
+ WideString wsExpression;
uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
@@ -504,7 +504,7 @@
}
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
+ refNode, wsExpression.AsStringView(), resoveNodeRS, dwStyle);
if (iRet < 1)
return nullptr;
@@ -735,7 +735,7 @@
CXFA_BindItems binditems(item);
CXFA_ScriptContext* pScriptContext =
pWidgetNode->GetDocument()->GetScriptContext();
- CFX_WideStringC wsRef;
+ WideStringView wsRef;
binditems.GetRef(wsRef);
uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
@@ -746,14 +746,14 @@
if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || rs.objects.empty())
continue;
- CFX_WideStringC wsValueRef, wsLabelRef;
+ WideStringView wsValueRef, wsLabelRef;
binditems.GetValueRef(wsValueRef);
binditems.GetLabelRef(wsLabelRef);
const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$";
const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
- CFX_WideString wsValue;
- CFX_WideString wsLabel;
+ WideString wsValue;
+ WideString wsLabel;
uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
for (CXFA_Object* refObject : rs.objects) {
CXFA_Node* refNode = refObject->AsNode();
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index 314ce29..981491c 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -60,9 +60,9 @@
CXFA_FFWidget* GetFocusWidget() const;
void KillFocus();
bool SetFocus(CXFA_FFWidget* hWidget);
- CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName,
+ CXFA_FFWidget* GetWidgetByName(const WideString& wsName,
CXFA_FFWidget* pRefWidget);
- CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName,
+ CXFA_WidgetAcc* GetWidgetAccByName(const WideString& wsName,
CXFA_WidgetAcc* pRefWidgetAcc);
CXFA_LayoutProcessor* GetXFALayout() const;
void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
@@ -100,7 +100,7 @@
bool bRecursive,
CXFA_Node* pExclude);
bool m_bLayoutEvent;
- std::vector<CFX_WideString> m_arrNullTestMsg;
+ std::vector<WideString> m_arrNullTestMsg;
CXFA_FFWidget* m_pListFocusWidget;
bool m_bInLayoutStatus;
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index bfc9e4e..c35cfe1 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -687,7 +687,7 @@
if (!script)
return 1;
- CFX_WideString wsExpression;
+ WideString wsExpression;
script.GetExpression(wsExpression);
if (wsExpression.IsEmpty())
return 1;
@@ -700,7 +700,7 @@
if (!pAppProvider)
return 0;
- CFX_WideString wsMessage;
+ WideString wsMessage;
calc.GetMessageText(wsMessage);
if (!wsMessage.IsEmpty())
wsMessage += L"\r\n";
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 66e1fdb..1fb6670 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -53,7 +53,7 @@
m_pNormalWidget->LockUpdate();
for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
- pListBox->AddString(label.AsStringC());
+ pListBox->AddString(label.AsStringView());
uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect)
@@ -169,10 +169,9 @@
AddInvalidateRect();
}
-void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
- int32_t nIndex) {
- CFX_WideString wsTemp(wsLabel);
- ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringC());
+void CXFA_FFListBox::InsertItem(const WideStringView& wsLabel, int32_t nIndex) {
+ WideString wsTemp(wsLabel);
+ ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringView());
m_pNormalWidget->Update();
AddInvalidateRect();
}
diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h
index bf97d93..f31b122 100644
--- a/xfa/fxfa/cxfa_fflistbox.h
+++ b/xfa/fxfa/cxfa_fflistbox.h
@@ -24,7 +24,7 @@
void OnSelectChanged(CFWL_Widget* pWidget);
void SetItemState(int32_t nIndex, bool bSelected);
- void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex);
+ void InsertItem(const WideStringView& wsLabel, int32_t nIndex);
void DeleteItem(int32_t nIndex);
private:
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 9c2ac91..9aac64a 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -287,11 +287,11 @@
pDocView->UpdateDocView();
}
-CFX_WideString CXFA_FFNotify::GetCurrentDateTime() {
+WideString CXFA_FFNotify::GetCurrentDateTime() {
CFX_DateTime dataTime;
dataTime.Now();
- CFX_WideString wsDateTime;
+ WideString wsDateTime;
wsDateTime.Format(L"%d%02d%02dT%02d%02d%02d", dataTime.GetYear(),
dataTime.GetMonth(), dataTime.GetDay(), dataTime.GetHour(),
dataTime.GetMinute(), dataTime.GetSecond());
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index 12aca5e..01adc33 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -62,7 +62,7 @@
CXFA_FFWidgetHandler* GetWidgetHandler();
CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem);
void OpenDropDownList(CXFA_FFWidget* hWidget);
- CFX_WideString GetCurrentDateTime();
+ WideString GetCurrentDateTime();
void ResetData(CXFA_WidgetData* pWidgetData = nullptr);
int32_t GetLayoutStatus();
void RunNodeInitialize(CXFA_Node* pNode);
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index 4da98ac..9b87c40 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -33,7 +33,7 @@
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetText(wsText);
UpdateWidgetProperty();
@@ -75,9 +75,8 @@
CXFA_FFTextEdit::OnProcessEvent(pEvent);
}
-bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
- CFX_WideString& wsText) {
- CFX_WideString wsPattern;
+bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, WideString& wsText) {
+ WideString wsPattern;
m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
if (!wsPattern.IsEmpty())
return true;
@@ -88,7 +87,7 @@
int32_t iFracs = 0;
m_pDataAcc->GetFracDigits(iFracs);
- CFX_WideString wsFormat;
+ WideString wsFormat;
CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get());
widgetValue.GetNumericFormat(wsFormat, iLeads, iFracs);
return widgetValue.ValidateNumericTemp(wsText, wsFormat,
diff --git a/xfa/fxfa/cxfa_ffnumericedit.h b/xfa/fxfa/cxfa_ffnumericedit.h
index ece0a49..fb06fd4 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.h
+++ b/xfa/fxfa/cxfa_ffnumericedit.h
@@ -25,7 +25,7 @@
void OnProcessEvent(CFWL_Event* pEvent) override;
private:
- bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText);
+ bool OnValidate(CFWL_Widget* pWidget, WideString& wsText);
};
#endif // XFA_FXFA_CXFA_FFNUMERICEDIT_H_
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 594d71d..1de900c 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -311,7 +311,7 @@
if (pTraversal) {
CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse);
if (pTraverse) {
- CFX_WideString wsTraverseWidgetName;
+ WideString wsTraverseWidgetName;
if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
return FindWidgetByName(wsTraverseWidgetName, pWidget);
}
@@ -320,7 +320,7 @@
return nullptr;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName(
- const CFX_WideString& wsWidgetName,
+ const WideString& wsWidgetName,
CXFA_FFWidget* pRefWidget) {
return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget);
}
diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h
index f2451fb..4e79ad5 100644
--- a/xfa/fxfa/cxfa_ffpageview.h
+++ b/xfa/fxfa/cxfa_ffpageview.h
@@ -92,7 +92,7 @@
protected:
CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
- CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
+ CXFA_FFWidget* FindWidgetByName(const WideString& wsWidgetName,
CXFA_FFWidget* pRefWidget);
void CreateTabOrderWidgetArray();
void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray);
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp
index 46105f1..e050a69 100644
--- a/xfa/fxfa/cxfa_ffpasswordedit.cpp
+++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp
@@ -31,7 +31,7 @@
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pWidget->SetText(wsText);
UpdateWidgetProperty();
@@ -49,7 +49,7 @@
FWL_STYLEEXT_EDT_Password;
dwExtendedStyle |= UpdateUIProperty();
- CFX_WideString wsPassWord;
+ WideString wsPassWord;
m_pDataAcc->GetPasswordChar(wsPassWord);
if (!wsPassWord.IsEmpty())
pWidget->SetAliasChar(wsPassWord[0]);
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 63079cf..2fac858 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -135,7 +135,7 @@
return;
bool bRichText;
- CFX_WideString wsRollover;
+ WideString wsRollover;
if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
if (!m_pRollProvider) {
m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>(
@@ -144,7 +144,7 @@
m_pRolloverTextLayout =
pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get());
}
- CFX_WideString wsDown;
+ WideString wsDown;
if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
if (!m_pDownProvider) {
m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>(
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 35c20fa..e27971d 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -47,7 +47,7 @@
m_pNormalWidget->LockUpdate();
UpdateWidgetProperty();
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
pFWLEdit->SetText(wsText);
m_pNormalWidget->UnlockUpdate();
@@ -173,8 +173,7 @@
}
bool CXFA_FFTextEdit::CommitData() {
- CFX_WideString wsText =
- static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
+ WideString wsText = static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) {
m_pDataAcc->UpdateUIDisplay(this);
return true;
@@ -183,7 +182,7 @@
return false;
}
-void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) {
+void CXFA_FFTextEdit::ValidateNumberField(const WideString& wsText) {
CXFA_WidgetAcc* pAcc = GetDataAcc();
if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit)
return;
@@ -192,10 +191,10 @@
if (!pAppProvider)
return;
- CFX_WideString wsSomField;
+ WideString wsSomField;
pAcc->GetNode()->GetSOMExpression(wsSomField);
- CFX_WideString wsMessage;
+ WideString wsMessage;
wsMessage.Format(L"%s can not contain %s", wsText.c_str(),
wsSomField.c_str());
pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(), XFA_MBICON_Error,
@@ -272,10 +271,10 @@
bUpdate = true;
}
- CFX_WideString wsText;
+ WideString wsText;
m_pDataAcc->GetValue(wsText, eType);
- CFX_WideString wsOldText = pEdit->GetText();
+ WideString wsOldText = pEdit->GetText();
if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
pEdit->SetText(wsText);
bUpdate = true;
@@ -287,8 +286,8 @@
}
void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
- const CFX_WideString& wsChanged,
- const CFX_WideString& wsPrevText) {
+ const WideString& wsChanged,
+ const WideString& wsPrevText) {
m_dwStatus |= XFA_WidgetStatus_TextEditValueChanged;
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
@@ -318,7 +317,7 @@
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam);
}
-bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
+bool CXFA_FFTextEdit::CheckWord(const ByteStringView& sWord) {
return sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit;
}
@@ -332,7 +331,7 @@
case CFWL_Event::Type::TextChanged: {
CFWL_EventTextChanged* event =
static_cast<CFWL_EventTextChanged*>(pEvent);
- CFX_WideString wsChange;
+ WideString wsChange;
OnTextChanged(m_pNormalWidget.get(), wsChange, event->wsPrevText);
break;
}
@@ -341,9 +340,9 @@
break;
}
case CFWL_Event::Type::CheckWord: {
- CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
+ WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
CFWL_EventCheckWord* event = static_cast<CFWL_EventCheckWord*>(pEvent);
- event->bCheckWord = CheckWord(event->bsWord.AsStringC());
+ event->bCheckWord = CheckWord(event->bsWord.AsStringView());
break;
}
default:
diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h
index 2a3da37..9735b9e 100644
--- a/xfa/fxfa/cxfa_fftextedit.h
+++ b/xfa/fxfa/cxfa_fftextedit.h
@@ -37,10 +37,10 @@
const CFX_Matrix& matrix) override;
void OnTextChanged(CFWL_Widget* pWidget,
- const CFX_WideString& wsChanged,
- const CFX_WideString& wsPrevText);
+ const WideString& wsChanged,
+ const WideString& wsPrevText);
void OnTextFull(CFWL_Widget* pWidget);
- bool CheckWord(const CFX_ByteStringC& sWord);
+ bool CheckWord(const ByteStringView& sWord);
protected:
uint32_t GetAlignment();
@@ -51,7 +51,7 @@
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
- void ValidateNumberField(const CFX_WideString& wsText);
+ void ValidateNumberField(const WideString& wsText);
};
#endif // XFA_FXFA_CXFA_FFTEXTEDIT_H_
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 26ab37d..07d089b 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -966,7 +966,7 @@
return m_pDataAcc.Get();
}
-bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
+bool CXFA_FFWidget::GetToolTip(WideString& wsToolTip) {
if (CXFA_Assist assist = m_pDataAcc->GetAssist()) {
if (CXFA_ToolTip toolTip = assist.GetToolTip()) {
return toolTip.GetTip(wsToolTip);
@@ -1032,7 +1032,7 @@
m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
}
-bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
+bool CXFA_FFWidget::GetCaptionText(WideString& wsCap) {
CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
if (!pCapTextlayout) {
return false;
@@ -1168,15 +1168,15 @@
return CanCopy();
}
-bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) {
+bool CXFA_FFWidget::Copy(WideString& wsCopy) {
return false;
}
-bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) {
+bool CXFA_FFWidget::Cut(WideString& wsCut) {
return false;
}
-bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) {
+bool CXFA_FFWidget::Paste(const WideString& wsPaste) {
return false;
}
@@ -1187,12 +1187,12 @@
void CXFA_FFWidget::DeSelect() {}
void CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>* pWords) {
+ std::vector<ByteString>* pWords) {
pWords->clear();
}
bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) {
+ const ByteStringView& bsReplace) {
return false;
}
@@ -1869,8 +1869,8 @@
out[j] = '\0';
return out;
}
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) {
- CFX_WideString wsContentType(wsType);
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) {
+ WideString wsContentType(wsType);
wsContentType.MakeLower();
if (wsContentType == L"image/jpg")
return FXCODEC_IMAGE_JPG;
@@ -1890,24 +1890,24 @@
bool& bNameImage,
int32_t& iImageXDpi,
int32_t& iImageYDpi) {
- CFX_WideString wsHref;
- CFX_WideString wsImage;
+ WideString wsHref;
+ WideString wsImage;
pImage->GetHref(wsHref);
pImage->GetContent(wsImage);
if (wsHref.IsEmpty() && wsImage.IsEmpty())
return nullptr;
- CFX_WideString wsContentType;
+ WideString wsContentType;
pImage->GetContentType(wsContentType);
FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
- CFX_ByteString bsContent;
+ ByteString bsContent;
uint8_t* pImageBuffer = nullptr;
CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead;
if (wsImage.GetLength() > 0) {
XFA_ATTRIBUTEENUM iEncoding =
(XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
- CFX_ByteString bsData = wsImage.UTF8Encode();
+ ByteString bsData = wsImage.UTF8Encode();
int32_t iLength = bsData.GetLength();
pImageBuffer = FX_Alloc(uint8_t, iLength);
int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
@@ -1916,16 +1916,16 @@
pdfium::MakeRetain<CFX_MemoryStream>(pImageBuffer, iRead, false);
}
} else {
- bsContent = CFX_ByteString::FromUnicode(wsImage);
+ bsContent = ByteString::FromUnicode(wsImage);
pImageFileRead = pdfium::MakeRetain<CFX_MemoryStream>(
const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength(),
false);
}
} else {
- CFX_WideString wsURL = wsHref;
+ WideString wsURL = wsHref;
if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") {
CFX_RetainPtr<CFX_DIBitmap> pBitmap =
- pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi);
+ pDoc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi);
if (pBitmap) {
bNameImage = true;
return pBitmap;
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index f2ca86f..41bb941 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -61,7 +61,7 @@
int32_t& iImageXDpi,
int32_t& iImageYDpi);
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType);
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType);
char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
void XFA_RectWidthoutMargin(CFX_RectF& rt,
const CXFA_Margin& mg,
@@ -126,17 +126,17 @@
virtual bool CanSelectAll();
virtual bool CanDelete();
virtual bool CanDeSelect();
- virtual bool Copy(CFX_WideString& wsCopy);
- virtual bool Cut(CFX_WideString& wsCut);
- virtual bool Paste(const CFX_WideString& wsPaste);
+ virtual bool Copy(WideString& wsCopy);
+ virtual bool Cut(WideString& wsCut);
+ virtual bool Paste(const WideString& wsPaste);
virtual void SelectAll();
virtual void Delete();
virtual void DeSelect();
// TODO(tsepez): Implement or remove.
- void GetSuggestWords(CFX_PointF pointf, std::vector<CFX_ByteString>* pWords);
+ void GetSuggestWords(CFX_PointF pointf, std::vector<ByteString>* pWords);
bool ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace);
+ const ByteStringView& bsReplace);
CXFA_FFPageView* GetPageView() const { return m_pPageView; }
void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
@@ -146,7 +146,7 @@
void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved);
CXFA_WidgetAcc* GetDataAcc();
- bool GetToolTip(CFX_WideString& wsToolTip);
+ bool GetToolTip(WideString& wsToolTip);
CXFA_FFDocView* GetDocView();
void SetDocView(CXFA_FFDocView* pDocView);
@@ -154,7 +154,7 @@
CXFA_FFApp* GetApp();
IXFA_AppProvider* GetAppProvider();
void AddInvalidateRect();
- bool GetCaptionText(CFX_WideString& wsCap);
+ bool GetCaptionText(WideString& wsCap);
bool IsFocused() const { return !!(m_dwStatus & XFA_WidgetStatus_Focused); }
CFX_PointF Rotate2Normal(const CFX_PointF& point);
CFX_Matrix GetRotateMatrix();
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 81e296f..b47ce6b 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -1700,8 +1700,7 @@
} // namespace
-CFX_WideString XFA_LocalFontNameToEnglishName(
- const CFX_WideStringC& wsLocalName) {
+WideString XFA_LocalFontNameToEnglishName(const WideStringView& wsLocalName) {
uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
const XFA_FONTINFO* pFontInfo =
@@ -1711,15 +1710,15 @@
});
if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
return pFontInfo->pPsName;
- return CFX_WideString(wsLocalName);
+ return WideString(wsLocalName);
}
const XFA_FONTINFO* XFA_GetFontINFOByFontName(
- const CFX_WideStringC& wsFontName) {
- CFX_WideString wsFontNameTemp(wsFontName);
+ const WideStringView& wsFontName) {
+ WideString wsFontNameTemp(wsFontName);
wsFontNameTemp.Remove(L' ');
uint32_t dwCurFontNameHash =
- FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true);
+ FX_HashCode_GetW(wsFontNameTemp.AsStringView(), true);
const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
const XFA_FONTINFO* pFontInfo =
std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
@@ -1737,25 +1736,25 @@
CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString bsKey;
+ ByteString bsKey;
bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
auto iter = m_FontMap.find(bsKey);
if (iter != m_FontMap.end())
return iter->second;
- CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
+ WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
auto it = m_PDFFontMgrMap.find(hDoc);
CXFA_PDFFontMgr* pMgr =
it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr;
CPDF_Font* pPDFFont = nullptr;
CFX_RetainPtr<CFGAS_GEFont> pFont;
if (pMgr) {
- pFont =
- pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true);
+ pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont,
+ true);
if (pFont)
return pFont;
}
@@ -1764,7 +1763,7 @@
if (!pFont && pMgr) {
pPDFFont = nullptr;
- pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont,
+ pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont,
false);
if (pFont)
return pFont;
diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h
index f66ca8f..e5db565 100644
--- a/xfa/fxfa/cxfa_fontmgr.h
+++ b/xfa/fxfa/cxfa_fontmgr.h
@@ -29,10 +29,8 @@
uint16_t wCodePage;
};
-CFX_WideString XFA_LocalFontNameToEnglishName(
- const CFX_WideStringC& wsLocalName);
-const XFA_FONTINFO* XFA_GetFontINFOByFontName(
- const CFX_WideStringC& wsFontName);
+WideString XFA_LocalFontNameToEnglishName(const WideStringView& wsLocalName);
+const XFA_FONTINFO* XFA_GetFontINFOByFontName(const WideStringView& wsFontName);
class CXFA_FontMgr {
public:
@@ -40,7 +38,7 @@
~CXFA_FontMgr();
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage = 0xFFFF);
void LoadDocFonts(CXFA_FFDoc* hDoc);
@@ -50,7 +48,7 @@
private:
std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr;
std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap;
- std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
+ std::map<ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
};
#endif // XFA_FXFA_CXFA_FONTMGR_H_
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index ec0ce45..35456ef 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -116,7 +116,7 @@
mtPart.Concat(*pMatrix);
m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringC(),
+ m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(),
pParams->m_rtPart);
return;
}
@@ -141,7 +141,7 @@
mtPart.Concat(*pMatrix);
m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringC(),
+ m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(),
pParams->m_rtPart);
}
diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h
index 9fbb068..48fb744 100644
--- a/xfa/fxfa/cxfa_fwltheme.h
+++ b/xfa/fxfa/cxfa_fwltheme.h
@@ -60,7 +60,7 @@
std::unique_ptr<CFWL_BarcodeTP> m_pBarcodeTP;
std::unique_ptr<CFDE_TextOut> m_pTextOut;
CFX_RetainPtr<CFGAS_GEFont> m_pCalendarFont;
- CFX_WideString m_wsResource;
+ WideString m_wsResource;
CFX_UnownedPtr<CXFA_FFApp> const m_pApp;
CFX_RectF m_Rect;
};
diff --git a/xfa/fxfa/cxfa_linkuserdata.h b/xfa/fxfa/cxfa_linkuserdata.h
index b3ee74a..7a9648c 100644
--- a/xfa/fxfa/cxfa_linkuserdata.h
+++ b/xfa/fxfa/cxfa_linkuserdata.h
@@ -22,7 +22,7 @@
explicit CXFA_LinkUserData(wchar_t* pszText);
~CXFA_LinkUserData() override;
- CFX_WideString m_wsURLContent;
+ WideString m_wsURLContent;
};
#endif // XFA_FXFA_CXFA_LINKUSERDATA_H_
diff --git a/xfa/fxfa/cxfa_pdffontmgr.cpp b/xfa/fxfa/cxfa_pdffontmgr.cpp
index 30af697..9a90e54 100644
--- a/xfa/fxfa/cxfa_pdffontmgr.cpp
+++ b/xfa/fxfa/cxfa_pdffontmgr.cpp
@@ -28,7 +28,7 @@
CXFA_PDFFontMgr::~CXFA_PDFFontMgr() {}
CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont(
- const CFX_ByteString& strPsName,
+ const ByteString& strPsName,
bool bBold,
bool bItalic,
CPDF_Font** pDstPDFFont,
@@ -46,13 +46,13 @@
if (!pFontSetDict)
return nullptr;
- CFX_ByteString name = strPsName;
+ ByteString name = strPsName;
name.Remove(' ');
CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
for (const auto& it : *pFontSetDict) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pObj = it.second.get();
- if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
+ if (!PsNameMatchDRFontName(name.AsStringView(), bBold, bItalic, key,
bStrictMatch)) {
continue;
}
@@ -74,21 +74,20 @@
}
CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont(
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
CPDF_Font** pPDFFont,
bool bStrictMatch) {
uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString strKey;
+ ByteString strKey;
strKey.Format("%u%u", dwHashCode, dwFontStyles);
auto it = m_FontMap.find(strKey);
if (it != m_FontMap.end())
return it->second;
- CFX_ByteString bsPsName =
- CFX_ByteString::FromUnicode(CFX_WideString(wsFontFamily));
+ ByteString bsPsName = ByteString::FromUnicode(WideString(wsFontFamily));
bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold;
bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic;
- CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic);
+ ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic);
CFX_RetainPtr<CFGAS_GEFont> pFont =
FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch);
if (pFont)
@@ -96,10 +95,9 @@
return pFont;
}
-CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
- const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic) {
+ByteString CXFA_PDFFontMgr::PsNameToFontName(const ByteString& strPsName,
+ bool bBold,
+ bool bItalic) {
for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) {
if (strPsName == g_XFAPDFFontName[i][0]) {
size_t index = 1;
@@ -113,12 +111,12 @@
return strPsName;
}
-bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName,
bool bBold,
bool bItalic,
- const CFX_ByteString& bsDRFontName,
+ const ByteString& bsDRFontName,
bool bStrictMatch) {
- CFX_ByteString bsDRName = bsDRFontName;
+ ByteString bsDRName = bsDRFontName;
bsDRName.Remove('-');
FX_STRSIZE iPsLen = bsPsName.GetLength();
auto nIndex = bsDRName.Find(bsPsName);
@@ -152,7 +150,7 @@
return false;
if (iDifferLength > 1) {
- CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength);
+ ByteString bsDRTailer = bsDRName.Right(iDifferLength);
if (bsDRTailer == "MT" || bsDRTailer == "PSMT" ||
bsDRTailer == "Regular" || bsDRTailer == "Reg") {
return true;
diff --git a/xfa/fxfa/cxfa_pdffontmgr.h b/xfa/fxfa/cxfa_pdffontmgr.h
index df8ab28..4c8941f 100644
--- a/xfa/fxfa/cxfa_pdffontmgr.h
+++ b/xfa/fxfa/cxfa_pdffontmgr.h
@@ -25,7 +25,7 @@
explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
~CXFA_PDFFontMgr();
- CFX_RetainPtr<CFGAS_GEFont> GetFont(const CFX_WideStringC& wsFontFamily,
+ CFX_RetainPtr<CFGAS_GEFont> GetFont(const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
CPDF_Font** pPDFFont,
bool bStrictMatch);
@@ -36,23 +36,23 @@
void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont);
private:
- CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_ByteString& strFamilyName,
+ CFX_RetainPtr<CFGAS_GEFont> FindFont(const ByteString& strFamilyName,
bool bBold,
bool bItalic,
CPDF_Font** pPDFFont,
bool bStrictMatch);
- CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic);
- bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+ ByteString PsNameToFontName(const ByteString& strPsName,
+ bool bBold,
+ bool bItalic);
+ bool PsNameMatchDRFontName(const ByteStringView& bsPsName,
bool bBold,
bool bItalic,
- const CFX_ByteString& bsDRFontName,
+ const ByteString& bsDRFontName,
bool bStrictMatch);
CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc;
std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont;
- std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
+ std::map<ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
};
#endif // XFA_FXFA_CXFA_PDFFONTMGR_H_
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 9c4e367..bbc61d4 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -79,7 +79,7 @@
pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (pXMLChild->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
- CFX_WideString wsTag = pXMLElement->GetLocalTagName();
+ WideString wsTag = pXMLElement->GetLocalTagName();
if (wsTag == L"body" || wsTag == L"html") {
pXMLContainer = pXMLChild;
break;
@@ -237,7 +237,7 @@
m_pBreak->SetCharSpace(pStyle->GetLetterSpacing().GetValue());
}
-int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) {
+int32_t CXFA_TextLayout::GetText(WideString& wsText) {
GetTextDataNode();
wsText.clear();
if (!m_bRichText)
@@ -676,7 +676,7 @@
}
}
- CFX_WideString wsText = pNode->GetContent();
+ WideString wsText = pNode->GetContent();
wsText.TrimRight(L" ");
bool bRet = AppendChar(wsText, fLinePos, fSpaceAbove, bSavePieces);
if (bRet && m_pLoader)
@@ -704,7 +704,7 @@
bool bContentNode = false;
float fSpaceBelow = 0;
CFX_RetainPtr<CFX_CSSComputedStyle> pStyle;
- CFX_WideString wsName;
+ WideString wsName;
if (bEndBreak) {
bool bCurOl = false;
bool bCurLi = false;
@@ -749,7 +749,7 @@
if (wsName == L"a") {
ASSERT(pElement);
- CFX_WideString wsLinkContent = pElement->GetString(L"href");
+ WideString wsLinkContent = pElement->GetString(L"href");
if (!wsLinkContent.IsEmpty()) {
pLinkData = pdfium::MakeRetain<CXFA_LinkUserData>(
wsLinkContent.GetBuffer(wsLinkContent.GetLength()));
@@ -761,7 +761,7 @@
bContentNode ? pParentStyle.Get() : pStyle.Get());
bool bSpaceRun = m_textParser.IsSpaceRun(
bContentNode ? pParentStyle.Get() : pStyle.Get());
- CFX_WideString wsText;
+ WideString wsText;
if (bContentNode && iTabCount == 0) {
wsText = static_cast<CFX_XMLText*>(pXMLNode)->GetText();
} else if (wsName == L"br") {
@@ -771,7 +771,7 @@
if (bIsOl)
wsText.Format(L"%d. ", iLiCount);
else
- wsText = 0x00B7 + CFX_WideStringC(L" ", 1);
+ wsText = 0x00B7 + WideStringView(L" ", 1);
} else if (!bContentNode) {
if (iTabCount > 0) {
while (iTabCount-- > 0)
@@ -874,7 +874,7 @@
return true;
}
-bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
+bool CXFA_TextLayout::AppendChar(const WideString& wsText,
float& fLinePos,
float fSpaceAbove,
bool bSavePieces) {
@@ -915,7 +915,7 @@
return false;
}
-void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
+void CXFA_TextLayout::ProcessText(WideString& wsText) {
int32_t iLen = wsText.GetLength();
if (iLen == 0)
return;
diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h
index 338d3be..50ee83f 100644
--- a/xfa/fxfa/cxfa_textlayout.h
+++ b/xfa/fxfa/cxfa_textlayout.h
@@ -33,7 +33,7 @@
explicit CXFA_TextLayout(CXFA_TextProvider* pTextProvider);
~CXFA_TextLayout();
- int32_t GetText(CFX_WideString& wsText);
+ int32_t GetText(WideString& wsText);
float GetLayoutHeight();
float StartLayout(float fWidth = -1);
bool DoLayout(int32_t iBlockIndex,
@@ -85,7 +85,7 @@
bool bEndBreak = true,
bool bIsOl = false,
int32_t iLiCount = 0);
- bool AppendChar(const CFX_WideString& wsText,
+ bool AppendChar(const WideString& wsText,
float& fLinePos,
float fSpaceAbove,
bool bSavePieces);
@@ -95,7 +95,7 @@
bool bEndBreak = false);
void EndBreak(CFX_BreakType dwStatus, float& fLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
- void ProcessText(CFX_WideString& wsText);
+ void ProcessText(WideString& wsText);
void UpdateAlign(float fHeight, float fBottom);
void RenderString(CFX_RenderDevice* pDevice,
CXFA_PieceLine* pPieceLine,
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 659ec9c..3c78a86 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -244,7 +244,7 @@
}
}
-bool CXFA_TextParser::TagValidate(const CFX_WideString& wsName) const {
+bool CXFA_TextParser::TagValidate(const WideString& wsName) const {
static const uint32_t s_XFATagName[] = {
0x61, // a
0x62, // b
@@ -263,21 +263,21 @@
static const int32_t s_iCount = FX_ArraySize(s_XFATagName);
return std::binary_search(s_XFATagName, s_XFATagName + s_iCount,
- FX_HashCode_GetW(wsName.AsStringC(), true));
+ FX_HashCode_GetW(wsName.AsStringView(), true));
}
std::unique_ptr<CXFA_TextParser::TagProvider> CXFA_TextParser::ParseTagInfo(
CFX_XMLNode* pXMLNode) {
auto tagProvider = pdfium::MakeUnique<TagProvider>();
- CFX_WideString wsName;
+ WideString wsName;
if (pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
wsName = pXMLElement->GetLocalTagName();
tagProvider->SetTagName(wsName);
tagProvider->m_bTagAvailable = TagValidate(wsName);
- CFX_WideString wsValue = pXMLElement->GetString(L"style");
+ WideString wsValue = pXMLElement->GetString(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
} else if (pXMLNode->GetType() == FX_XMLNODE_Text) {
@@ -293,21 +293,21 @@
}
float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const {
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue))
- return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt);
+ return CXFA_Measurement(wsValue.AsStringView()).ToUnit(XFA_UNIT_Pt);
return 36;
}
int32_t CXFA_TextParser::CountTabs(CFX_CSSComputedStyle* pStyle) const {
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"xfa-tab-count", wsValue))
return wsValue.GetInteger();
return 0;
}
bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const {
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"xfa-spacerun", wsValue)) {
wsValue.MakeLower();
return wsValue == L"yes";
@@ -318,7 +318,7 @@
CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_TextProvider* pTextProvider,
CFX_CSSComputedStyle* pStyle) const {
- CFX_WideStringC wsFamily = L"Courier";
+ WideStringView wsFamily = L"Courier";
uint32_t dwStyle = 0;
CXFA_Font font = pTextProvider->GetFontNode();
if (font) {
@@ -332,7 +332,7 @@
if (pStyle) {
int32_t iCount = pStyle->CountFontFamilies();
if (iCount > 0)
- wsFamily = pStyle->GetFontFamily(iCount - 1).AsStringC();
+ wsFamily = pStyle->GetFontFamily(iCount - 1).AsStringView();
dwStyle = 0;
if (pStyle->GetFontWeight() > FXFONT_FW_NORMAL)
@@ -361,7 +361,7 @@
CFX_CSSComputedStyle* pStyle,
CFX_XMLNode* pXMLNode) const {
if (pStyle) {
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", wsValue))
return wsValue.GetInteger();
@@ -387,7 +387,7 @@
int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
CFX_CSSComputedStyle* pStyle) const {
if (pStyle) {
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle->GetCustomStyle(L"xfa-font-vertical-scale", wsValue))
return wsValue.GetInteger();
}
@@ -418,7 +418,7 @@
else if (dwDecoration & CFX_CSSTEXTDECORATION_Underline)
iUnderline = 1;
- CFX_WideString wsValue;
+ WideString wsValue;
if (pStyle->GetCustomStyle(L"underlinePeriod", wsValue)) {
if (wsValue == L"word")
iPeriod = XFA_ATTRIBUTEENUM_Word;
@@ -487,7 +487,7 @@
bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CFX_XMLNode* pXMLNode,
- CFX_WideString& wsValue) {
+ WideString& wsValue) {
wsValue.clear();
if (!pXMLNode)
return false;
@@ -495,13 +495,13 @@
bool bRet = false;
if (pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLNode);
- CFX_WideString wsAttr = pElement->GetString(L"xfa:embed");
+ WideString wsAttr = pElement->GetString(L"xfa:embed");
if (wsAttr.IsEmpty())
return false;
if (wsAttr[0] == L'#')
wsAttr.Delete(0);
- CFX_WideString ws = pElement->GetString(L"xfa:embedType");
+ WideString ws = pElement->GetString(L"xfa:embedType");
if (ws.IsEmpty())
ws = L"som";
else
@@ -537,7 +537,7 @@
if (!pStyle || !pTabstopContext)
return false;
- CFX_WideString wsValue;
+ WideString wsValue;
if (!pStyle->GetCustomStyle(L"xfa-tab-stops", wsValue) &&
!pStyle->GetCustomStyle(L"tab-stops", wsValue)) {
return false;
@@ -547,7 +547,7 @@
const wchar_t* pTabStops = wsValue.c_str();
int32_t iCur = 0;
int32_t iLast = 0;
- CFX_WideString wsAlign;
+ WideString wsAlign;
TabStopStatus eStatus = TabStopStatus::None;
wchar_t ch;
while (iCur < iLength) {
@@ -563,7 +563,7 @@
break;
case TabStopStatus::Alignment:
if (ch == ' ') {
- wsAlign = CFX_WideStringC(pTabStops + iLast, iCur - iLast);
+ wsAlign = WideStringView(pTabStops + iLast, iCur - iLast);
eStatus = TabStopStatus::StartLeader;
iCur++;
while (iCur < iLength && pTabStops[iCur] <= ' ')
@@ -598,8 +598,8 @@
break;
case TabStopStatus::Location:
if (ch == ' ') {
- uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
- CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
+ uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true);
+ CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast));
float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
wsAlign.clear();
@@ -613,8 +613,8 @@
}
if (!wsAlign.IsEmpty()) {
- uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
- CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
+ uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true);
+ CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast));
float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
}
diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h
index 567aff0..ee5c38d 100644
--- a/xfa/fxfa/cxfa_textparser.h
+++ b/xfa/fxfa/cxfa_textparser.h
@@ -78,11 +78,11 @@
bool GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CFX_XMLNode* pXMLNode,
- CFX_WideString& wsValue);
+ WideString& wsValue);
CXFA_TextParseContext* GetParseContextFromMap(CFX_XMLNode* pXMLNode);
protected:
- bool TagValidate(const CFX_WideString& str) const;
+ bool TagValidate(const WideString& str) const;
private:
class TagProvider {
@@ -90,15 +90,14 @@
TagProvider();
~TagProvider();
- CFX_WideString GetTagName() { return m_wsTagName; }
+ WideString GetTagName() { return m_wsTagName; }
- void SetTagName(const CFX_WideString& wsName) { m_wsTagName = wsName; }
- void SetAttribute(const CFX_WideString& wsAttr,
- const CFX_WideString& wsValue) {
+ void SetTagName(const WideString& wsName) { m_wsTagName = wsName; }
+ void SetAttribute(const WideString& wsAttr, const WideString& wsValue) {
m_Attributes.insert({wsAttr, wsValue});
}
- CFX_WideString GetAttribute(const CFX_WideString& wsAttr) {
+ WideString GetAttribute(const WideString& wsAttr) {
return m_Attributes[wsAttr];
}
@@ -106,8 +105,8 @@
bool m_bContent;
private:
- CFX_WideString m_wsTagName;
- std::map<CFX_WideString, CFX_WideString> m_Attributes;
+ WideString m_wsTagName;
+ std::map<WideString, WideString> m_Attributes;
};
void InitCSSData(CXFA_TextProvider* pTextProvider);
diff --git a/xfa/fxfa/cxfa_textpiece.h b/xfa/fxfa/cxfa_textpiece.h
index a1f100c..4ea5a41 100644
--- a/xfa/fxfa/cxfa_textpiece.h
+++ b/xfa/fxfa/cxfa_textpiece.h
@@ -21,7 +21,7 @@
CXFA_TextPiece();
~CXFA_TextPiece();
- CFX_WideString szText;
+ WideString szText;
std::vector<int32_t> Widths;
int32_t iChars;
int32_t iHorScale;
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 16a2b58..9f1ecd5 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -43,7 +43,7 @@
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
+ WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (wsContentType == L"text/html")
bRichText = true;
@@ -80,7 +80,7 @@
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
+ WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (wsContentType == L"text/html")
bRichText = true;
@@ -95,7 +95,7 @@
CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNode) {
- CFX_WideStringC wsName;
+ WideStringView wsName;
pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover")
return pNode;
@@ -135,8 +135,8 @@
bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
bool bRaw,
- const CFX_WideString& wsAttr,
- CFX_WideString& wsValue) {
+ const WideString& wsAttr,
+ WideString& wsValue) {
if (m_eType != XFA_TEXTPROVIDERTYPE_Text)
return false;
@@ -149,11 +149,12 @@
CXFA_Node* pIDNode = nullptr;
CXFA_WidgetAcc* pEmbAcc = nullptr;
if (pParent)
- pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC());
+ pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView());
if (!pIDNode) {
pIDNode = pDocument->GetNodeByID(
- ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr.AsStringC());
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
+ wsAttr.AsStringView());
}
if (pIDNode)
pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData());
diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h
index 0772490..d648b94 100644
--- a/xfa/fxfa/cxfa_textprovider.h
+++ b/xfa/fxfa/cxfa_textprovider.h
@@ -39,8 +39,8 @@
CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); }
bool GetEmbbedObj(bool bURI,
bool bRaw,
- const CFX_WideString& wsAttr,
- CFX_WideString& wsValue);
+ const WideString& wsAttr,
+ WideString& wsValue);
private:
CXFA_WidgetAcc* m_pWidgetAcc;
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 972a95e..791b814 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -160,15 +160,15 @@
CXFA_WidgetAcc::~CXFA_WidgetAcc() {}
-bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) {
+bool CXFA_WidgetAcc::GetName(WideString& wsName, int32_t iNameType) {
if (iNameType == 0) {
m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
return !wsName.IsEmpty();
}
m_pNode->GetSOMExpression(wsName);
if (iNameType == 2 && wsName.GetLength() >= 15) {
- CFX_WideStringC wsPre = L"xfa[0].form[0].";
- if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength()))
+ WideStringView wsPre = L"xfa[0].form[0].";
+ if (wsPre == WideStringView(wsName.c_str(), wsPre.GetLength()))
wsName.Delete(0, wsPre.GetLength());
}
return true;
@@ -187,13 +187,13 @@
}
void CXFA_WidgetAcc::ResetData() {
- CFX_WideString wsValue;
+ WideString wsValue;
XFA_Element eUIType = GetUIType();
switch (eUIType) {
case XFA_Element::ImageEdit: {
CXFA_Value imageValue = GetDefaultValue();
CXFA_Image image = imageValue.GetImage();
- CFX_WideString wsContentType, wsHref;
+ WideString wsContentType, wsHref;
if (image) {
image.GetContent(wsValue);
image.GetContentType(wsContentType);
@@ -222,7 +222,7 @@
if (!pItems)
continue;
- CFX_WideString itemText;
+ WideString itemText;
if (pItems->CountChildren(XFA_Element::Unknown) > 1)
itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
@@ -244,15 +244,15 @@
}
}
-void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
- const CFX_WideString& wsHref,
- const CFX_WideString& wsData) {
+void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType,
+ const WideString& wsHref,
+ const WideString& wsData) {
CXFA_Image image = GetFormValue().GetImage();
if (image) {
- image.SetContentType(CFX_WideString(wsContentType));
+ image.SetContentType(WideString(wsContentType));
image.SetHref(wsHref);
}
- CFX_WideString wsFormatValue(wsData);
+ WideString wsFormatValue(wsData);
GetFormatDataValue(wsData, wsFormatValue);
m_pNode->SetContent(wsData, wsFormatValue, true);
CXFA_Node* pBind = GetDatasets();
@@ -367,8 +367,8 @@
if (!pAppProvider) {
return;
}
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- CFX_WideString wsScriptMsg;
+ WideString wsTitle = pAppProvider->GetAppTitle();
+ WideString wsScriptMsg;
validate.GetScriptMessageText(wsScriptMsg);
int32_t eScriptTest = validate.GetScriptTest();
if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) {
@@ -397,9 +397,9 @@
int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
bool bVersionFlag) {
- CFX_WideString wsRawValue = GetRawValue();
+ WideString wsRawValue = GetRawValue();
if (!wsRawValue.IsEmpty()) {
- CFX_WideString wsPicture;
+ WideString wsPicture;
validate.GetPicture(wsPicture);
if (wsPicture.IsEmpty())
return XFA_EVENTERROR_NotExist;
@@ -415,9 +415,9 @@
if (!pAppProvider)
return XFA_EVENTERROR_NotExist;
- CFX_WideString wsFormatMsg;
+ WideString wsFormatMsg;
validate.GetFormatMessageText(wsFormatMsg);
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
+ WideString wsTitle = pAppProvider->GetAppTitle();
int32_t eFormatTest = validate.GetFormatTest();
if (eFormatTest == XFA_ATTRIBUTEENUM_Error) {
if (wsFormatMsg.IsEmpty())
@@ -448,7 +448,7 @@
int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
int32_t iFlags,
bool bVersionFlag) {
- CFX_WideString wsValue;
+ WideString wsValue;
GetValue(wsValue, XFA_VALUEPICTURE_Raw);
if (!wsValue.IsEmpty())
return XFA_EVENTERROR_Success;
@@ -456,7 +456,7 @@
return XFA_EVENTERROR_Success;
int32_t eNullTest = validate.GetNullTest();
- CFX_WideString wsNullMsg;
+ WideString wsNullMsg;
validate.GetNullMessageText(wsNullMsg);
if (iFlags & 0x01) {
int32_t iRet = XFA_EVENTERROR_Success;
@@ -480,8 +480,8 @@
if (!pAppProvider)
return XFA_EVENTERROR_NotExist;
- CFX_WideString wsCaptionName;
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
+ WideString wsCaptionName;
+ WideString wsTitle = pAppProvider->GetAppTitle();
switch (eNullTest) {
case XFA_ATTRIBUTEENUM_Error: {
if (wsNullMsg.IsEmpty()) {
@@ -514,8 +514,8 @@
return XFA_EVENTERROR_Success;
}
-CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
- CFX_WideString wsCaptionName;
+WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
+ WideString wsCaptionName;
if (!bVersionFlag) {
if (CXFA_Caption caption = GetCaption()) {
@@ -531,10 +531,9 @@
return wsCaptionName;
}
-CFX_WideString CXFA_WidgetAcc::GetValidateMessage(bool bError,
- bool bVersionFlag) {
- CFX_WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
- CFX_WideString wsMessage;
+WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, bool bVersionFlag) {
+ WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
+ WideString wsMessage;
if (bVersionFlag) {
wsMessage.Format(L"%s validation failed", wsCaptionName.c_str());
return wsMessage;
@@ -609,7 +608,7 @@
if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server)
return XFA_EVENTERROR_Disabled;
- CFX_WideString wsExpression;
+ WideString wsExpression;
script.GetExpression(wsExpression);
if (wsExpression.IsEmpty())
return XFA_EVENTERROR_NotExist;
@@ -630,8 +629,8 @@
auto pTmpRetValue = pdfium::MakeUnique<CFXJSE_Value>(pContext->GetRuntime());
++m_nRecursionDepth;
bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
- wsExpression.AsStringC(), pTmpRetValue.get(),
- m_pNode);
+ wsExpression.AsStringView(),
+ pTmpRetValue.get(), m_pNode);
--m_nRecursionDepth;
int32_t iRet = XFA_EVENTERROR_Error;
if (bRet) {
@@ -820,7 +819,7 @@
void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
float fFontSize = GetFontSize();
- CFX_WideString wsText;
+ WideString wsText;
GetValue(wsText, XFA_VALUEPICTURE_Display);
if (wsText.IsEmpty()) {
size.height += fFontSize;
@@ -1218,7 +1217,7 @@
static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
int32_t iLinesCount = 0;
float fHeight = m_pLayoutData->m_fWidgetHeight;
- CFX_WideString wsText;
+ WideString wsText;
GetValue(wsText, XFA_VALUEPICTURE_Display);
if (wsText.IsEmpty()) {
iLinesCount = 1;
@@ -1495,7 +1494,7 @@
}
CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
- CFX_WideStringC wsFontName = L"Courier";
+ WideStringView wsFontName = L"Courier";
uint32_t dwFontStyle = 0;
if (CXFA_Font font = GetFont(false)) {
if (font.IsBold())
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index 38b17ef..54fd360 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -37,13 +37,13 @@
CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode);
~CXFA_WidgetAcc();
- bool GetName(CFX_WideString& wsName, int32_t iNameType = 0);
+ bool GetName(WideString& wsName, int32_t iNameType = 0);
bool ProcessValueChanged();
void ResetData();
- void SetImageEdit(const CFX_WideString& wsContentType,
- const CFX_WideString& wsHref,
- const CFX_WideString& wsData);
+ void SetImageEdit(const WideString& wsContentType,
+ const WideString& wsHref,
+ const WideString& wsData);
CXFA_WidgetAcc* GetExclGroup();
CXFA_FFDocView* GetDocView();
@@ -92,8 +92,8 @@
int32_t ProcessNullTestValidate(CXFA_Validate validate,
int32_t iFlags,
bool bVersionFlag);
- CFX_WideString GetValidateCaptionName(bool bVersionFlag);
- CFX_WideString GetValidateMessage(bool bError, bool bVersionFlag);
+ WideString GetValidateCaptionName(bool bVersionFlag);
+ WideString GetValidateMessage(bool bError, bool bVersionFlag);
void CalcCaptionSize(CFX_SizeF& szCap);
bool CalculateFieldAutoSize(CFX_SizeF& size);
bool CalculateWidgetAutoSize(CFX_SizeF& size);
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index f49d98a..6af7bb7 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -338,8 +338,8 @@
static_assert(FX_ArraySize(g_sAltTable_Time) == L'a' - L'A' + 1,
"Invalid g_sAltTable_Time size.");
-void AlternateDateTimeSymbols(CFX_WideString& wsPattern,
- const CFX_WideString& wsAltSymbols,
+void AlternateDateTimeSymbols(WideString& wsPattern,
+ const WideString& wsAltSymbols,
const uint8_t* pAltTable) {
int32_t nLength = wsPattern.GetLength();
bool bInConstRange = false;
@@ -368,9 +368,8 @@
}
}
-bool PatternStringType(const CFX_ByteStringC& szPattern,
- uint32_t& patternType) {
- CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern);
+bool PatternStringType(const ByteStringView& szPattern, uint32_t& patternType) {
+ WideString wsPattern = WideString::FromUTF8(szPattern);
if (L"datetime" == wsPattern.Left(8)) {
patternType = XFA_VT_DATETIME;
return true;
@@ -474,19 +473,19 @@
IFX_Locale* LocaleFromString(CXFA_Document* pDoc,
CXFA_LocaleMgr* pMgr,
- const CFX_ByteStringC& szLocale) {
+ const ByteStringView& szLocale) {
if (!szLocale.IsEmpty())
- return pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
+ return pMgr->GetLocaleByName(WideString::FromUTF8(szLocale));
CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
ASSERT(pThisNode);
return CXFA_WidgetData(pThisNode).GetLocal();
}
-CFX_WideString FormatFromString(IFX_Locale* pLocale,
- const CFX_ByteStringC& szFormat) {
+WideString FormatFromString(IFX_Locale* pLocale,
+ const ByteStringView& szFormat) {
if (!szFormat.IsEmpty())
- return CFX_WideString::FromUTF8(szFormat);
+ return WideString::FromUTF8(szFormat);
return pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default);
}
@@ -514,12 +513,12 @@
return std::iswdigit(ch) || ch == L'-' || ch == L'.';
}
-CFX_ByteString GUIDString(bool bSeparator) {
+ByteString GUIDString(bool bSeparator) {
uint8_t data[16];
FX_Random_GenerateMT(reinterpret_cast<uint32_t*>(data), 4);
data[6] = (data[6] & 0x0F) | 0x40;
- CFX_ByteString bsStr;
+ ByteString bsStr;
char* pBuf = bsStr.GetBuffer(40);
for (int32_t i = 0; i < 16; ++i, pBuf += 2) {
if (bSeparator && (i == 4 || i == 6 || i == 8 || i == 10))
@@ -535,7 +534,7 @@
// static
void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Abs");
@@ -557,7 +556,7 @@
// static
void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1) {
@@ -604,7 +603,7 @@
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -624,7 +623,7 @@
// static
void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ceil");
@@ -642,7 +641,7 @@
// static
void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -678,7 +677,7 @@
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
iCount += newPropertyValue->IsNull() ? 0 : 1;
}
}
@@ -696,7 +695,7 @@
// static
void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Floor");
@@ -714,7 +713,7 @@
// static
void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -754,7 +753,7 @@
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -788,7 +787,7 @@
// static
void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -828,7 +827,7 @@
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -862,7 +861,7 @@
// static
void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 2) {
@@ -897,7 +896,7 @@
// static
void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
int32_t argc = args.GetLength();
@@ -943,7 +942,7 @@
// static
void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc == 0) {
@@ -987,7 +986,7 @@
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -1018,7 +1017,7 @@
// static
void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 0) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Date");
@@ -1029,20 +1028,21 @@
time(¤tTime);
struct tm* pTmStruct = gmtime(¤tTime);
- CFX_ByteString bufferYear;
- CFX_ByteString bufferMon;
- CFX_ByteString bufferDay;
+ ByteString bufferYear;
+ ByteString bufferMon;
+ ByteString bufferDay;
bufferYear.Format("%d", pTmStruct->tm_year + 1900);
bufferMon.Format("%02d", pTmStruct->tm_mon + 1);
bufferDay.Format("%02d", pTmStruct->tm_mday);
- CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay;
- args.GetReturnValue()->SetInteger(DateString2Num(bufferCurrent.AsStringC()));
+ ByteString bufferCurrent = bufferYear + bufferMon + bufferDay;
+ args.GetReturnValue()->SetInteger(
+ DateString2Num(bufferCurrent.AsStringView()));
}
// static
void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -1056,8 +1056,8 @@
return;
}
- CFX_ByteString dateString = ValueToUTF8String(dateValue.get());
- CFX_ByteString formatString;
+ ByteString dateString = ValueToUTF8String(dateValue.get());
+ ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
if (ValueIsNull(pThis, formatValue.get())) {
@@ -1067,7 +1067,7 @@
formatString = ValueToUTF8String(formatValue.get());
}
- CFX_ByteString localString;
+ ByteString localString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2);
if (ValueIsNull(pThis, localValue.get())) {
@@ -1077,16 +1077,16 @@
localString = ValueToUTF8String(localValue.get());
}
- CFX_ByteString szIsoDateString =
- Local2IsoDate(pThis, dateString.AsStringC(), formatString.AsStringC(),
- localString.AsStringC());
+ ByteString szIsoDateString =
+ Local2IsoDate(pThis, dateString.AsStringView(),
+ formatString.AsStringView(), localString.AsStringView());
args.GetReturnValue()->SetInteger(
- DateString2Num(szIsoDateString.AsStringC()));
+ DateString2Num(szIsoDateString.AsStringView()));
}
// static
void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc > 2) {
@@ -1107,7 +1107,7 @@
iStyle = 0;
}
- CFX_ByteString szLocal;
+ ByteString szLocal;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1);
if (argLocal->IsNull()) {
@@ -1117,14 +1117,14 @@
szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr =
- GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC());
- args.GetReturnValue()->SetString(formatStr.AsStringC());
+ ByteString formatStr =
+ GetStandardDateFormat(pThis, iStyle, szLocal.AsStringView());
+ args.GetReturnValue()->SetString(formatStr.AsStringView());
}
// static
void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)
@@ -1136,13 +1136,13 @@
args.GetReturnValue()->SetNull();
return;
}
- CFX_ByteString szArgString = ValueToUTF8String(argOne.get());
- args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringC()));
+ ByteString szArgString = ValueToUTF8String(argOne.get());
+ args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringView()));
}
// static
void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -1158,7 +1158,7 @@
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- CFX_ByteString szArgString = ValueToUTF8String(argOne.get());
+ ByteString szArgString = ValueToUTF8String(argOne.get());
auto pos = szArgString.Find('T', 0);
if (!pos.has_value() || pos.value() == szArgString.GetLength() - 1) {
args.GetReturnValue()->SetInteger(0);
@@ -1167,7 +1167,7 @@
szArgString = szArgString.Right(szArgString.GetLength() - (pos.value() + 1));
CXFA_LocaleValue timeValue(
- XFA_VT_TIME, CFX_WideString::FromUTF8(szArgString.AsStringC()), pMgr);
+ XFA_VT_TIME, WideString::FromUTF8(szArgString.AsStringView()), pMgr);
if (!timeValue.IsValid()) {
args.GetReturnValue()->SetInteger(0);
return;
@@ -1196,7 +1196,7 @@
// static
void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc > 2) {
@@ -1217,7 +1217,7 @@
iStyle = 0;
}
- CFX_ByteString szLocal;
+ ByteString szLocal;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1);
if (argLocal->IsNull()) {
@@ -1227,14 +1227,14 @@
szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr =
- GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), false);
- args.GetReturnValue()->SetString(formatStr.AsStringC());
+ ByteString formatStr =
+ GetLocalDateFormat(pThis, iStyle, szLocal.AsStringView(), false);
+ args.GetReturnValue()->SetString(formatStr.AsStringView());
}
// static
void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc > 2) {
@@ -1255,7 +1255,7 @@
iStyle = 0;
}
- CFX_ByteString szLocal;
+ ByteString szLocal;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1);
if (argLocal->IsNull()) {
@@ -1265,14 +1265,14 @@
szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr =
- GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), false);
- args.GetReturnValue()->SetString(formatStr.AsStringC());
+ ByteString formatStr =
+ GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringView(), false);
+ args.GetReturnValue()->SetString(formatStr.AsStringView());
}
// static
void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -1291,7 +1291,7 @@
return;
}
- CFX_ByteString formatString;
+ ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
if (ValueIsNull(pThis, formatValue.get())) {
@@ -1301,7 +1301,7 @@
formatString = ValueToUTF8String(formatValue.get());
}
- CFX_ByteString localString;
+ ByteString localString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2);
if (ValueIsNull(pThis, localValue.get())) {
@@ -1403,17 +1403,17 @@
}
}
- CFX_ByteString szIsoDateString;
+ ByteString szIsoDateString;
szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay);
- CFX_ByteString szLocalDateString =
- IsoDate2Local(pThis, szIsoDateString.AsStringC(),
- formatString.AsStringC(), localString.AsStringC());
- args.GetReturnValue()->SetString(szLocalDateString.AsStringC());
+ ByteString szLocalDateString =
+ IsoDate2Local(pThis, szIsoDateString.AsStringView(),
+ formatString.AsStringView(), localString.AsStringView());
+ args.GetReturnValue()->SetString(szLocalDateString.AsStringView());
}
// static
void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -1433,7 +1433,7 @@
return;
}
- CFX_ByteString formatString;
+ ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
if (formatValue->IsNull()) {
@@ -1443,7 +1443,7 @@
formatString = ValueToUTF8String(formatValue.get());
}
- CFX_ByteString localString;
+ ByteString localString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2);
if (localValue->IsNull()) {
@@ -1453,14 +1453,15 @@
localString = ValueToUTF8String(localValue.get());
}
- CFX_ByteString szGMTTimeString = Num2AllTime(
- pThis, iTime, formatString.AsStringC(), localString.AsStringC(), true);
- args.GetReturnValue()->SetString(szGMTTimeString.AsStringC());
+ ByteString szGMTTimeString =
+ Num2AllTime(pThis, iTime, formatString.AsStringView(),
+ localString.AsStringView(), true);
+ args.GetReturnValue()->SetString(szGMTTimeString.AsStringView());
}
// static
void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -1479,7 +1480,7 @@
return;
}
- CFX_ByteString formatString;
+ ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
if (formatValue->IsNull()) {
@@ -1489,7 +1490,7 @@
formatString = ValueToUTF8String(formatValue.get());
}
- CFX_ByteString localString;
+ ByteString localString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2);
if (localValue->IsNull()) {
@@ -1499,15 +1500,15 @@
localString = ValueToUTF8String(localValue.get());
}
- CFX_ByteString szLocalTimeString =
- Num2AllTime(pThis, static_cast<int32_t>(fTime), formatString.AsStringC(),
- localString.AsStringC(), false);
- args.GetReturnValue()->SetString(szLocalTimeString.AsStringC());
+ ByteString szLocalTimeString = Num2AllTime(pThis, static_cast<int32_t>(fTime),
+ formatString.AsStringView(),
+ localString.AsStringView(), false);
+ args.GetReturnValue()->SetString(szLocalTimeString.AsStringView());
}
// static
void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 0) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Time");
@@ -1524,7 +1525,7 @@
// static
void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -1532,7 +1533,7 @@
return;
}
- CFX_ByteString timeString;
+ ByteString timeString;
std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0);
if (ValueIsNull(pThis, timeValue.get())) {
args.GetReturnValue()->SetNull();
@@ -1540,7 +1541,7 @@
}
timeString = ValueToUTF8String(timeValue.get());
- CFX_ByteString formatString;
+ ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
if (ValueIsNull(pThis, formatValue.get())) {
@@ -1550,7 +1551,7 @@
formatString = ValueToUTF8String(formatValue.get());
}
- CFX_ByteString localString;
+ ByteString localString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2);
if (ValueIsNull(pThis, localValue.get())) {
@@ -1569,19 +1570,19 @@
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
- pLocale = pMgr->GetLocaleByName(
- CFX_WideString::FromUTF8(localString.AsStringC()));
+ pLocale =
+ pMgr->GetLocaleByName(WideString::FromUTF8(localString.AsStringView()));
}
- CFX_WideString wsFormat;
+ WideString wsFormat;
if (formatString.IsEmpty())
wsFormat = pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default);
else
- wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC());
+ wsFormat = WideString::FromUTF8(formatString.AsStringView());
wsFormat = L"time{" + wsFormat + L"}";
CXFA_LocaleValue localeValue(XFA_VT_TIME,
- CFX_WideString::FromUTF8(timeString.AsStringC()),
+ WideString::FromUTF8(timeString.AsStringView()),
wsFormat, pLocale, pMgr);
if (!localeValue.IsValid()) {
args.GetReturnValue()->SetInteger(0);
@@ -1610,7 +1611,7 @@
// static
void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc > 2) {
@@ -1630,7 +1631,7 @@
iStyle = 0;
}
- CFX_ByteString szLocal;
+ ByteString szLocal;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1);
if (argLocal->IsNull()) {
@@ -1640,9 +1641,9 @@
szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr =
- GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC());
- args.GetReturnValue()->SetString(formatStr.AsStringC());
+ ByteString formatStr =
+ GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringView());
+ args.GetReturnValue()->SetString(formatStr.AsStringView());
}
// static
@@ -1913,80 +1914,75 @@
}
// static
-CFX_ByteString CXFA_FM2JSContext::Local2IsoDate(
- CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale) {
+ByteString CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis,
+ const ByteStringView& szDate,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return CFX_ByteString();
+ return ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return CFX_ByteString();
+ return ByteString();
- CFX_WideString wsFormat = FormatFromString(pLocale, szFormat);
- CFX_DateTime dt =
- CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), wsFormat,
- pLocale, pMgr)
- .GetDate();
+ WideString wsFormat = FormatFromString(pLocale, szFormat);
+ CFX_DateTime dt = CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(szDate),
+ wsFormat, pLocale, pMgr)
+ .GetDate();
- CFX_ByteString strIsoDate;
+ ByteString strIsoDate;
strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay());
return strIsoDate;
}
// static
-CFX_ByteString CXFA_FM2JSContext::IsoDate2Local(
- CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale) {
+ByteString CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis,
+ const ByteStringView& szDate,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return CFX_ByteString();
+ return ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return CFX_ByteString();
+ return ByteString();
- CFX_WideString wsFormat = FormatFromString(pLocale, szFormat);
- CFX_WideString wsRet;
- CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), pMgr)
+ WideString wsFormat = FormatFromString(pLocale, szFormat);
+ WideString wsRet;
+ CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(szDate), pMgr)
.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display);
return wsRet.UTF8Encode();
}
// static
-CFX_ByteString CXFA_FM2JSContext::IsoTime2Local(
- CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale) {
+ByteString CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis,
+ const ByteStringView& szTime,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return CFX_ByteString();
+ return ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return CFX_ByteString();
+ return ByteString();
- CFX_WideString wsFormat = {
- L"time{", FormatFromString(pLocale, szFormat).AsStringC(), L"}"};
- CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime),
- pMgr);
- CFX_WideString wsRet;
+ WideString wsFormat = {
+ L"time{", FormatFromString(pLocale, szFormat).AsStringView(), L"}"};
+ CXFA_LocaleValue widgetValue(XFA_VT_TIME, WideString::FromUTF8(szTime), pMgr);
+ WideString wsRet;
widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
XFA_VALUEPICTURE_Display);
return wsRet.UTF8Encode();
}
// static
-int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) {
+int32_t CXFA_FM2JSContext::DateString2Num(const ByteStringView& szDateString) {
int32_t iLength = szDateString.GetLength();
int32_t iYear = 0;
int32_t iMonth = 0;
@@ -2043,21 +2039,20 @@
}
// static
-CFX_ByteString CXFA_FM2JSContext::GetLocalDateFormat(
- CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocale,
- bool bStandard) {
+ByteString CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocale,
+ bool bStandard) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return CFX_ByteString();
+ return ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return CFX_ByteString();
+ return ByteString();
- CFX_WideString strRet = pLocale->GetDatePattern(SubCategoryFromInt(iStyle));
+ WideString strRet = pLocale->GetDatePattern(SubCategoryFromInt(iStyle));
if (!bStandard) {
AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(),
g_sAltTable_Date);
@@ -2066,21 +2061,20 @@
}
// static
-CFX_ByteString CXFA_FM2JSContext::GetLocalTimeFormat(
- CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocale,
- bool bStandard) {
+ByteString CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocale,
+ bool bStandard) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return CFX_ByteString();
+ return ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return CFX_ByteString();
+ return ByteString();
- CFX_WideString strRet = pLocale->GetTimePattern(SubCategoryFromInt(iStyle));
+ WideString strRet = pLocale->GetTimePattern(SubCategoryFromInt(iStyle));
if (!bStandard) {
AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(),
g_sAltTable_Time);
@@ -2089,27 +2083,27 @@
}
// static
-CFX_ByteString CXFA_FM2JSContext::GetStandardDateFormat(
+ByteString CXFA_FM2JSContext::GetStandardDateFormat(
CFXJSE_Value* pThis,
int32_t iStyle,
- const CFX_ByteStringC& szLocalStr) {
+ const ByteStringView& szLocalStr) {
return GetLocalDateFormat(pThis, iStyle, szLocalStr, true);
}
// static
-CFX_ByteString CXFA_FM2JSContext::GetStandardTimeFormat(
+ByteString CXFA_FM2JSContext::GetStandardTimeFormat(
CFXJSE_Value* pThis,
int32_t iStyle,
- const CFX_ByteStringC& szLocalStr) {
+ const ByteStringView& szLocalStr) {
return GetLocalTimeFormat(pThis, iStyle, szLocalStr, true);
}
// static
-CFX_ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis,
- int32_t iTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- bool bGM) {
+ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis,
+ int32_t iTime,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale,
+ bool bGM) {
int32_t iHour = 0;
int32_t iMin = 0;
int32_t iSec = 0;
@@ -2127,9 +2121,9 @@
iSec += iZoneSec;
}
- CFX_ByteString strIsoTime;
+ ByteString strIsoTime;
strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec);
- return IsoTime2Local(pThis, strIsoTime.AsStringC(), szFormat, szLocale);
+ return IsoTime2Local(pThis, strIsoTime.AsStringView(), szFormat, szLocale);
}
// static
@@ -2148,7 +2142,7 @@
// static
void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2201,7 +2195,7 @@
// static
void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2232,7 +2226,7 @@
// static
void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2273,7 +2267,7 @@
// static
void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 5) {
@@ -2330,7 +2324,7 @@
// static
void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
int32_t argc = args.GetLength();
@@ -2373,7 +2367,7 @@
// static
void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2408,7 +2402,7 @@
// static
void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 5) {
@@ -2466,7 +2460,7 @@
// static
void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2501,7 +2495,7 @@
// static
void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2532,7 +2526,7 @@
// static
void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 3) {
@@ -2563,7 +2557,7 @@
// static
void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
int32_t argc = args.GetLength();
@@ -2610,17 +2604,17 @@
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
} else {
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(), newPropertyValue.get());
+ propertyValue->ToString().AsStringView(), newPropertyValue.get());
}
- CFX_ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
- args.GetReturnValue()->SetString(bsChosen.AsStringC());
+ ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
+ args.GetReturnValue()->SetString(bsChosen.AsStringView());
bFound = true;
}
} else {
iValueIndex++;
if (iValueIndex == iIndex) {
- CFX_ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
- args.GetReturnValue()->SetString(bsChosen.AsStringC());
+ ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
+ args.GetReturnValue()->SetString(bsChosen.AsStringView());
bFound = true;
}
}
@@ -2632,7 +2626,7 @@
// static
void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Exists");
@@ -2643,7 +2637,7 @@
// static
void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"HasValue");
@@ -2657,14 +2651,14 @@
return;
}
- CFX_ByteString valueStr = argOne->ToString();
+ ByteString valueStr = argOne->ToString();
valueStr.TrimLeft();
args.GetReturnValue()->SetInteger(!valueStr.IsEmpty());
}
// static
void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() < 2) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Oneof");
@@ -2687,7 +2681,7 @@
// static
void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 3) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Within");
@@ -2711,17 +2705,17 @@
return;
}
- CFX_ByteString oneString = ValueToUTF8String(argOne.get());
- CFX_ByteString lowString = ValueToUTF8String(argLow.get());
- CFX_ByteString heightString = ValueToUTF8String(argHigh.get());
+ ByteString oneString = ValueToUTF8String(argOne.get());
+ ByteString lowString = ValueToUTF8String(argLow.get());
+ ByteString heightString = ValueToUTF8String(argHigh.get());
args.GetReturnValue()->SetInteger(
- (oneString.Compare(lowString.AsStringC()) >= 0) &&
- (oneString.Compare(heightString.AsStringC()) <= 0));
+ (oneString.Compare(lowString.AsStringView()) >= 0) &&
+ (oneString.Compare(heightString.AsStringView()) <= 0));
}
// static
void CXFA_FM2JSContext::If(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 3) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"If");
@@ -2735,7 +2729,7 @@
// static
void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -2745,7 +2739,7 @@
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0);
- CFX_ByteString utf8ScriptString = ValueToUTF8String(scriptValue.get());
+ ByteString utf8ScriptString = ValueToUTF8String(scriptValue.get());
if (utf8ScriptString.IsEmpty()) {
args.GetReturnValue()->SetNull();
return;
@@ -2753,7 +2747,7 @@
CFX_WideTextBuf wsJavaScriptBuf;
if (!CXFA_FM2JSContext::Translate(
- CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(),
+ WideString::FromUTF8(utf8ScriptString.AsStringView()).AsStringView(),
&wsJavaScriptBuf)) {
pContext->ThrowCompilerErrorException();
return;
@@ -2763,15 +2757,15 @@
CFXJSE_Context::Create(pIsolate, nullptr, nullptr));
auto returnValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- pNewContext->ExecuteScript(FX_UTF8Encode(wsJavaScriptBuf.AsStringC()).c_str(),
- returnValue.get());
+ pNewContext->ExecuteScript(
+ FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).c_str(), returnValue.get());
args.GetReturnValue()->Assign(returnValue.get());
}
// static
void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -2829,7 +2823,7 @@
// static
void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"UnitType");
@@ -2842,7 +2836,7 @@
return;
}
- CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
+ ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
if (unitspanString.IsEmpty()) {
args.GetReturnValue()->SetString("in");
return;
@@ -2860,8 +2854,7 @@
VALUETYPE_ISIN,
};
unitspanString.MakeLower();
- CFX_WideString wsTypeString =
- CFX_WideString::FromUTF8(unitspanString.AsStringC());
+ WideString wsTypeString = WideString::FromUTF8(unitspanString.AsStringView());
const wchar_t* pData = wsTypeString.c_str();
int32_t u = 0;
int32_t uLen = wsTypeString.GetLength();
@@ -2937,7 +2930,7 @@
// static
void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 2) {
@@ -2951,7 +2944,7 @@
return;
}
- CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
+ ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
const char* pData = unitspanString.c_str();
if (!pData) {
args.GetReturnValue()->SetInteger(0);
@@ -2974,7 +2967,7 @@
++u;
FX_STRSIZE uLen = unitspanString.GetLength();
- CFX_ByteString strFirstUnit;
+ ByteString strFirstUnit;
while (u < uLen) {
if (pData[u] == ' ')
break;
@@ -2984,10 +2977,10 @@
}
strFirstUnit.MakeLower();
- CFX_ByteString strUnit;
+ ByteString strUnit;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1);
- CFX_ByteString unitTempString = ValueToUTF8String(unitValue.get());
+ ByteString unitTempString = ValueToUTF8String(unitValue.get());
const char* pChar = unitTempString.c_str();
FX_STRSIZE uVal = 0;
while (IsWhitespace(pChar[uVal]))
@@ -3076,7 +3069,7 @@
// static
void CXFA_FM2JSContext::At(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"At");
@@ -3090,20 +3083,20 @@
return;
}
- CFX_ByteString stringTwo = ValueToUTF8String(argTwo.get());
+ ByteString stringTwo = ValueToUTF8String(argTwo.get());
if (stringTwo.IsEmpty()) {
args.GetReturnValue()->SetInteger(1);
return;
}
- CFX_ByteString stringOne = ValueToUTF8String(argOne.get());
- auto pos = stringOne.Find(stringTwo.AsStringC());
+ ByteString stringOne = ValueToUTF8String(argOne.get());
+ auto pos = stringOne.Find(stringTwo.AsStringView());
args.GetReturnValue()->SetInteger(pos.has_value() ? pos.value() + 1 : 0);
}
// static
void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1) {
@@ -3111,7 +3104,7 @@
return;
}
- CFX_ByteString resultString;
+ ByteString resultString;
bool bAllNull = true;
for (int32_t i = 0; i < argc; i++) {
std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, args, i);
@@ -3127,12 +3120,12 @@
return;
}
- args.GetReturnValue()->SetString(resultString.AsStringC());
+ args.GetReturnValue()->SetString(resultString.AsStringView());
}
// static
void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 2) {
@@ -3147,11 +3140,11 @@
return;
}
- CFX_WideString decoded = DecodeURL(
- CFX_WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringC()));
+ WideString decoded = DecodeURL(
+ WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringView()));
args.GetReturnValue()->SetString(
- FX_UTF8Encode(decoded.AsStringC()).AsStringC());
+ FX_UTF8Encode(decoded.AsStringView()).AsStringView());
return;
}
@@ -3162,12 +3155,12 @@
return;
}
- CFX_ByteString toDecodeString = ValueToUTF8String(argOne.get());
- CFX_ByteString identifyString = ValueToUTF8String(argTwo.get());
- CFX_WideString decoded;
+ ByteString toDecodeString = ValueToUTF8String(argOne.get());
+ ByteString identifyString = ValueToUTF8String(argTwo.get());
+ WideString decoded;
- CFX_WideString toDecodeWideString =
- CFX_WideString::FromUTF8(toDecodeString.AsStringC());
+ WideString toDecodeWideString =
+ WideString::FromUTF8(toDecodeString.AsStringView());
if (identifyString.EqualNoCase("html"))
decoded = DecodeHTML(toDecodeWideString);
@@ -3177,11 +3170,11 @@
decoded = DecodeURL(toDecodeWideString);
args.GetReturnValue()->SetString(
- FX_UTF8Encode(decoded.AsStringC()).AsStringC());
+ FX_UTF8Encode(decoded.AsStringView()).AsStringView());
}
// static
-CFX_WideString CXFA_FM2JSContext::DecodeURL(const CFX_WideString& wsURLString) {
+WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) {
const wchar_t* pData = wsURLString.c_str();
FX_STRSIZE i = 0;
CFX_WideTextBuf wsResultBuf;
@@ -3206,7 +3199,7 @@
} else if (ch <= 'f' && ch >= 'a') {
chTemp += (ch - 'a' + 10) * (!iCount ? 16 : 1);
} else {
- return CFX_WideString();
+ return WideString();
}
++iCount;
}
@@ -3218,8 +3211,7 @@
}
// static
-CFX_WideString CXFA_FM2JSContext::DecodeHTML(
- const CFX_WideString& wsHTMLString) {
+WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) {
wchar_t strString[9];
FX_STRSIZE iStrIndex = 0;
FX_STRSIZE iLen = wsHTMLString.GetLength();
@@ -3241,7 +3233,7 @@
++i;
ch = pData[i];
if (ch != 'x' && ch != 'X') {
- return CFX_WideString();
+ return WideString();
}
++i;
@@ -3256,7 +3248,7 @@
} else if (ch <= 'F' && ch >= 'A') {
iCode += ch - 'A' + 10;
} else {
- return CFX_WideString();
+ return WideString();
}
++i;
// TODO(dsinclair): Postmultiply seems wrong, start at zero
@@ -3290,7 +3282,7 @@
}
// static
-CFX_WideString CXFA_FM2JSContext::DecodeXML(const CFX_WideString& wsXMLString) {
+WideString CXFA_FM2JSContext::DecodeXML(const WideString& wsXMLString) {
wchar_t strString[9];
int32_t iStrIndex = 0;
int32_t iLen = wsXMLString.GetLength();
@@ -3315,7 +3307,7 @@
++i;
ch = pData[i];
if (ch != 'x' && ch != 'X') {
- return CFX_WideString();
+ return WideString();
}
++i;
@@ -3330,7 +3322,7 @@
} else if (ch <= 'F' && ch >= 'A') {
iCode += ch - 'A' + 10;
} else {
- return CFX_WideString();
+ return WideString();
}
++i;
iCode *= 16;
@@ -3387,7 +3379,7 @@
// static
void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 2) {
@@ -3402,9 +3394,9 @@
return;
}
- CFX_WideString encoded = EncodeURL(ValueToUTF8String(argOne.get()));
+ WideString encoded = EncodeURL(ValueToUTF8String(argOne.get()));
args.GetReturnValue()->SetString(
- FX_UTF8Encode(encoded.AsStringC()).AsStringC());
+ FX_UTF8Encode(encoded.AsStringView()).AsStringView());
return;
}
@@ -3415,9 +3407,9 @@
return;
}
- CFX_ByteString toEncodeString = ValueToUTF8String(argOne.get());
- CFX_ByteString identifyString = ValueToUTF8String(argTwo.get());
- CFX_WideString encoded;
+ ByteString toEncodeString = ValueToUTF8String(argOne.get());
+ ByteString identifyString = ValueToUTF8String(argTwo.get());
+ WideString encoded;
if (identifyString.EqualNoCase("html"))
encoded = EncodeHTML(toEncodeString);
else if (identifyString.EqualNoCase("xml"))
@@ -3426,13 +3418,12 @@
encoded = EncodeURL(toEncodeString);
args.GetReturnValue()->SetString(
- FX_UTF8Encode(encoded.AsStringC()).AsStringC());
+ FX_UTF8Encode(encoded.AsStringView()).AsStringView());
}
// static
-CFX_WideString CXFA_FM2JSContext::EncodeURL(const CFX_ByteString& szURLString) {
- CFX_WideString wsURLString =
- CFX_WideString::FromUTF8(szURLString.AsStringC());
+WideString CXFA_FM2JSContext::EncodeURL(const ByteString& szURLString) {
+ WideString wsURLString = WideString::FromUTF8(szURLString.AsStringView());
CFX_WideTextBuf wsResultBuf;
wchar_t strEncode[4];
strEncode[0] = '%';
@@ -3494,7 +3485,7 @@
wsResultBuf.AppendChar(ch);
} else {
const wchar_t iRadix = 16;
- CFX_WideString strTmp;
+ WideString strTmp;
while (ch >= iRadix) {
wchar_t tmp = strCode[ch % iRadix];
ch /= iRadix;
@@ -3529,10 +3520,8 @@
}
// static
-CFX_WideString CXFA_FM2JSContext::EncodeHTML(
- const CFX_ByteString& szHTMLString) {
- CFX_WideString wsHTMLString =
- CFX_WideString::FromUTF8(szHTMLString.AsStringC());
+WideString CXFA_FM2JSContext::EncodeHTML(const ByteString& szHTMLString) {
+ WideString wsHTMLString = WideString::FromUTF8(szHTMLString.AsStringView());
const wchar_t* strCode = L"0123456789abcdef";
wchar_t strEncode[9];
strEncode[0] = '&';
@@ -3548,7 +3537,7 @@
const wchar_t* pData = wsHTMLString.c_str();
while (i < iLen) {
uint32_t ch = pData[i];
- CFX_WideString htmlReserve;
+ WideString htmlReserve;
if (HTMLCode2STR(ch, &htmlReserve)) {
wsResultBuf.AppendChar(L'&');
wsResultBuf << htmlReserve;
@@ -3578,9 +3567,8 @@
}
// static
-CFX_WideString CXFA_FM2JSContext::EncodeXML(const CFX_ByteString& szXMLString) {
- CFX_WideString wsXMLString =
- CFX_WideString::FromUTF8(szXMLString.AsStringC());
+WideString CXFA_FM2JSContext::EncodeXML(const ByteString& szXMLString) {
+ WideString wsXMLString = WideString::FromUTF8(szXMLString.AsStringView());
CFX_WideTextBuf wsResultBuf;
wchar_t strEncode[9];
strEncode[0] = '&';
@@ -3595,27 +3583,27 @@
switch (ch) {
case '"':
wsResultBuf.AppendChar('&');
- wsResultBuf << CFX_WideStringC(L"quot");
+ wsResultBuf << WideStringView(L"quot");
wsResultBuf.AppendChar(';');
break;
case '&':
wsResultBuf.AppendChar('&');
- wsResultBuf << CFX_WideStringC(L"amp");
+ wsResultBuf << WideStringView(L"amp");
wsResultBuf.AppendChar(';');
break;
case '\'':
wsResultBuf.AppendChar('&');
- wsResultBuf << CFX_WideStringC(L"apos");
+ wsResultBuf << WideStringView(L"apos");
wsResultBuf.AppendChar(';');
break;
case '<':
wsResultBuf.AppendChar('&');
- wsResultBuf << CFX_WideStringC(L"lt");
+ wsResultBuf << WideStringView(L"lt");
wsResultBuf.AppendChar(';');
break;
case '>':
wsResultBuf.AppendChar('&');
- wsResultBuf << CFX_WideStringC(L"gt");
+ wsResultBuf << WideStringView(L"gt");
wsResultBuf.AppendChar(';');
break;
default: {
@@ -3646,10 +3634,10 @@
}
// static
-bool CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData,
+bool CXFA_FM2JSContext::HTMLSTR2Code(const WideStringView& pData,
uint32_t* iCode) {
auto cmpFunc = [](const XFA_FMHtmlReserveCode& iter,
- const CFX_WideStringC& val) {
+ const WideStringView& val) {
// TODO(tsepez): check usage of c_str() below.
return wcscmp(val.unterminated_c_str(), iter.m_htmlReserve) > 0;
};
@@ -3666,7 +3654,7 @@
// static
bool CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode,
- CFX_WideString* wsHTMLReserve) {
+ WideString* wsHTMLReserve) {
auto cmpFunc = [](const XFA_FMHtmlReserveCode iter, const uint32_t& val) {
return iter.m_uCode < val;
};
@@ -3682,7 +3670,7 @@
// static
void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() < 2) {
@@ -3691,10 +3679,10 @@
}
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString szPattern = ValueToUTF8String(argOne.get());
+ ByteString szPattern = ValueToUTF8String(argOne.get());
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- CFX_ByteString szValue = ValueToUTF8String(argTwo.get());
+ ByteString szValue = ValueToUTF8String(argTwo.get());
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
@@ -3704,9 +3692,9 @@
CXFA_WidgetData widgetData(pThisNode);
IFX_Locale* pLocale = widgetData.GetLocal();
uint32_t patternType;
- CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC());
- CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC());
- if (!PatternStringType(szPattern.AsStringC(), patternType)) {
+ WideString wsPattern = WideString::FromUTF8(szPattern.AsStringView());
+ WideString wsValue = WideString::FromUTF8(szValue.AsStringView());
+ if (!PatternStringType(szPattern.AsStringView(), patternType)) {
switch (patternType) {
case XFA_VT_DATETIME: {
auto iTChar = wsPattern.Find(L'T');
@@ -3714,10 +3702,10 @@
args.GetReturnValue()->SetString("");
return;
}
- CFX_WideString wsDatePattern(L"date{");
+ WideString wsDatePattern(L"date{");
wsDatePattern += wsPattern.Left(iTChar.value()) + L"} ";
- CFX_WideString wsTimePattern(L"time{");
+ WideString wsTimePattern(L"time{");
wsTimePattern +=
wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) +
L"}";
@@ -3736,7 +3724,7 @@
wsPattern = L"num{" + wsPattern + L"}";
} break;
default: {
- CFX_WideString wsTestPattern;
+ WideString wsTestPattern;
wsTestPattern = L"num{" + wsPattern + L"}";
CXFA_LocaleValue tempLocaleValue(XFA_VT_FLOAT, wsValue, wsTestPattern,
pLocale, pMgr);
@@ -3752,19 +3740,19 @@
}
}
CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, pMgr);
- CFX_WideString wsRet;
+ WideString wsRet;
if (!localeValue.FormatPatterns(wsRet, wsPattern, pLocale,
XFA_VALUEPICTURE_Display)) {
args.GetReturnValue()->SetString("");
return;
}
- args.GetReturnValue()->SetString(wsRet.UTF8Encode().AsStringC());
+ args.GetReturnValue()->SetString(wsRet.UTF8Encode().AsStringView());
}
// static
void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Left");
@@ -3779,14 +3767,14 @@
return;
}
- CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
+ ByteString sourceString = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(sourceString.Left(count).AsStringC());
+ args.GetReturnValue()->SetString(sourceString.Left(count).AsStringView());
}
// static
void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Len");
@@ -3799,13 +3787,13 @@
return;
}
- CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
+ ByteString sourceString = ValueToUTF8String(argOne.get());
args.GetReturnValue()->SetInteger(sourceString.GetLength());
}
// static
void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 2) {
@@ -3820,8 +3808,8 @@
}
CFX_WideTextBuf lowStringBuf;
- CFX_ByteString argString = ValueToUTF8String(argOne.get());
- CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC());
+ ByteString argString = ValueToUTF8String(argOne.get());
+ WideString wsArgString = WideString::FromUTF8(argString.AsStringView());
const wchar_t* pData = wsArgString.c_str();
FX_STRSIZE i = 0;
while (i < argString.GetLength()) {
@@ -3837,12 +3825,12 @@
lowStringBuf.AppendChar(0);
args.GetReturnValue()->SetString(
- FX_UTF8Encode(lowStringBuf.AsStringC()).AsStringC());
+ FX_UTF8Encode(lowStringBuf.AsStringView()).AsStringView());
}
// static
void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ltrim");
@@ -3855,14 +3843,14 @@
return;
}
- CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
+ ByteString sourceString = ValueToUTF8String(argOne.get());
sourceString.TrimLeft();
- args.GetReturnValue()->SetString(sourceString.AsStringC());
+ args.GetReturnValue()->SetString(sourceString.AsStringView());
}
// static
void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 2) {
@@ -3877,8 +3865,8 @@
return;
}
- CFX_ByteString szPattern = ValueToUTF8String(argOne.get());
- CFX_ByteString szValue = ValueToUTF8String(argTwo.get());
+ ByteString szPattern = ValueToUTF8String(argOne.get());
+ ByteString szValue = ValueToUTF8String(argTwo.get());
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
@@ -3886,10 +3874,10 @@
CXFA_WidgetData widgetData(pThisNode);
IFX_Locale* pLocale = widgetData.GetLocal();
- CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC());
- CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC());
+ WideString wsPattern = WideString::FromUTF8(szPattern.AsStringView());
+ WideString wsValue = WideString::FromUTF8(szValue.AsStringView());
uint32_t patternType;
- if (PatternStringType(szPattern.AsStringC(), patternType)) {
+ if (PatternStringType(szPattern.AsStringView(), patternType)) {
CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
@@ -3897,7 +3885,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringC());
+ localeValue.GetValue().UTF8Encode().AsStringView());
return;
}
@@ -3908,9 +3896,9 @@
args.GetReturnValue()->SetString("");
return;
}
- CFX_WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar.value()) +
- L"} ");
- CFX_WideString wsTimePattern(
+ WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar.value()) +
+ L"} ");
+ WideString wsTimePattern(
L"time{" +
wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}");
wsPattern = wsDatePattern + wsTimePattern;
@@ -3921,7 +3909,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringC());
+ localeValue.GetValue().UTF8Encode().AsStringView());
return;
}
case XFA_VT_DATE: {
@@ -3933,7 +3921,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringC());
+ localeValue.GetValue().UTF8Encode().AsStringView());
return;
}
case XFA_VT_TIME: {
@@ -3945,7 +3933,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringC());
+ localeValue.GetValue().UTF8Encode().AsStringView());
return;
}
case XFA_VT_TEXT: {
@@ -3957,7 +3945,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringC());
+ localeValue.GetValue().UTF8Encode().AsStringView());
return;
}
case XFA_VT_FLOAT: {
@@ -3972,7 +3960,7 @@
return;
}
default: {
- CFX_WideString wsTestPattern;
+ WideString wsTestPattern;
wsTestPattern = L"num{" + wsPattern + L"}";
CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsTestPattern,
pLocale, pMgr);
@@ -3989,7 +3977,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue2.GetValue().UTF8Encode().AsStringC());
+ localeValue2.GetValue().UTF8Encode().AsStringView());
return;
}
}
@@ -3997,7 +3985,7 @@
// static
void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 2 || argc > 3) {
@@ -4007,14 +3995,14 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- CFX_ByteString oneString;
- CFX_ByteString twoString;
+ ByteString oneString;
+ ByteString twoString;
if (!ValueIsNull(pThis, argOne.get()) && !ValueIsNull(pThis, argTwo.get())) {
oneString = ValueToUTF8String(argOne.get());
twoString = ValueToUTF8String(argTwo.get());
}
- CFX_ByteString threeString;
+ ByteString threeString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
threeString = ValueToUTF8String(argThree.get());
@@ -4051,12 +4039,12 @@
}
}
resultString << '\0';
- args.GetReturnValue()->SetString(CFX_ByteStringC(resultString.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(resultString.str().c_str()));
}
// static
void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Right");
@@ -4071,14 +4059,14 @@
return;
}
- CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
+ ByteString sourceString = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(sourceString.Right(count).AsStringC());
+ args.GetReturnValue()->SetString(sourceString.Right(count).AsStringView());
}
// static
void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Rtrim");
@@ -4091,14 +4079,14 @@
return;
}
- CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
+ ByteString sourceString = ValueToUTF8String(argOne.get());
sourceString.TrimRight();
- args.GetReturnValue()->SetString(sourceString.AsStringC());
+ args.GetReturnValue()->SetString(sourceString.AsStringView());
}
// static
void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Space");
@@ -4119,12 +4107,12 @@
index++;
}
spaceString << '\0';
- args.GetReturnValue()->SetString(CFX_ByteStringC(spaceString.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(spaceString.str().c_str()));
}
// static
void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -4153,11 +4141,11 @@
0, static_cast<int32_t>(ValueToFloat(pThis, precisionValue.get())));
}
- CFX_ByteString numberString;
- CFX_ByteString formatStr = "%";
+ ByteString numberString;
+ ByteString formatStr = "%";
if (iPrecision) {
formatStr += ".";
- formatStr += CFX_ByteString::FormatInteger(iPrecision);
+ formatStr += ByteString::FormatInteger(iPrecision);
}
formatStr += "f";
numberString.Format(formatStr.c_str(), fNumber);
@@ -4180,7 +4168,7 @@
++i;
}
resultBuf << '\0';
- args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
return;
}
@@ -4199,7 +4187,7 @@
}
resultBuf << pData;
}
- args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
return;
}
@@ -4235,12 +4223,12 @@
++i;
}
resultBuf << '\0';
- args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
}
// static
void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 3 || argc > 4) {
@@ -4248,8 +4236,8 @@
return;
}
- CFX_ByteString sourceString;
- CFX_ByteString insertString;
+ ByteString sourceString;
+ ByteString insertString;
int32_t iLength = 0;
int32_t iStart = 0;
int32_t iDelete = 0;
@@ -4279,19 +4267,19 @@
resultString << static_cast<char>(sourceString[i]);
++i;
}
- resultString << insertString.AsStringC();
+ resultString << insertString.AsStringView();
i = iStart + iDelete;
while (i < iLength) {
resultString << static_cast<char>(sourceString[i]);
++i;
}
resultString << '\0';
- args.GetReturnValue()->SetString(CFX_ByteStringC(resultString.str().c_str()));
+ args.GetReturnValue()->SetString(ByteStringView(resultString.str().c_str()));
}
// static
void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 3) {
ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Substr");
@@ -4310,7 +4298,7 @@
int32_t iStart = 0;
int32_t iCount = 0;
- CFX_ByteString szSourceStr = ValueToUTF8String(stringValue.get());
+ ByteString szSourceStr = ValueToUTF8String(stringValue.get());
int32_t iLength = szSourceStr.GetLength();
if (iLength == 0) {
args.GetReturnValue()->SetString("");
@@ -4323,12 +4311,13 @@
std::max(0, static_cast<int32_t>(ValueToFloat(pThis, endValue.get())));
iStart -= 1;
- args.GetReturnValue()->SetString(szSourceStr.Mid(iStart, iCount).AsStringC());
+ args.GetReturnValue()->SetString(
+ szSourceStr.Mid(iStart, iCount).AsStringView());
}
// static
void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 0 || argc > 1) {
@@ -4341,12 +4330,12 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
iNum = static_cast<int32_t>(ValueToFloat(pThis, argOne.get()));
}
- args.GetReturnValue()->SetString(GUIDString(!!iNum).AsStringC());
+ args.GetReturnValue()->SetString(GUIDString(!!iNum).AsStringView());
}
// static
void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 2) {
@@ -4361,8 +4350,8 @@
}
CFX_WideTextBuf upperStringBuf;
- CFX_ByteString argString = ValueToUTF8String(argOne.get());
- CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC());
+ ByteString argString = ValueToUTF8String(argOne.get());
+ WideString wsArgString = WideString::FromUTF8(argString.AsStringView());
const wchar_t* pData = wsArgString.c_str();
FX_STRSIZE i = 0;
while (i < wsArgString.GetLength()) {
@@ -4378,12 +4367,12 @@
upperStringBuf.AppendChar(0);
args.GetReturnValue()->SetString(
- FX_UTF8Encode(upperStringBuf.AsStringC()).AsStringC());
+ FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView());
}
// static
void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
int32_t argc = args.GetLength();
if (argc < 1 || argc > 3) {
@@ -4410,7 +4399,7 @@
static_cast<int32_t>(ValueToFloat(pThis, identifierValue.get()));
}
- CFX_ByteString localeString;
+ ByteString localeString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
if (localeValue->IsNull()) {
@@ -4425,27 +4414,27 @@
return;
}
- CFX_ByteString numberString;
+ ByteString numberString;
numberString.Format("%.2f", fNumber);
args.GetReturnValue()->SetString(
- WordUS(numberString, iIdentifier).AsStringC());
+ WordUS(numberString, iIdentifier).AsStringView());
}
// static
-CFX_ByteString CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData) {
+ByteString CXFA_FM2JSContext::TrillionUS(const ByteStringView& szData) {
std::ostringstream strBuf;
- CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four",
- "five", "six", "seven", "eight", "nine"};
- CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four",
- "Five", "Six", "Seven", "Eight", "Nine"};
- CFX_ByteStringC pTens[] = {"Ten", "Eleven", "Twelve", "Thirteen",
- "Fourteen", "Fifteen", "Sixteen", "Seventeen",
- "Eighteen", "Nineteen"};
- CFX_ByteStringC pLastTens[] = {"Twenty", "Thirty", "Forty", "Fifty",
- "Sixty", "Seventy", "Eighty", "Ninety"};
- CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ",
- " Billion ", "Trillion"};
+ ByteStringView pUnits[] = {"zero", "one", "two", "three", "four",
+ "five", "six", "seven", "eight", "nine"};
+ ByteStringView pCapUnits[] = {"Zero", "One", "Two", "Three", "Four",
+ "Five", "Six", "Seven", "Eight", "Nine"};
+ ByteStringView pTens[] = {"Ten", "Eleven", "Twelve", "Thirteen",
+ "Fourteen", "Fifteen", "Sixteen", "Seventeen",
+ "Eighteen", "Nineteen"};
+ ByteStringView pLastTens[] = {"Twenty", "Thirty", "Forty", "Fifty",
+ "Sixty", "Seventy", "Eighty", "Ninety"};
+ ByteStringView pComm[] = {" Hundred ", " Thousand ", " Million ", " Billion ",
+ "Trillion"};
const char* pData = szData.unterminated_c_str();
int32_t iLength = szData.GetLength();
int32_t iComm = 0;
@@ -4529,16 +4518,15 @@
}
iIndex += 3;
}
- return CFX_ByteString(strBuf);
+ return ByteString(strBuf);
}
// static
-CFX_ByteString CXFA_FM2JSContext::WordUS(const CFX_ByteString& szData,
- int32_t iStyle) {
+ByteString CXFA_FM2JSContext::WordUS(const ByteString& szData, int32_t iStyle) {
const char* pData = szData.c_str();
int32_t iLength = szData.GetLength();
if (iStyle < 0 || iStyle > 2) {
- return CFX_ByteString();
+ return ByteString();
}
std::ostringstream strBuf;
@@ -4556,7 +4544,7 @@
if (!iCount && iInteger - iIndex > 0)
iCount = 12;
- strBuf << TrillionUS(CFX_ByteStringC(pData + iIndex, iCount));
+ strBuf << TrillionUS(ByteStringView(pData + iIndex, iCount));
iIndex += iCount;
if (iIndex < iInteger)
strBuf << " Trillion ";
@@ -4573,19 +4561,19 @@
if (!iCount && iLength - iIndex > 0)
iCount = 12;
- strBuf << TrillionUS(CFX_ByteStringC(pData + iIndex, iCount));
+ strBuf << TrillionUS(ByteStringView(pData + iIndex, iCount));
iIndex += iCount;
if (iIndex < iLength)
strBuf << " Trillion ";
}
strBuf << " Cents";
}
- return CFX_ByteString(strBuf);
+ return ByteString(strBuf);
}
// static
void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -4602,21 +4590,21 @@
return;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString urlString = ValueToUTF8String(argOne.get());
- CFX_RetainPtr<IFX_SeekableReadStream> pFile = pAppProvider->DownloadURL(
- CFX_WideString::FromUTF8(urlString.AsStringC()));
+ ByteString urlString = ValueToUTF8String(argOne.get());
+ CFX_RetainPtr<IFX_SeekableReadStream> pFile =
+ pAppProvider->DownloadURL(WideString::FromUTF8(urlString.AsStringView()));
if (!pFile)
return;
int32_t size = pFile->GetSize();
std::vector<uint8_t> dataBuf(size);
pFile->ReadBlock(dataBuf.data(), size);
- args.GetReturnValue()->SetString(CFX_ByteStringC(dataBuf));
+ args.GetReturnValue()->SetString(ByteStringView(dataBuf));
}
// static
void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
int32_t argc = args.GetLength();
@@ -4634,45 +4622,45 @@
return;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString bsURL = ValueToUTF8String(argOne.get());
+ ByteString bsURL = ValueToUTF8String(argOne.get());
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- CFX_ByteString bsData = ValueToUTF8String(argTwo.get());
+ ByteString bsData = ValueToUTF8String(argTwo.get());
- CFX_ByteString bsContentType;
+ ByteString bsContentType;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
bsContentType = ValueToUTF8String(argThree.get());
}
- CFX_ByteString bsEncode;
+ ByteString bsEncode;
if (argc > 3) {
std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3);
bsEncode = ValueToUTF8String(argFour.get());
}
- CFX_ByteString bsHeader;
+ ByteString bsHeader;
if (argc > 4) {
std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4);
bsHeader = ValueToUTF8String(argFive.get());
}
- CFX_WideString decodedResponse;
+ WideString decodedResponse;
if (!pAppProvider->PostRequestURL(
- CFX_WideString::FromUTF8(bsURL.AsStringC()),
- CFX_WideString::FromUTF8(bsData.AsStringC()),
- CFX_WideString::FromUTF8(bsContentType.AsStringC()),
- CFX_WideString::FromUTF8(bsEncode.AsStringC()),
- CFX_WideString::FromUTF8(bsHeader.AsStringC()), decodedResponse)) {
+ WideString::FromUTF8(bsURL.AsStringView()),
+ WideString::FromUTF8(bsData.AsStringView()),
+ WideString::FromUTF8(bsContentType.AsStringView()),
+ WideString::FromUTF8(bsEncode.AsStringView()),
+ WideString::FromUTF8(bsHeader.AsStringView()), decodedResponse)) {
pContext->ThrowServerDeniedException();
return;
}
- args.GetReturnValue()->SetString(decodedResponse.UTF8Encode().AsStringC());
+ args.GetReturnValue()->SetString(decodedResponse.UTF8Encode().AsStringView());
}
// static
void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
int32_t argc = args.GetLength();
@@ -4690,21 +4678,21 @@
return;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString bsURL = ValueToUTF8String(argOne.get());
+ ByteString bsURL = ValueToUTF8String(argOne.get());
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- CFX_ByteString bsData = ValueToUTF8String(argTwo.get());
+ ByteString bsData = ValueToUTF8String(argTwo.get());
- CFX_ByteString bsEncode;
+ ByteString bsEncode;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
bsEncode = ValueToUTF8String(argThree.get());
}
if (!pAppProvider->PutRequestURL(
- CFX_WideString::FromUTF8(bsURL.AsStringC()),
- CFX_WideString::FromUTF8(bsData.AsStringC()),
- CFX_WideString::FromUTF8(bsEncode.AsStringC()))) {
+ WideString::FromUTF8(bsURL.AsStringView()),
+ WideString::FromUTF8(bsData.AsStringView()),
+ WideString::FromUTF8(bsEncode.AsStringView()))) {
pContext->ThrowServerDeniedException();
return;
}
@@ -4714,7 +4702,7 @@
// static
void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 2) {
@@ -4743,8 +4731,8 @@
} else {
for (int32_t i = 2; i < iLeftLength; i++) {
lValue->GetObjectPropertyByIdx(i, jsObjectValue.get());
- jsObjectValue->SetObjectProperty(propertyValue->ToString().AsStringC(),
- rValue.get());
+ jsObjectValue->SetObjectProperty(
+ propertyValue->ToString().AsStringView(), rValue.get());
}
}
} else if (lValue->IsObject()) {
@@ -4758,7 +4746,7 @@
// static
void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4779,7 +4767,7 @@
// static
void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4800,7 +4788,7 @@
// static
void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4833,7 +4821,7 @@
// static
void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4893,7 +4881,7 @@
// static
void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4909,7 +4897,8 @@
if (argFirst->IsString() && argSecond->IsString()) {
args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringC()) == -1);
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) ==
+ -1);
return;
}
@@ -4920,7 +4909,7 @@
// static
void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4937,7 +4926,8 @@
if (argFirst->IsString() && argSecond->IsString()) {
args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringC()) != 1);
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) !=
+ 1);
return;
}
@@ -4948,7 +4938,7 @@
// static
void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4964,7 +4954,8 @@
if (argFirst->IsString() && argSecond->IsString()) {
args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringC()) == 1);
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) ==
+ 1);
return;
}
@@ -4975,7 +4966,7 @@
// static
void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -4992,7 +4983,8 @@
if (argFirst->IsString() && argSecond->IsString()) {
args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringC()) != -1);
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) !=
+ -1);
return;
}
@@ -5003,7 +4995,7 @@
// static
void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5025,7 +5017,7 @@
// static
void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5046,7 +5038,7 @@
// static
void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 2) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5067,7 +5059,7 @@
// static
void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 2) {
@@ -5094,7 +5086,7 @@
// static
void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5111,7 +5103,7 @@
// static
void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5128,7 +5120,7 @@
// static
void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5147,7 +5139,7 @@
// static
void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -5164,9 +5156,9 @@
iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
}
- CFX_ByteString szName = args.GetUTF8String(2);
- CFX_ByteString szSomExp = GenerateSomExpression(
- szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar);
+ ByteString szName = args.GetUTF8String(2);
+ ByteString szSomExp = GenerateSomExpression(
+ szName.AsStringView(), args.GetInt32(3), iIndexValue, bIsStar);
std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
if (argAccessor->IsArray()) {
@@ -5187,7 +5179,7 @@
argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
XFA_RESOLVENODE_RS resoveNodeRS;
- if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
+ if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(),
resoveNodeRS, true, szName.IsEmpty()) > 0) {
ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
&resolveValues[i - 2], &bAttribute);
@@ -5196,8 +5188,8 @@
}
if (iCounter < 1) {
pContext->ThrowPropertyNotInObjectException(
- CFX_WideString::FromUTF8(szName.AsStringC()),
- CFX_WideString::FromUTF8(szSomExp.AsStringC()));
+ WideString::FromUTF8(szName.AsStringView()),
+ WideString::FromUTF8(szSomExp.AsStringView()));
return;
}
@@ -5207,7 +5199,7 @@
values[0]->SetInteger(1);
if (bAttribute)
- values[1]->SetString(szName.AsStringC());
+ values[1]->SetString(szName.AsStringView());
else
values[1]->SetNull();
@@ -5224,21 +5216,21 @@
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = 0;
- CFX_ByteString bsAccessorName = args.GetUTF8String(1);
+ ByteString bsAccessorName = args.GetUTF8String(1);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
- iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
+ iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
resoveNodeRS, true, szName.IsEmpty());
} else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
GetObjectForName(pThis, argAccessor.get(),
- bsAccessorName.AsStringC())) {
- iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
+ bsAccessorName.AsStringView())) {
+ iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
resoveNodeRS, true, szName.IsEmpty());
}
if (iRet < 1) {
pContext->ThrowPropertyNotInObjectException(
- CFX_WideString::FromUTF8(szName.AsStringC()),
- CFX_WideString::FromUTF8(szSomExp.AsStringC()));
+ WideString::FromUTF8(szName.AsStringView()),
+ WideString::FromUTF8(szSomExp.AsStringView()));
return;
}
@@ -5253,7 +5245,7 @@
values[0]->SetInteger(1);
if (bAttribute)
- values[1]->SetString(szName.AsStringC());
+ values[1]->SetString(szName.AsStringView());
else
values[1]->SetNull();
@@ -5265,7 +5257,7 @@
// static
void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -5282,9 +5274,9 @@
iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
}
- CFX_ByteString szName = args.GetUTF8String(2);
- CFX_ByteString szSomExp = GenerateSomExpression(
- szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar);
+ ByteString szName = args.GetUTF8String(2);
+ ByteString szSomExp = GenerateSomExpression(
+ szName.AsStringView(), args.GetInt32(3), iIndexValue, bIsStar);
std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
if (argAccessor->IsArray()) {
@@ -5305,7 +5297,7 @@
for (int32_t i = 2; i < iLength; i++) {
argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
XFA_RESOLVENODE_RS resoveNodeRS;
- if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
+ if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(),
resoveNodeRS, false) > 0) {
ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
&resolveValues[i - 2], &bAttribute);
@@ -5314,8 +5306,8 @@
}
if (iCounter < 1) {
pContext->ThrowPropertyNotInObjectException(
- CFX_WideString::FromUTF8(szName.AsStringC()),
- CFX_WideString::FromUTF8(szSomExp.AsStringC()));
+ WideString::FromUTF8(szName.AsStringView()),
+ WideString::FromUTF8(szSomExp.AsStringView()));
return;
}
@@ -5325,7 +5317,7 @@
values[0]->SetInteger(1);
if (bAttribute)
- values[1]->SetString(szName.AsStringC());
+ values[1]->SetString(szName.AsStringView());
else
values[1]->SetNull();
@@ -5342,21 +5334,21 @@
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = 0;
- CFX_ByteString bsAccessorName = args.GetUTF8String(1);
+ ByteString bsAccessorName = args.GetUTF8String(1);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
- iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
+ iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
resoveNodeRS, false);
} else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
GetObjectForName(pThis, argAccessor.get(),
- bsAccessorName.AsStringC())) {
- iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
+ bsAccessorName.AsStringView())) {
+ iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
resoveNodeRS, false);
}
if (iRet < 1) {
pContext->ThrowPropertyNotInObjectException(
- CFX_WideString::FromUTF8(szName.AsStringC()),
- CFX_WideString::FromUTF8(szSomExp.AsStringC()));
+ WideString::FromUTF8(szName.AsStringView()),
+ WideString::FromUTF8(szSomExp.AsStringView()));
return;
}
@@ -5371,7 +5363,7 @@
values[0]->SetInteger(1);
if (bAttribute)
- values[1]->SetString(szName.AsStringC());
+ values[1]->SetString(szName.AsStringView());
else
values[1]->SetNull();
@@ -5383,7 +5375,7 @@
// static
void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -5392,27 +5384,27 @@
}
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString argString = ValueToUTF8String(argOne.get());
+ ByteString argString = ValueToUTF8String(argOne.get());
if (argString.IsEmpty()) {
pContext->ThrowArgumentMismatchException();
return;
}
- CFX_WideString scriptString = CFX_WideString::FromUTF8(argString.AsStringC());
+ WideString scriptString = WideString::FromUTF8(argString.AsStringView());
CFX_WideTextBuf wsJavaScriptBuf;
- if (!CXFA_FM2JSContext::Translate(scriptString.AsStringC(),
+ if (!CXFA_FM2JSContext::Translate(scriptString.AsStringView(),
&wsJavaScriptBuf)) {
pContext->ThrowCompilerErrorException();
return;
}
args.GetReturnValue()->SetString(
- FX_UTF8Encode(wsJavaScriptBuf.AsStringC()).AsStringC());
+ FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView());
}
// static
void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
args.GetReturnValue()->SetBoolean(false);
@@ -5425,7 +5417,7 @@
// static
void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
args.GetReturnValue()->SetBoolean(false);
@@ -5438,7 +5430,7 @@
// static
void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -5458,7 +5450,7 @@
return;
}
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
args.GetReturnValue());
return;
}
@@ -5473,7 +5465,7 @@
// static
void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
if (args.GetLength() != 1) {
ToJSContext(pThis, nullptr)->ThrowCompilerErrorException();
@@ -5499,7 +5491,7 @@
// static
void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
if (args.GetLength() != 1) {
@@ -5553,7 +5545,7 @@
// static
void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
uint32_t iLength = 0;
@@ -5623,7 +5615,7 @@
return simpleValue;
}
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
simpleValue.get());
return simpleValue;
}
@@ -5658,7 +5650,7 @@
}
auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return newPropertyValue->IsNull();
}
@@ -5688,8 +5680,8 @@
return false;
if (firstValue->IsString()) {
- CFX_ByteString firstString = ValueToUTF8String(firstValue);
- CFX_ByteString secondString = ValueToUTF8String(secondValue);
+ ByteString firstString = ValueToUTF8String(firstValue);
+ ByteString secondString = ValueToUTF8String(secondValue);
return firstString == secondString;
}
if (firstValue->IsNumber()) {
@@ -5753,7 +5745,7 @@
for (int32_t j = 2; j < iLength; j++) {
argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get());
jsObjectValue->GetObjectProperty(
- propertyValue->ToString().AsStringC(),
+ propertyValue->ToString().AsStringView(),
(*resultValues)[index].get());
index++;
}
@@ -5791,41 +5783,40 @@
}
// static
-CFX_ByteString CXFA_FM2JSContext::GenerateSomExpression(
- const CFX_ByteStringC& szName,
+ByteString CXFA_FM2JSContext::GenerateSomExpression(
+ const ByteStringView& szName,
int32_t iIndexFlags,
int32_t iIndexValue,
bool bIsStar) {
if (bIsStar)
- return CFX_ByteString(szName, "[*]");
+ return ByteString(szName, "[*]");
if (iIndexFlags == 0)
- return CFX_ByteString(szName);
+ return ByteString(szName);
if (iIndexFlags == 1 || iIndexValue == 0) {
- return CFX_ByteString(szName, "[") +
- CFX_ByteString::FormatInteger(iIndexValue) + "]";
+ return ByteString(szName, "[") + ByteString::FormatInteger(iIndexValue) +
+ "]";
}
- CFX_ByteString szSomExp;
+ ByteString szSomExp;
if (iIndexFlags == 2) {
szSomExp = (iIndexValue < 0) ? (szName + "[-") : (szName + "[+");
iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue;
- szSomExp += CFX_ByteString::FormatInteger(iIndexValue);
+ szSomExp += ByteString::FormatInteger(iIndexValue);
szSomExp += "]";
} else {
szSomExp = (iIndexValue < 0) ? (szName + "[") : (szName + "[-");
iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue;
- szSomExp += CFX_ByteString::FormatInteger(iIndexValue);
+ szSomExp += ByteString::FormatInteger(iIndexValue);
szSomExp += "]";
}
return szSomExp;
}
// static
-bool CXFA_FM2JSContext::GetObjectForName(
- CFXJSE_Value* pThis,
- CFXJSE_Value* accessorValue,
- const CFX_ByteStringC& szAccessorName) {
+bool CXFA_FM2JSContext::GetObjectForName(CFXJSE_Value* pThis,
+ CFXJSE_Value* accessorValue,
+ const ByteStringView& szAccessorName) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
return false;
@@ -5836,7 +5827,7 @@
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
int32_t iRet = pScriptContext->ResolveObjects(
pScriptContext->GetThisObject(),
- CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS,
+ WideString::FromUTF8(szAccessorName).AsStringView(), resoveNodeRS,
dwFlags);
if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
accessorValue->Assign(
@@ -5849,7 +5840,7 @@
// static
int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis,
CFXJSE_Value* pRefValue,
- const CFX_ByteStringC& bsSomExp,
+ const ByteStringView& bsSomExp,
XFA_RESOLVENODE_RS& resoveNodeRS,
bool bdotAccessor,
bool bHasNoResolveName) {
@@ -5857,7 +5848,7 @@
if (!pDoc)
return -1;
- CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp);
+ WideString wsSomExpression = WideString::FromUTF8(bsSomExp);
CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext();
CXFA_Object* pNode = nullptr;
uint32_t dFlags = 0UL;
@@ -5869,7 +5860,7 @@
pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr);
ASSERT(pNode);
if (bHasNoResolveName) {
- CFX_WideString wsName;
+ WideString wsName;
if (CXFA_Node* pXFANode = pNode->AsNode())
pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
if (wsName.IsEmpty())
@@ -5888,7 +5879,7 @@
pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr);
dFlags = XFA_RESOLVENODE_AnyChild;
}
- return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(),
+ return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringView(),
resoveNodeRS, dFlags);
}
@@ -5954,7 +5945,7 @@
return ValueToInteger(pThis, newPropertyValue.get());
}
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return ValueToInteger(pThis, newPropertyValue.get());
}
@@ -5984,7 +5975,7 @@
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
return ValueToFloat(pThis, newPropertyValue.get());
}
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return ValueToFloat(pThis, newPropertyValue.get());
}
@@ -5994,7 +5985,7 @@
return ValueToFloat(pThis, newPropertyValue.get());
}
if (arg->IsString())
- return (float)XFA_ByteStringToDouble(arg->ToString().AsStringC());
+ return (float)XFA_ByteStringToDouble(arg->ToString().AsStringView());
if (arg->IsUndefined())
return 0;
@@ -6018,7 +6009,7 @@
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
return ValueToDouble(pThis, newPropertyValue.get());
}
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return ValueToDouble(pThis, newPropertyValue.get());
}
@@ -6028,7 +6019,7 @@
return ValueToDouble(pThis, newPropertyValue.get());
}
if (arg->IsString())
- return XFA_ByteStringToDouble(arg->ToString().AsStringC());
+ return XFA_ByteStringToDouble(arg->ToString().AsStringView());
if (arg->IsUndefined())
return 0;
return arg->ToDouble();
@@ -6064,22 +6055,22 @@
return ValueToDouble(pThis, jsObjectValue.get());
auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(),
+ jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return ValueToDouble(pThis, newPropertyValue.get());
}
// static
-CFX_ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) {
+ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) {
if (!arg || arg->IsNull() || arg->IsUndefined())
- return CFX_ByteString();
+ return ByteString();
if (arg->IsBoolean())
return arg->ToBoolean() ? "1" : "0";
return arg->ToString();
}
// static.
-bool CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc,
+bool CXFA_FM2JSContext::Translate(const WideStringView& wsFormcalc,
CFX_WideTextBuf* wsJavascript) {
if (wsFormcalc.IsEmpty()) {
wsJavascript->Clear();
@@ -6118,7 +6109,7 @@
}
void CXFA_FM2JSContext::ThrowNoDefaultPropertyException(
- const CFX_ByteStringC& name) const {
+ const ByteStringView& name) const {
// TODO(tsepez): check usage of c_str() below.
ThrowException(L"%.16S doesn't have a default property.",
name.unterminated_c_str());
@@ -6137,8 +6128,8 @@
}
void CXFA_FM2JSContext::ThrowPropertyNotInObjectException(
- const CFX_WideString& name,
- const CFX_WideString& exp) const {
+ const WideString& name,
+ const WideString& exp) const {
ThrowException(
L"An attempt was made to reference property '%.16s' of a non-object "
L"in SOM expression %.16s.",
@@ -6146,7 +6137,7 @@
}
void CXFA_FM2JSContext::ThrowParamCountMismatchException(
- const CFX_WideString& method) const {
+ const WideString& method) const {
ThrowException(L"Incorrect number of parameters calling method '%.16s'.",
method.c_str());
}
@@ -6156,11 +6147,11 @@
}
void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const {
- CFX_WideString wsMessage;
+ WideString wsMessage;
va_list arg_ptr;
va_start(arg_ptr, str);
wsMessage.FormatV(str, arg_ptr);
va_end(arg_ptr);
ASSERT(!wsMessage.IsEmpty());
- FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC());
+ FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView());
}
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
index 37586d0..ca52ea8 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
@@ -25,73 +25,73 @@
~CXFA_FM2JSContext() override;
static void Abs(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Avg(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Ceil(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Count(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Floor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Max(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Min(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Mod(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Round(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Sum(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Date(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Date2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void DateFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void IsoDate2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void IsoTime2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void LocalDateFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void LocalTimeFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Num2Date(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Num2GMTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Num2Time(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Time(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Time2Num(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void TimeFmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static bool IsIsoDateFormat(const char* pData,
@@ -119,258 +119,256 @@
int32_t& iMillionSecond,
int32_t& iZoneHour,
int32_t& iZoneMinute);
- static CFX_ByteString Local2IsoDate(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale);
- static CFX_ByteString IsoDate2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale);
- static CFX_ByteString IsoTime2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale);
- static int32_t DateString2Num(const CFX_ByteStringC& szDateString);
- static CFX_ByteString GetLocalDateFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- bool bStandard);
- static CFX_ByteString GetLocalTimeFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- bool bStandard);
- static CFX_ByteString GetStandardDateFormat(
- CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr);
- static CFX_ByteString GetStandardTimeFormat(
- CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr);
- static CFX_ByteString Num2AllTime(CFXJSE_Value* pThis,
- int32_t iTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- bool bGM);
+ static ByteString Local2IsoDate(CFXJSE_Value* pThis,
+ const ByteStringView& szDate,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale);
+ static ByteString IsoDate2Local(CFXJSE_Value* pThis,
+ const ByteStringView& szDate,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale);
+ static ByteString IsoTime2Local(CFXJSE_Value* pThis,
+ const ByteStringView& szTime,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale);
+ static int32_t DateString2Num(const ByteStringView& szDateString);
+ static ByteString GetLocalDateFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocalStr,
+ bool bStandard);
+ static ByteString GetLocalTimeFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocalStr,
+ bool bStandard);
+ static ByteString GetStandardDateFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocalStr);
+ static ByteString GetStandardTimeFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const ByteStringView& szLocalStr);
+ static ByteString Num2AllTime(CFXJSE_Value* pThis,
+ int32_t iTime,
+ const ByteStringView& szFormat,
+ const ByteStringView& szLocale,
+ bool bGM);
static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec);
static void Apr(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void CTerm(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void FV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void IPmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void NPV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Pmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void PPmt(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void PV(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Rate(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Term(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Choose(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Exists(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void HasValue(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Oneof(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Within(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void If(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Eval(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Ref(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void UnitType(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void UnitValue(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void At(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Concat(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Decode(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
- static CFX_WideString DecodeURL(const CFX_WideString& wsURLString);
- static CFX_WideString DecodeHTML(const CFX_WideString& wsHTMLString);
- static CFX_WideString DecodeXML(const CFX_WideString& wsXMLString);
+ static WideString DecodeURL(const WideString& wsURLString);
+ static WideString DecodeHTML(const WideString& wsHTMLString);
+ static WideString DecodeXML(const WideString& wsXMLString);
static void Encode(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
- static CFX_WideString EncodeURL(const CFX_ByteString& szURLString);
- static CFX_WideString EncodeHTML(const CFX_ByteString& szHTMLString);
- static CFX_WideString EncodeXML(const CFX_ByteString& szXMLString);
- static bool HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t* iCode);
- static bool HTMLCode2STR(uint32_t iCode, CFX_WideString* wsHTMLReserve);
+ static WideString EncodeURL(const ByteString& szURLString);
+ static WideString EncodeHTML(const ByteString& szHTMLString);
+ static WideString EncodeXML(const ByteString& szXMLString);
+ static bool HTMLSTR2Code(const WideStringView& pData, uint32_t* iCode);
+ static bool HTMLCode2STR(uint32_t iCode, WideString* wsHTMLReserve);
static void Format(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Left(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Len(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Lower(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Ltrim(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Parse(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Replace(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Right(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Rtrim(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Space(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Str(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Stuff(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Substr(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Uuid(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Upper(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void WordNum(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
- static CFX_ByteString TrillionUS(const CFX_ByteStringC& szData);
- static CFX_ByteString WordUS(const CFX_ByteString& szData, int32_t iStyle);
+ static ByteString TrillionUS(const ByteStringView& szData);
+ static ByteString WordUS(const ByteString& szData, int32_t iStyle);
static void Get(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Post(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void Put(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void assign_value_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void logical_or_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void logical_and_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void equality_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void notequality_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static bool fm_ref_equal(CFXJSE_Value* pThis, CFXJSE_Arguments& args);
static void less_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void lessequal_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void greater_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void greaterequal_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void plus_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void minus_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void multiple_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void divide_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void positive_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void negative_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void logical_not_operator(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void dot_accessor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void dotdot_accessor(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void eval_translation(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void is_fm_object(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void is_fm_array(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void get_fm_value(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void get_fm_jsobj(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void fm_var_filter(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static void concat_fm_object(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static int32_t hvalue_get_array_length(CFXJSE_Value* pThis,
@@ -387,16 +385,16 @@
CFXJSE_Value* pDefaultValue);
static bool SetObjectDefaultValue(CFXJSE_Value* pObjectValue,
CFXJSE_Value* pNewValue);
- static CFX_ByteString GenerateSomExpression(const CFX_ByteStringC& szName,
- int32_t iIndexFlags,
- int32_t iIndexValue,
- bool bIsStar);
+ static ByteString GenerateSomExpression(const ByteStringView& szName,
+ int32_t iIndexFlags,
+ int32_t iIndexValue,
+ bool bIsStar);
static bool GetObjectForName(CFXJSE_Value* pThis,
CFXJSE_Value* accessorValue,
- const CFX_ByteStringC& szAccessorName);
+ const ByteStringView& szAccessorName);
static int32_t ResolveObjects(CFXJSE_Value* pThis,
CFXJSE_Value* pParentValue,
- const CFX_ByteStringC& bsSomExp,
+ const ByteStringView& bsSomExp,
XFA_RESOLVENODE_RS& resoveNodeRS,
bool bdotAccessor = true,
bool bHasNoResolveName = false);
@@ -414,12 +412,12 @@
static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
static float ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
static double ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
- static CFX_ByteString ValueToUTF8String(CFXJSE_Value* pValue);
+ static ByteString ValueToUTF8String(CFXJSE_Value* pValue);
static double ExtractDouble(CFXJSE_Value* pThis,
CFXJSE_Value* src,
bool* ret);
- static bool Translate(const CFX_WideStringC& wsFormcalc,
+ static bool Translate(const WideStringView& wsFormcalc,
CFX_WideTextBuf* wsJavascript);
void GlobalPropertyGetter(CFXJSE_Value* pValue);
@@ -428,14 +426,14 @@
v8::Isolate* GetScriptRuntime() const { return m_pIsolate; }
CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
- void ThrowNoDefaultPropertyException(const CFX_ByteStringC& name) const;
+ void ThrowNoDefaultPropertyException(const ByteStringView& name) const;
void ThrowCompilerErrorException() const;
void ThrowDivideByZeroException() const;
void ThrowServerDeniedException() const;
- void ThrowPropertyNotInObjectException(const CFX_WideString& name,
- const CFX_WideString& exp) const;
+ void ThrowPropertyNotInObjectException(const WideString& name,
+ const WideString& exp) const;
void ThrowArgumentMismatchException() const;
- void ThrowParamCountMismatchException(const CFX_WideString& method) const;
+ void ThrowParamCountMismatchException(const WideString& method) const;
void ThrowException(const wchar_t* str, ...) const;
v8::Isolate* m_pIsolate;
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index 2faa191..a1bbb50 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -40,8 +40,8 @@
CXFA_FMFunctionDefinition::CXFA_FMFunctionDefinition(
uint32_t line,
bool isGlobal,
- const CFX_WideStringC& wsName,
- std::vector<CFX_WideStringC>&& arguments,
+ const WideStringView& wsName,
+ std::vector<WideStringView>&& arguments,
std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions)
: CXFA_FMExpression(line, XFA_FM_EXPTYPE_FUNC),
m_wsName(wsName),
@@ -61,7 +61,7 @@
}
javascript << L"function ";
if (!m_wsName.IsEmpty() && m_wsName[0] == L'!') {
- CFX_WideString tempName =
+ WideString tempName =
EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1);
javascript << tempName;
} else {
@@ -73,9 +73,8 @@
if (bNeedComma)
javascript << L", ";
if (identifier[0] == L'!') {
- CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER +
- identifier.Right(identifier.GetLength() - 1);
+ WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER +
+ identifier.Right(identifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << identifier;
@@ -117,7 +116,7 @@
CXFA_FMVarExpression::CXFA_FMVarExpression(
uint32_t line,
- const CFX_WideStringC& wsName,
+ const WideStringView& wsName,
std::unique_ptr<CXFA_FMExpression> pInit)
: CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR),
m_wsName(wsName),
@@ -127,7 +126,7 @@
bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L"var ";
- CFX_WideString tempName(m_wsName);
+ WideString tempName(m_wsName);
if (m_wsName[0] == L'!') {
tempName =
EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1);
@@ -151,7 +150,7 @@
bool CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << L"var ";
- CFX_WideString tempName(m_wsName);
+ WideString tempName(m_wsName);
if (m_wsName[0] == L'!') {
tempName =
EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1);
@@ -440,7 +439,7 @@
CXFA_FMForExpression::CXFA_FMForExpression(
uint32_t line,
- const CFX_WideStringC& wsVariant,
+ const WideStringView& wsVariant,
std::unique_ptr<CXFA_FMSimpleExpression> pAssignment,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
int32_t iDirection,
@@ -458,7 +457,7 @@
bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L"{\nvar ";
- CFX_WideString tempVariant;
+ WideString tempVariant;
if (m_wsVariant[0] == L'!') {
tempVariant = EXCLAMATION_IN_IDENTIFIER +
m_wsVariant.Right(m_wsVariant.GetLength() - 1);
@@ -513,7 +512,7 @@
javascript << RUNTIMEFUNCTIONRETURNVALUE;
javascript << L" = 0;\n";
javascript << L"{\nvar ";
- CFX_WideString tempVariant;
+ WideString tempVariant;
if (m_wsVariant[0] == L'!') {
tempVariant = EXCLAMATION_IN_IDENTIFIER +
m_wsVariant.Right(m_wsVariant.GetLength() - 1);
@@ -567,7 +566,7 @@
CXFA_FMForeachExpression::CXFA_FMForeachExpression(
uint32_t line,
- const CFX_WideStringC& wsIdentifier,
+ const WideStringView& wsIdentifier,
std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors,
std::unique_ptr<CXFA_FMExpression> pList)
: CXFA_FMLoopExpression(line),
@@ -581,7 +580,7 @@
javascript << L"{\n";
javascript << L"var ";
if (m_wsIdentifier[0] == L'!') {
- CFX_WideString tempIdentifier =
+ WideString tempIdentifier =
EXCLAMATION_IN_IDENTIFIER +
m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
@@ -613,7 +612,7 @@
javascript << RUNTIMEBLOCKTEMPARRAY;
javascript << L".length)\n{\n";
if (m_wsIdentifier[0] == L'!') {
- CFX_WideString tempIdentifier =
+ WideString tempIdentifier =
EXCLAMATION_IN_IDENTIFIER +
m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
@@ -638,7 +637,7 @@
javascript << L"{\n";
javascript << L"var ";
if (m_wsIdentifier[0] == L'!') {
- CFX_WideString tempIdentifier =
+ WideString tempIdentifier =
EXCLAMATION_IN_IDENTIFIER +
m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
@@ -669,7 +668,7 @@
javascript << RUNTIMEBLOCKTEMPARRAY;
javascript << L".length)\n{\n";
if (m_wsIdentifier[0] == L'!') {
- CFX_WideString tempIdentifier =
+ WideString tempIdentifier =
EXCLAMATION_IN_IDENTIFIER +
m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h
index 47b2d9c..cfbba3a 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.h
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h
@@ -47,8 +47,8 @@
CXFA_FMFunctionDefinition(
uint32_t line,
bool isGlobal,
- const CFX_WideStringC& wsName,
- std::vector<CFX_WideStringC>&& arguments,
+ const WideStringView& wsName,
+ std::vector<WideStringView>&& arguments,
std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions);
~CXFA_FMFunctionDefinition() override;
@@ -56,8 +56,8 @@
bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
private:
- CFX_WideStringC m_wsName;
- std::vector<CFX_WideStringC> m_pArguments;
+ WideStringView m_wsName;
+ std::vector<WideStringView> m_pArguments;
std::vector<std::unique_ptr<CXFA_FMExpression>> m_pExpressions;
bool m_isGlobal;
};
@@ -65,7 +65,7 @@
class CXFA_FMVarExpression : public CXFA_FMExpression {
public:
CXFA_FMVarExpression(uint32_t line,
- const CFX_WideStringC& wsName,
+ const WideStringView& wsName,
std::unique_ptr<CXFA_FMExpression> pInit);
~CXFA_FMVarExpression() override;
@@ -73,7 +73,7 @@
bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
private:
- CFX_WideStringC m_wsName;
+ WideStringView m_wsName;
std::unique_ptr<CXFA_FMExpression> m_pInit;
};
@@ -175,7 +175,7 @@
class CXFA_FMForExpression : public CXFA_FMLoopExpression {
public:
CXFA_FMForExpression(uint32_t line,
- const CFX_WideStringC& wsVariant,
+ const WideStringView& wsVariant,
std::unique_ptr<CXFA_FMSimpleExpression> pAssignment,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
int32_t iDirection,
@@ -187,7 +187,7 @@
bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
private:
- CFX_WideStringC m_wsVariant;
+ WideStringView m_wsVariant;
std::unique_ptr<CXFA_FMSimpleExpression> m_pAssignment;
std::unique_ptr<CXFA_FMSimpleExpression> m_pAccessor;
const bool m_bDirection;
@@ -200,7 +200,7 @@
// Takes ownership of |pAccessors|.
CXFA_FMForeachExpression(
uint32_t line,
- const CFX_WideStringC& wsIdentifier,
+ const WideStringView& wsIdentifier,
std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors,
std::unique_ptr<CXFA_FMExpression> pList);
~CXFA_FMForeachExpression() override;
@@ -209,7 +209,7 @@
bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
private:
- CFX_WideStringC m_wsIdentifier;
+ WideStringView m_wsIdentifier;
std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> m_pAccessors;
std::unique_ptr<CXFA_FMExpression> m_pList;
};
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
index 1a43e83..f6b2a58 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
@@ -122,7 +122,7 @@
L"TOKcall", L"TOKstring", L"TOKnumber", L"TOKreserver",
};
-XFA_FM_TOKEN TokenizeIdentifier(const CFX_WideStringC& str) {
+XFA_FM_TOKEN TokenizeIdentifier(const WideStringView& str) {
uint32_t key = FX_HashCode_GetW(str, true);
const XFA_FMKeyword* end = std::begin(keyWords) + KEYWORD_END + 1;
@@ -145,8 +145,8 @@
CXFA_FMToken::~CXFA_FMToken() {}
-CFX_WideString CXFA_FMToken::ToDebugString() const {
- CFX_WideString str(L"type = ");
+WideString CXFA_FMToken::ToDebugString() const {
+ WideString str(L"type = ");
str += tokenStrings[m_type];
str += L", string = ";
str += m_string;
@@ -155,7 +155,7 @@
return str;
}
-CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc)
+CXFA_FMLexer::CXFA_FMLexer(const WideStringView& wsFormCalc)
: m_cursor(wsFormCalc.unterminated_c_str()),
m_end(m_cursor + wsFormCalc.GetLength() - 1),
m_current_line(1),
@@ -378,7 +378,7 @@
}
m_token->m_string =
- CFX_WideStringC(m_cursor, static_cast<FX_STRSIZE>(end - m_cursor));
+ WideStringView(m_cursor, static_cast<FX_STRSIZE>(end - m_cursor));
m_cursor = end;
}
@@ -395,7 +395,7 @@
// If the end of the input has been reached it was not escaped.
if (m_cursor > m_end) {
m_token->m_string =
- CFX_WideStringC(start, static_cast<FX_STRSIZE>(m_cursor - start));
+ WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start));
return;
}
// If the next character is not a " then the end of the string has been
@@ -404,7 +404,7 @@
if (!IsFormCalcCharacter(*m_cursor)) {
break;
}
- m_token->m_string = CFX_WideStringC(start, (m_cursor - start));
+ m_token->m_string = WideStringView(start, (m_cursor - start));
return;
}
}
@@ -430,7 +430,7 @@
++m_cursor;
}
m_token->m_string =
- CFX_WideStringC(start, static_cast<FX_STRSIZE>(m_cursor - start));
+ WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start));
m_token->m_type = TokenizeIdentifier(m_token->m_string);
}
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.h b/xfa/fxfa/fm2js/cxfa_fmlexer.h
index 3903176..b9764c5 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.h
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.h
@@ -95,16 +95,16 @@
explicit CXFA_FMToken(uint32_t line_num);
~CXFA_FMToken();
- CFX_WideString ToDebugString() const;
+ WideString ToDebugString() const;
- CFX_WideStringC m_string;
+ WideStringView m_string;
XFA_FM_TOKEN m_type;
uint32_t m_line_num;
};
class CXFA_FMLexer {
public:
- explicit CXFA_FMLexer(const CFX_WideStringC& wsFormcalc);
+ explicit CXFA_FMLexer(const WideStringView& wsFormcalc);
~CXFA_FMLexer();
std::unique_ptr<CXFA_FMToken> NextToken();
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 65517fb..1653850 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -20,7 +20,7 @@
} // namespace
-CXFA_FMParser::CXFA_FMParser(const CFX_WideStringC& wsFormcalc)
+CXFA_FMParser::CXFA_FMParser(const WideStringView& wsFormcalc)
: m_error(false), m_parse_depth(0), m_max_parse_depth(kMaxParseDepth) {
m_lexer = pdfium::MakeUnique<CXFA_FMLexer>(wsFormcalc);
m_token = m_lexer->NextToken();
@@ -33,7 +33,7 @@
if (HasError())
return nullptr;
- std::vector<CFX_WideStringC> arguments;
+ std::vector<WideStringView> arguments;
return pdfium::MakeUnique<CXFA_FMFunctionDefinition>(
1, true, L"", std::move(arguments), std::move(expressions));
}
@@ -92,8 +92,8 @@
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
- CFX_WideStringC ident;
- std::vector<CFX_WideStringC> arguments;
+ WideStringView ident;
+ std::vector<WideStringView> arguments;
std::vector<std::unique_ptr<CXFA_FMExpression>> expressions;
uint32_t line = m_token->m_line_num;
if (!NextToken())
@@ -208,7 +208,7 @@
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
- CFX_WideStringC ident;
+ WideStringView ident;
uint32_t line = m_token->m_line_num;
if (!NextToken())
return nullptr;
@@ -613,7 +613,7 @@
return nullptr;
break;
case TOKidentifier: {
- CFX_WideStringC wsIdentifier(m_token->m_string);
+ WideStringView wsIdentifier(m_token->m_string);
if (!NextToken())
return nullptr;
if (m_token->m_type == TOKlbracket) {
@@ -714,7 +714,7 @@
m_error = true;
return nullptr;
}
- CFX_WideStringC tempStr = m_token->m_string;
+ WideStringView tempStr = m_token->m_string;
uint32_t tempLine = m_token->m_line_num;
if (!NextToken())
return nullptr;
@@ -786,7 +786,7 @@
m_error = true;
return nullptr;
}
- CFX_WideStringC tempStr = m_token->m_string;
+ WideStringView tempStr = m_token->m_string;
uint32_t tempLine = m_token->m_line_num;
if (!NextToken())
return nullptr;
@@ -813,7 +813,7 @@
m_error = true;
return nullptr;
}
- CFX_WideStringC tempStr = m_token->m_string;
+ WideStringView tempStr = m_token->m_string;
uint32_t tempLine = m_token->m_line_num;
if (!NextToken())
return nullptr;
@@ -1083,7 +1083,7 @@
if (HasError() || !IncrementParseDepthAndCheck())
return nullptr;
- CFX_WideStringC wsVariant;
+ WideStringView wsVariant;
uint32_t line = m_token->m_line_num;
if (!NextToken())
return nullptr;
@@ -1152,7 +1152,7 @@
return nullptr;
std::unique_ptr<CXFA_FMExpression> expr;
- CFX_WideStringC wsIdentifier;
+ WideStringView wsIdentifier;
std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> pAccessors;
std::unique_ptr<CXFA_FMExpression> pList;
uint32_t line = m_token->m_line_num;
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.h b/xfa/fxfa/fm2js/cxfa_fmparser.h
index ddfaa1a..c536838 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.h
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.h
@@ -15,7 +15,7 @@
class CXFA_FMParser {
public:
- explicit CXFA_FMParser(const CFX_WideStringC& wsFormcalc);
+ explicit CXFA_FMParser(const WideStringView& wsFormcalc);
~CXFA_FMParser();
std::unique_ptr<CXFA_FMFunctionDefinition> Parse();
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp
index a7e784e..192f935 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp
@@ -20,7 +20,7 @@
CFX_WideTextBuf buf;
EXPECT_TRUE(ast->ToJavaScript(buf));
// TODO(dsinclair): This is a little weird .....
- EXPECT_EQ(L"// comments only", buf.AsStringC());
+ EXPECT_EQ(L"// comments only", buf.AsStringView());
}
TEST(CXFA_FMParserTest, CommentOnlyIsError) {
@@ -33,7 +33,7 @@
CFX_WideTextBuf buf;
EXPECT_TRUE(ast->ToJavaScript(buf));
- EXPECT_EQ(L"// comments only", buf.AsStringC());
+ EXPECT_EQ(L"// comments only", buf.AsStringView());
}
TEST(CXFA_FMParserTest, CommentThenValue) {
@@ -51,7 +51,7 @@
CFX_WideTextBuf buf;
EXPECT_TRUE(ast->ToJavaScript(buf));
- EXPECT_EQ(ret, buf.AsStringC());
+ EXPECT_EQ(ret, buf.AsStringView());
}
TEST(CXFA_FMParserTest, Parse) {
@@ -106,7 +106,7 @@
CFX_WideTextBuf buf;
EXPECT_TRUE(ast->ToJavaScript(buf));
- EXPECT_EQ(ret, buf.AsStringC());
+ EXPECT_EQ(ret, buf.AsStringView());
}
TEST(CXFA_FMParserTest, MaxParseDepth) {
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
index fc07609..73dfdd5 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
@@ -81,7 +81,7 @@
} // namespace
-CFX_WideStringC XFA_FM_EXPTypeToString(
+WideStringView XFA_FM_EXPTypeToString(
XFA_FM_SimpleExpressionType simpleExpType) {
return gs_lpStrExpFuncName[simpleExpType];
}
@@ -110,7 +110,7 @@
}
CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line,
- CFX_WideStringC wsNumber)
+ WideStringView wsNumber)
: CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {}
CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {}
@@ -121,13 +121,13 @@
}
CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line,
- CFX_WideStringC wsString)
+ WideStringView wsString)
: CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {}
CXFA_FMStringExpression::~CXFA_FMStringExpression() {}
bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
- CFX_WideString tempStr(m_wsString);
+ WideString tempStr(m_wsString);
if (tempStr.GetLength() <= 2) {
javascript << tempStr;
return true;
@@ -156,14 +156,14 @@
CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression(
uint32_t line,
- CFX_WideStringC wsIdentifier)
+ WideStringView wsIdentifier)
: CXFA_FMSimpleExpression(line, TOKidentifier),
m_wsIdentifier(wsIdentifier) {}
CXFA_FMIdentifierExpression::~CXFA_FMIdentifierExpression() {}
bool CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
- CFX_WideString tempStr(m_wsIdentifier);
+ WideString tempStr(m_wsIdentifier);
if (tempStr == L"$") {
tempStr = L"this";
} else if (tempStr == L"!") {
@@ -244,7 +244,7 @@
javascript << tempExp2;
javascript << L");\n}\n";
if (m_pExp1->GetOperatorToken() == TOKidentifier &&
- tempExp1.AsStringC() != L"this") {
+ tempExp1.AsStringView() != L"this") {
javascript << L"else\n{\n";
javascript << tempExp1;
javascript << L" = ";
@@ -282,7 +282,7 @@
javascript << tempExp2;
javascript << L");\n}\n";
if (m_pExp1->GetOperatorToken() == TOKidentifier &&
- tempExp1.AsStringC() != L"this") {
+ tempExp1.AsStringView() != L"this") {
javascript << L"else\n{\n";
javascript << RUNTIMEFUNCTIONRETURNVALUE;
javascript << L" = ";
@@ -522,10 +522,10 @@
if (funcName->GetLength() > g_BuiltInFuncsMaxLen)
return false;
- auto cmpFunc = [](const wchar_t* iter, const CFX_WideString& val) -> bool {
+ auto cmpFunc = [](const wchar_t* iter, const WideString& val) -> bool {
return val.CompareNoCase(iter) > 0;
};
- CFX_WideString str = funcName->MakeString();
+ WideString str = funcName->MakeString();
const wchar_t* const* pMatchResult = std::lower_bound(
std::begin(g_BuiltInFuncs), std::end(g_BuiltInFuncs), str, cmpFunc);
if (pMatchResult != std::end(g_BuiltInFuncs) &&
@@ -538,8 +538,8 @@
}
uint32_t CXFA_FMCallExpression::IsMethodWithObjParam(
- const CFX_WideString& methodName) {
- auto cmpFunc = [](const XFA_FMSOMMethod iter, const CFX_WideString& val) {
+ const WideString& methodName) {
+ auto cmpFunc = [](const XFA_FMSOMMethod iter, const WideString& val) {
return val.Compare(iter.m_wsSomMethodName) > 0;
};
const XFA_FMSOMMethod* result =
@@ -599,12 +599,12 @@
bool isEvalFunc = false;
bool isExistsFunc = false;
if (IsBuiltInFunc(&funcName)) {
- if (funcName.AsStringC() == L"Eval") {
+ if (funcName.AsStringView() == L"Eval") {
isEvalFunc = true;
javascript << L"eval.call(this, ";
javascript << gs_lpStrExpFuncName[CALL];
javascript << L"Translate";
- } else if (funcName.AsStringC() == L"Exists") {
+ } else if (funcName.AsStringView() == L"Exists") {
isExistsFunc = true;
javascript << gs_lpStrExpFuncName[CALL];
javascript << funcName;
@@ -655,7 +655,7 @@
uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
- CFX_WideStringC wsIdentifier,
+ WideStringView wsIdentifier,
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp)
: CXFA_FMBinExpression(line,
op,
@@ -745,7 +745,7 @@
uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
- CFX_WideStringC wsIdentifier,
+ WideStringView wsIdentifier,
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp)
: CXFA_FMBinExpression(line,
op,
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
index a9e9f90..864c822 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
@@ -45,7 +45,7 @@
class CFX_WideTextBuf;
-CFX_WideStringC XFA_FM_EXPTypeToString(
+WideStringView XFA_FM_EXPTypeToString(
XFA_FM_SimpleExpressionType simpleExpType);
enum XFA_FM_AccessorIndex {
@@ -78,32 +78,32 @@
class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression {
public:
- CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber);
+ CXFA_FMNumberExpression(uint32_t line, WideStringView wsNumber);
~CXFA_FMNumberExpression() override;
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
- CFX_WideStringC m_wsNumber;
+ WideStringView m_wsNumber;
};
class CXFA_FMStringExpression : public CXFA_FMSimpleExpression {
public:
- CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString);
+ CXFA_FMStringExpression(uint32_t line, WideStringView wsString);
~CXFA_FMStringExpression() override;
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
- CFX_WideStringC m_wsString;
+ WideStringView m_wsString;
};
class CXFA_FMIdentifierExpression : public CXFA_FMSimpleExpression {
public:
- CXFA_FMIdentifierExpression(uint32_t line, CFX_WideStringC wsIdentifier);
+ CXFA_FMIdentifierExpression(uint32_t line, WideStringView wsIdentifier);
~CXFA_FMIdentifierExpression() override;
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
- CFX_WideStringC m_wsIdentifier;
+ WideStringView m_wsIdentifier;
};
class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression {
@@ -240,7 +240,7 @@
~CXFA_FMCallExpression() override;
bool IsBuiltInFunc(CFX_WideTextBuf* funcName);
- uint32_t IsMethodWithObjParam(const CFX_WideString& methodName);
+ uint32_t IsMethodWithObjParam(const WideString& methodName);
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
@@ -254,13 +254,13 @@
uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
- CFX_WideStringC wsIdentifier,
+ WideStringView wsIdentifier,
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp);
~CXFA_FMDotAccessorExpression() override;
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
- CFX_WideStringC m_wsIdentifier;
+ WideStringView m_wsIdentifier;
};
class CXFA_FMIndexExpression : public CXFA_FMUnaryExpression {
@@ -283,14 +283,14 @@
uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
- CFX_WideStringC wsIdentifier,
+ WideStringView wsIdentifier,
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp);
~CXFA_FMDotDotAccessorExpression() override;
bool ToJavaScript(CFX_WideTextBuf& javascript) override;
private:
- CFX_WideStringC m_wsIdentifier;
+ WideStringView m_wsIdentifier;
};
class CXFA_FMMethodCallExpression : public CXFA_FMBinExpression {
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
index 58ddbac..5f4d83c 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
@@ -27,7 +27,7 @@
callExp.ToJavaScript(js);
// Generate the result javascript string.
- CFX_WideString result = L"sign(";
+ WideString result = L"sign(";
for (size_t i = 0; i < 50; i++) {
if (i > 0)
result += L", ";
@@ -41,31 +41,31 @@
}
result += L")";
- EXPECT_EQ(result.AsStringC(), js.AsStringC());
+ EXPECT_EQ(result.AsStringView(), js.AsStringView());
}
TEST(FMStringExpressionTest, Empty) {
CFX_WideTextBuf accumulator;
- CXFA_FMStringExpression(1, CFX_WideStringC()).ToJavaScript(accumulator);
- EXPECT_EQ(L"", accumulator.AsStringC());
+ CXFA_FMStringExpression(1, WideStringView()).ToJavaScript(accumulator);
+ EXPECT_EQ(L"", accumulator.AsStringView());
}
TEST(FMStringExpressionTest, Short) {
CFX_WideTextBuf accumulator;
CXFA_FMStringExpression(1, L"a").ToJavaScript(accumulator);
- EXPECT_EQ(L"a", accumulator.AsStringC());
+ EXPECT_EQ(L"a", accumulator.AsStringView());
}
TEST(FMStringExpressionTest, Medium) {
CFX_WideTextBuf accumulator;
CXFA_FMStringExpression(1, L".abcd.").ToJavaScript(accumulator);
- EXPECT_EQ(L"\"abcd\"", accumulator.AsStringC());
+ EXPECT_EQ(L"\"abcd\"", accumulator.AsStringView());
}
TEST(FMStringExpressionTest, Long) {
CFX_WideTextBuf accumulator;
- std::vector<CFX_WideStringC::UnsignedType> vec(140000, L'A');
- CXFA_FMStringExpression(1, CFX_WideStringC(vec)).ToJavaScript(accumulator);
+ std::vector<WideStringView::UnsignedType> vec(140000, L'A');
+ CXFA_FMStringExpression(1, WideStringView(vec)).ToJavaScript(accumulator);
EXPECT_EQ(140000u, accumulator.GetLength());
}
@@ -73,5 +73,5 @@
CFX_WideTextBuf accumulator;
CXFA_FMStringExpression(1, L".Simon says \"\"run\"\".")
.ToJavaScript(accumulator);
- EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringC());
+ EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringView());
}
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index dfd4f34..b8595d4 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -114,22 +114,22 @@
/**
* Returns the language of the running host application. Such as zh_CN
*/
- virtual CFX_WideString GetLanguage() = 0;
+ virtual WideString GetLanguage() = 0;
/**
* Returns the platform of the machine running the script. Such as WIN
*/
- virtual CFX_WideString GetPlatform() = 0;
+ virtual WideString GetPlatform() = 0;
/**
* Get application name, such as Phantom.
*/
- virtual CFX_WideString GetAppName() = 0;
+ virtual WideString GetAppName() = 0;
/**
* Get application message box title.
*/
- virtual CFX_WideString GetAppTitle() const = 0;
+ virtual WideString GetAppTitle() const = 0;
/**
* Causes the system to play a sound.
@@ -147,8 +147,8 @@
* @return A valid integer representing the value of the button pressed by the
* user, refer to XFA_ID.
*/
- virtual int32_t MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle = L"",
+ virtual int32_t MsgBox(const WideString& wsMessage,
+ const WideString& wsTitle = L"",
uint32_t dwIconType = 0,
uint32_t dwButtonType = 0) = 0;
@@ -160,10 +160,10 @@
* @param[in] bMask - Mask the user input with asterisks when true,
* @return A string containing the user's response.
*/
- virtual CFX_WideString Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle = L"",
- const CFX_WideString& wsDefaultAnswer = L"",
- bool bMask = true) = 0;
+ virtual WideString Response(const WideString& wsQuestion,
+ const WideString& wsTitle = L"",
+ const WideString& wsDefaultAnswer = L"",
+ bool bMask = true) = 0;
/**
* Download something from somewhere.
@@ -171,7 +171,7 @@
* "http://www.w3.org/TR/REC-xml-names/".
*/
virtual CFX_RetainPtr<IFX_SeekableReadStream> DownloadURL(
- const CFX_WideString& wsURL) = 0;
+ const WideString& wsURL) = 0;
/**
* POST data to the given url.
@@ -188,12 +188,12 @@
* @param[out] wsResponse decoded response from server.
* @return true Server permitted the post request, false otherwise.
*/
- virtual bool PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) = 0;
+ virtual bool PostRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsContentType,
+ const WideString& wsEncode,
+ const WideString& wsHeader,
+ WideString& wsResponse) = 0;
/**
* PUT data to the given url.
@@ -203,9 +203,9 @@
* ISO8859-1, any recognized [IANA]character encoding
* @return true Server permitted the post request, false otherwise.
*/
- virtual bool PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) = 0;
+ virtual bool PutRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsEncode) = 0;
virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
};
@@ -237,12 +237,12 @@
virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0;
virtual bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) = 0;
virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) = 0;
- virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0;
- virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) = 0;
+ virtual void GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) = 0;
+ virtual void SetTitle(CXFA_FFDoc* hDoc, const WideString& wsTitle) = 0;
virtual void ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
+ const WideString& wsFilePath,
bool bXDP) = 0;
- virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) = 0;
+ virtual void GotoURL(CXFA_FFDoc* hDoc, const WideString& bsURL) = 0;
virtual bool IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0;
virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) = 0;
virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0;
@@ -254,14 +254,14 @@
virtual bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0;
virtual bool GetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) = 0;
virtual bool SetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) = 0;
virtual CFX_RetainPtr<IFX_SeekableReadStream> OpenLinkedFile(
CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) = 0;
+ const WideString& wsLink) = 0;
};
class IXFA_WidgetIterator {
diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp
index e2d9f04..c5b09d1 100644
--- a/xfa/fxfa/parser/cscript_datawindow.cpp
+++ b/xfa/fxfa/parser/cscript_datawindow.cpp
@@ -15,7 +15,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::DataWindow,
- CFX_WideStringC(L"dataWindow")) {}
+ WideStringView(L"dataWindow")) {}
CScript_DataWindow::~CScript_DataWindow() {}
diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
index 45f1171..ecf2a98 100644
--- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
@@ -17,14 +17,12 @@
namespace {
-void StringProperty(CFXJSE_Value* pValue,
- CFX_WideString& wsValue,
- bool bSetting) {
+void StringProperty(CFXJSE_Value* pValue, WideString& wsValue, bool bSetting) {
if (bSetting) {
wsValue = pValue->ToWideString();
return;
}
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
void InterProperty(CFXJSE_Value* pValue, int32_t& iValue, bool bSetting) {
@@ -49,7 +47,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::EventPseudoModel,
- CFX_WideStringC(L"eventPseudoModel")) {}
+ WideStringView(L"eventPseudoModel")) {}
CScript_EventPseudoModel::~CScript_EventPseudoModel() {}
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index 2db6677..f1eaff8 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -30,7 +30,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::HostPseudoModel,
- CFX_WideStringC(L"hostPseudoModel")) {}
+ WideStringView(L"hostPseudoModel")) {}
CScript_HostPseudoModel::~CScript_HostPseudoModel() {}
@@ -89,7 +89,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringC());
+ pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue,
@@ -118,7 +118,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringC());
+ pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue,
@@ -136,9 +136,9 @@
pNotify->GetDocEnvironment()->SetTitle(hDoc, pValue->ToWideString());
return;
}
- CFX_WideString wsTitle;
+ WideString wsTitle;
pNotify->GetDocEnvironment()->GetTitle(hDoc, wsTitle);
- pValue->SetString(wsTitle.UTF8Encode().AsStringC());
+ pValue->SetString(wsTitle.UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue,
@@ -200,7 +200,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringC());
+ pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) {
@@ -217,10 +217,10 @@
return;
}
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CFX_WideString wsURL;
+ WideString wsURL;
if (iLength >= 1) {
- CFX_ByteString bsURL = pArguments->GetUTF8String(0);
- wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC());
+ ByteString bsURL = pArguments->GetUTF8String(0);
+ wsURL = WideString::FromUTF8(bsURL.AsStringView());
}
pNotify->GetDocEnvironment()->GotoURL(hDoc, wsURL);
}
@@ -256,7 +256,7 @@
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag);
+ pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag);
if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
return;
@@ -285,39 +285,39 @@
if (!pNotify) {
return;
}
- CFX_WideString wsQuestion;
- CFX_WideString wsTitle;
- CFX_WideString wsDefaultAnswer;
+ WideString wsQuestion;
+ WideString wsTitle;
+ WideString wsDefaultAnswer;
bool bMark = false;
if (iLength >= 1) {
- CFX_ByteString bsQuestion = pArguments->GetUTF8String(0);
- wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC());
+ ByteString bsQuestion = pArguments->GetUTF8String(0);
+ wsQuestion = WideString::FromUTF8(bsQuestion.AsStringView());
}
if (iLength >= 2) {
- CFX_ByteString bsTitle = pArguments->GetUTF8String(1);
- wsTitle = CFX_WideString::FromUTF8(bsTitle.AsStringC());
+ ByteString bsTitle = pArguments->GetUTF8String(1);
+ wsTitle = WideString::FromUTF8(bsTitle.AsStringView());
}
if (iLength >= 3) {
- CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2);
- wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC());
+ ByteString bsDefaultAnswer = pArguments->GetUTF8String(2);
+ wsDefaultAnswer = WideString::FromUTF8(bsDefaultAnswer.AsStringView());
}
if (iLength >= 4) {
bMark = pArguments->GetInt32(3) == 0 ? false : true;
}
- CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response(
+ WideString wsAnswer = pNotify->GetAppProvider()->Response(
wsQuestion, wsTitle, wsDefaultAnswer, bMark);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetString(wsAnswer.UTF8Encode().AsStringC());
+ pValue->SetString(wsAnswer.UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) {
if (CFXJSE_Value* pValue = pArguments->GetReturnValue())
pValue->SetInteger(0);
}
-static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
+static int32_t XFA_FilterName(const WideStringView& wsExpression,
int32_t nStart,
- CFX_WideString& wsFilter) {
+ WideString& wsFilter) {
ASSERT(nStart > -1);
int32_t iLength = wsExpression.GetLength();
if (nStart >= iLength) {
@@ -349,21 +349,21 @@
if (!pNotify) {
return;
}
- CFX_WideString wsExpression;
+ WideString wsExpression;
if (iLength >= 1) {
- CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
- wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
+ ByteString bsExpression = pArguments->GetUTF8String(0);
+ wsExpression = WideString::FromUTF8(bsExpression.AsStringView());
}
if (wsExpression.IsEmpty()) {
pNotify->ResetData();
return;
}
int32_t iStart = 0;
- CFX_WideString wsName;
+ WideString wsName;
CXFA_Node* pNode = nullptr;
int32_t iExpLength = wsExpression.GetLength();
while (iStart < iExpLength) {
- iStart = XFA_FilterName(wsExpression.AsStringC(), iStart, wsName);
+ iStart = XFA_FilterName(wsExpression.AsStringView(), iStart, wsName);
CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
if (!pScriptContext)
return;
@@ -375,8 +375,8 @@
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
- int32_t iRet = pScriptContext->ResolveObjects(pObject, wsName.AsStringC(),
- resoveNodeRS, dwFlag);
+ int32_t iRet = pScriptContext->ResolveObjects(
+ pObject, wsName.AsStringView(), resoveNodeRS, dwFlag);
if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode()) {
continue;
}
@@ -437,7 +437,7 @@
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag);
+ pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag);
if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
return;
@@ -472,8 +472,8 @@
if (!pNotify) {
return;
}
- CFX_WideString wsMessage;
- CFX_WideString bsTitle;
+ WideString wsMessage;
+ WideString bsTitle;
uint32_t dwMessageType = XFA_MBICON_Error;
uint32_t dwButtonType = XFA_MB_OK;
if (iLength >= 1) {
@@ -506,7 +506,7 @@
}
bool CScript_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments,
int32_t iArgIndex,
- CFX_WideString& wsValue) {
+ WideString& wsValue) {
if (!pArguments || iArgIndex < 0) {
return false;
}
@@ -621,11 +621,11 @@
return;
}
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CFX_WideString wsFilePath;
+ WideString wsFilePath;
bool bXDP = true;
if (iLength >= 1) {
- CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
- wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
+ ByteString bsFilePath = pArguments->GetUTF8String(0);
+ wsFilePath = WideString::FromUTF8(bsFilePath.AsStringView());
}
if (iLength >= 2) {
bXDP = pArguments->GetInt32(1) == 0 ? false : true;
@@ -673,10 +673,10 @@
if (!pNotify) {
return;
}
- CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
+ WideString wsDataTime = pNotify->GetCurrentDateTime();
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetString(wsDataTime.UTF8Encode().AsStringC());
+ pValue->SetString(wsDataTime.UTF8Encode().AsStringView());
}
void CScript_HostPseudoModel::ThrowSetLanguageException() const {
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h
index 821f88d..4ec92dd 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.h
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h
@@ -54,7 +54,7 @@
private:
bool ValidateArgsForMsg(CFXJSE_Arguments* pArguments,
int32_t iArgIndex,
- CFX_WideString& wsValue);
+ WideString& wsValue);
void ThrowSetLanguageException() const;
void ThrowSetNumPagesException() const;
void ThrowSetPlatformException() const;
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index 46db2ca..e35a3b8 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -28,7 +28,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::LayoutPseudoModel,
- CFX_WideStringC(L"layoutPseudoModel")) {}
+ WideStringView(L"layoutPseudoModel")) {}
CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {}
@@ -73,11 +73,11 @@
if (!pNode)
return;
- CFX_WideString wsUnit(L"pt");
+ WideString wsUnit(L"pt");
if (iLength >= 2) {
- CFX_ByteString bsUnit = pArguments->GetUTF8String(1);
+ ByteString bsUnit = pArguments->GetUTF8String(1);
if (!bsUnit.IsEmpty())
- wsUnit = CFX_WideString::FromUTF8(bsUnit.AsStringC());
+ wsUnit = WideString::FromUTF8(bsUnit.AsStringView());
}
int32_t iIndex = iLength >= 3 ? pArguments->GetInt32(2) : 0;
@@ -116,8 +116,8 @@
measure.Set(rtRect.top, XFA_UNIT_Pt);
break;
}
- float fValue =
- measure.ToUnit(CXFA_Measurement::GetUnitFromString(wsUnit.AsStringC()));
+ float fValue = measure.ToUnit(
+ CXFA_Measurement::GetUnitFromString(wsUnit.AsStringView()));
fValue = FXSYS_round(fValue * 1000) / 1000.0f;
pValue->SetFloat(fValue);
}
@@ -203,7 +203,7 @@
std::vector<CXFA_Node*> CScript_LayoutPseudoModel::GetObjArray(
CXFA_LayoutProcessor* pDocLayout,
int32_t iPageNo,
- const CFX_WideString& wsType,
+ const WideString& wsType,
bool bOnPageArea) {
CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo);
if (!pLayoutPage)
@@ -338,14 +338,14 @@
return;
}
int32_t iIndex = 0;
- CFX_WideString wsType;
+ WideString wsType;
bool bOnPageArea = false;
if (iLength >= 1)
iIndex = pArguments->GetInt32(0);
if (iLength >= 2) {
- CFX_ByteString bsType = pArguments->GetUTF8String(1);
- wsType = CFX_WideString::FromUTF8(bsType.AsStringC());
+ ByteString bsType = pArguments->GetUTF8String(1);
+ wsType = WideString::FromUTF8(bsType.AsStringView());
}
if (iLength >= 3)
bOnPageArea = pArguments->GetInt32(2) == 0 ? false : true;
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/xfa/fxfa/parser/cscript_layoutpseudomodel.h
index 6f98997..539fcce 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h
@@ -53,7 +53,7 @@
private:
std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout,
int32_t iPageNo,
- const CFX_WideString& wsType,
+ const WideString& wsType,
bool bOnPageArea);
void PageInternals(CFXJSE_Arguments* pArguments, bool bAbsPage);
diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp
index d9563ac..f0747f4 100644
--- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp
@@ -15,7 +15,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::LogPseudoModel,
- CFX_WideStringC(L"logPseudoModel")) {}
+ WideStringView(L"logPseudoModel")) {}
CScript_LogPseudoModel::~CScript_LogPseudoModel() {}
diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
index c746a4e..a1136b1 100644
--- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
@@ -18,7 +18,7 @@
: CXFA_Object(pDocument,
XFA_ObjectType::Object,
XFA_Element::SignaturePseudoModel,
- CFX_WideStringC(L"signaturePseudoModel")) {}
+ WideStringView(L"signaturePseudoModel")) {}
CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {}
diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp
index aac2c18..72373ae 100644
--- a/xfa/fxfa/parser/cxfa_bind.cpp
+++ b/xfa/fxfa/parser/cxfa_bind.cpp
@@ -10,7 +10,7 @@
CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_Bind::GetPicture(CFX_WideString& wsPicture) {
+void CXFA_Bind::GetPicture(WideString& wsPicture) {
if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_Element::Picture))
pPicture->TryContent(wsPicture);
}
diff --git a/xfa/fxfa/parser/cxfa_bind.h b/xfa/fxfa/parser/cxfa_bind.h
index 40a2a1a..b24e6f8 100644
--- a/xfa/fxfa/parser/cxfa_bind.h
+++ b/xfa/fxfa/parser/cxfa_bind.h
@@ -16,7 +16,7 @@
public:
explicit CXFA_Bind(CXFA_Node* pNode);
- void GetPicture(CFX_WideString& wsPicture);
+ void GetPicture(WideString& wsPicture);
};
#endif // XFA_FXFA_PARSER_CXFA_BIND_H_
diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp
index c3c5cab..c6dbdb3 100644
--- a/xfa/fxfa/parser/cxfa_binditems.cpp
+++ b/xfa/fxfa/parser/cxfa_binditems.cpp
@@ -10,18 +10,18 @@
CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_BindItems::GetLabelRef(CFX_WideStringC& wsLabelRef) {
+void CXFA_BindItems::GetLabelRef(WideStringView& wsLabelRef) {
m_pNode->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef);
}
-void CXFA_BindItems::GetValueRef(CFX_WideStringC& wsValueRef) {
+void CXFA_BindItems::GetValueRef(WideStringView& wsValueRef) {
m_pNode->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef);
}
-void CXFA_BindItems::GetRef(CFX_WideStringC& wsRef) {
+void CXFA_BindItems::GetRef(WideStringView& wsRef) {
m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
}
-bool CXFA_BindItems::SetConnection(const CFX_WideString& wsConnection) {
+bool CXFA_BindItems::SetConnection(const WideString& wsConnection) {
return m_pNode->SetCData(XFA_ATTRIBUTE_Connection, wsConnection);
}
diff --git a/xfa/fxfa/parser/cxfa_binditems.h b/xfa/fxfa/parser/cxfa_binditems.h
index 191941a..58e50da 100644
--- a/xfa/fxfa/parser/cxfa_binditems.h
+++ b/xfa/fxfa/parser/cxfa_binditems.h
@@ -16,10 +16,10 @@
public:
explicit CXFA_BindItems(CXFA_Node* pNode);
- void GetLabelRef(CFX_WideStringC& wsLabelRef);
- void GetValueRef(CFX_WideStringC& wsValueRef);
- void GetRef(CFX_WideStringC& wsRef);
- bool SetConnection(const CFX_WideString& wsConnection);
+ void GetLabelRef(WideStringView& wsLabelRef);
+ void GetValueRef(WideStringView& wsValueRef);
+ void GetRef(WideStringView& wsRef);
+ bool SetConnection(const WideString& wsConnection);
};
#endif // XFA_FXFA_PARSER_CXFA_BINDITEMS_H_
diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp
index bc89d81..3b0f038 100644
--- a/xfa/fxfa/parser/cxfa_calculate.cpp
+++ b/xfa/fxfa/parser/cxfa_calculate.cpp
@@ -21,7 +21,7 @@
return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script));
}
-void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) {
+void CXFA_Calculate::GetMessageText(WideString& wsMessage) {
CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message);
if (!pNode)
return;
diff --git a/xfa/fxfa/parser/cxfa_calculate.h b/xfa/fxfa/parser/cxfa_calculate.h
index 1012224..b3a6ef2 100644
--- a/xfa/fxfa/parser/cxfa_calculate.h
+++ b/xfa/fxfa/parser/cxfa_calculate.h
@@ -19,7 +19,7 @@
int32_t GetOverride();
CXFA_Script GetScript();
- void GetMessageText(CFX_WideString& wsMessage);
+ void GetMessageText(WideString& wsMessage);
};
#endif // XFA_FXFA_PARSER_CXFA_CALCULATE_H_
diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp
index 7bf18a5..5a82ce3 100644
--- a/xfa/fxfa/parser/cxfa_data.cpp
+++ b/xfa/fxfa/parser/cxfa_data.cpp
@@ -11,7 +11,7 @@
#include "xfa/fxfa/parser/cxfa_node.h"
// Static.
-FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
+FX_ARGB CXFA_Data::ToColor(const WideStringView& wsValue) {
uint8_t r = 0, g = 0, b = 0;
if (wsValue.GetLength() == 0)
return 0xff000000;
diff --git a/xfa/fxfa/parser/cxfa_data.h b/xfa/fxfa/parser/cxfa_data.h
index 90b6890..4a073ab 100644
--- a/xfa/fxfa/parser/cxfa_data.h
+++ b/xfa/fxfa/parser/cxfa_data.h
@@ -15,7 +15,7 @@
class CXFA_Data {
public:
- static FX_ARGB ToColor(const CFX_WideStringC& wsValue);
+ static FX_ARGB ToColor(const WideStringView& wsValue);
explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {}
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 0af9bd4..edc7b23 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -22,7 +22,7 @@
namespace {
-CFX_WideString ExportEncodeAttribute(const CFX_WideString& str) {
+WideString ExportEncodeAttribute(const WideString& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
for (int32_t i = 0; i < iLen; i++) {
@@ -54,7 +54,7 @@
(ch >= 0x20 && ch <= 0xD7FF) || (ch >= 0xE000 && ch <= 0xFFFD);
}
-CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) {
+WideString ExportEncodeContent(const WideStringView& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
for (int32_t i = 0; i < iLen; i++) {
@@ -87,10 +87,10 @@
void SaveAttribute(CXFA_Node* pNode,
XFA_ATTRIBUTE eName,
- const CFX_WideStringC& wsName,
+ const WideStringView& wsName,
bool bProto,
- CFX_WideString& wsOutput) {
- CFX_WideString wsValue;
+ WideString& wsOutput) {
+ WideString wsValue;
if ((!bProto && !pNode->HasAttribute((XFA_ATTRIBUTE)eName, bProto)) ||
!pNode->GetAttribute((XFA_ATTRIBUTE)eName, wsValue, false)) {
return;
@@ -121,7 +121,7 @@
}
bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) {
- CFX_WideString wsContent;
+ WideString wsContent;
if (!pContentNode->TryContent(wsContent, false, false))
return false;
@@ -144,12 +144,12 @@
}
void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot,
- CFX_WideString& wsVersionNumber) {
+ WideString& wsVersionNumber) {
wsVersionNumber.clear();
if (!pTemplateRoot)
return;
- CFX_WideString wsTemplateNS;
+ WideString wsTemplateNS;
if (!pTemplateRoot->TryNamespace(wsTemplateNS))
return;
@@ -164,7 +164,7 @@
void RegenerateFormFile_Changed(CXFA_Node* pNode,
CFX_WideTextBuf& buf,
bool bSaveXML) {
- CFX_WideString wsAttrs;
+ WideString wsAttrs;
int32_t iAttrs = 0;
const uint8_t* pAttrs =
XFA_GetElementAttributes(pNode->GetElementType(), iAttrs);
@@ -175,12 +175,12 @@
(AttributeSaveInDataModel(pNode, pAttr->eName) && !bSaveXML)) {
continue;
}
- CFX_WideString wsAttr;
+ WideString wsAttr;
SaveAttribute(pNode, pAttr->eName, pAttr->pName, bSaveXML, wsAttr);
wsAttrs += wsAttr;
}
- CFX_WideString wsChildren;
+ WideString wsChildren;
switch (pNode->GetObjectType()) {
case XFA_ObjectType::ContentNode: {
if (!bSaveXML && !ContentNodeNeedtoExport(pNode))
@@ -196,7 +196,7 @@
if (!pRawValueNode)
break;
- CFX_WideString wsContentType;
+ WideString wsContentType;
pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML &&
wsContentType == L"text/html") {
@@ -215,16 +215,16 @@
pTempStream->SetCodePage(FX_CODEPAGE_UTF8);
pRichTextXML->SaveXMLNode(pTempStream);
- wsChildren += CFX_WideString::FromUTF8(
- CFX_ByteStringC(pMemStream->GetBuffer(), pMemStream->GetSize()));
+ wsChildren += WideString::FromUTF8(
+ ByteStringView(pMemStream->GetBuffer(), pMemStream->GetSize()));
} else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml &&
wsContentType == L"text/xml") {
- CFX_WideString wsRawValue;
+ WideString wsRawValue;
pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, false);
if (wsRawValue.IsEmpty())
break;
- std::vector<CFX_WideString> wsSelTextArray;
+ std::vector<WideString> wsSelTextArray;
FX_STRSIZE iStart = 0;
auto iEnd = wsRawValue.Find(L'\n', iStart);
iEnd = !iEnd.has_value() ? wsRawValue.GetLength() : iEnd;
@@ -241,7 +241,7 @@
CXFA_Node* pGrandparentNode =
pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
ASSERT(pGrandparentNode);
- CFX_WideString bodyTagName;
+ WideString bodyTagName;
bodyTagName = pGrandparentNode->GetCData(XFA_ATTRIBUTE_Name);
if (bodyTagName.IsEmpty())
bodyTagName = L"ListBox1";
@@ -252,16 +252,16 @@
for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(wsSelTextArray);
i++) {
buf << L"<value\n>";
- buf << ExportEncodeContent(wsSelTextArray[i].AsStringC());
+ buf << ExportEncodeContent(wsSelTextArray[i].AsStringView());
buf << L"</value\n>";
}
buf << L"</";
buf << bodyTagName;
buf << L"\n>";
- wsChildren += buf.AsStringC();
+ wsChildren += buf.AsStringView();
buf.Clear();
} else {
- CFX_WideStringC wsValue = pRawValueNode->GetCData(XFA_ATTRIBUTE_Value);
+ WideStringView wsValue = pRawValueNode->GetCData(XFA_ATTRIBUTE_Value);
wsChildren += ExportEncodeContent(wsValue);
}
break;
@@ -269,7 +269,7 @@
case XFA_ObjectType::TextNode:
case XFA_ObjectType::NodeC:
case XFA_ObjectType::NodeV: {
- CFX_WideStringC wsValue = pNode->GetCData(XFA_ATTRIBUTE_Value);
+ WideStringView wsValue = pNode->GetCData(XFA_ATTRIBUTE_Value);
wsChildren += ExportEncodeContent(wsValue);
break;
}
@@ -286,7 +286,7 @@
CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pChildNode) {
RegenerateFormFile_Changed(pChildNode, newBuf, bSaveXML);
- wsChildren += newBuf.AsStringC();
+ wsChildren += newBuf.AsStringView();
newBuf.Clear();
pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
}
@@ -297,7 +297,7 @@
CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pChild) {
RegenerateFormFile_Changed(pChild, newBuf, bSaveXML);
- wsChildren += newBuf.AsStringC();
+ wsChildren += newBuf.AsStringView();
newBuf.Clear();
pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
}
@@ -307,8 +307,8 @@
if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() ||
pNode->HasAttribute(XFA_ATTRIBUTE_Name)) {
- CFX_WideStringC wsElement = pNode->GetClassName();
- CFX_WideString wsName;
+ WideStringView wsElement = pNode->GetClassName();
+ WideString wsName;
SaveAttribute(pNode, XFA_ATTRIBUTE_Name, L"name", true, wsName);
buf << L"<";
buf << wsElement;
@@ -337,18 +337,18 @@
RegenerateFormFile_Changed(pNode, buf, bSaveXML);
FX_STRSIZE nLen = buf.GetLength();
if (nLen > 0)
- pStream->WriteString(buf.AsStringC());
+ pStream->WriteString(buf.AsStringView());
return;
}
- CFX_WideStringC wsElement(pNode->GetClassName());
+ WideStringView wsElement(pNode->GetClassName());
pStream->WriteString(L"<");
pStream->WriteString(wsElement);
- CFX_WideString wsOutput;
+ WideString wsOutput;
SaveAttribute(pNode, XFA_ATTRIBUTE_Name, L"name", true, wsOutput);
- CFX_WideString wsAttrs;
+ WideString wsAttrs;
int32_t iAttrs = 0;
const uint8_t* pAttrs =
XFA_GetElementAttributes(pNode->GetElementType(), iAttrs);
@@ -358,13 +358,13 @@
if (pAttr->eName == XFA_ATTRIBUTE_Name)
continue;
- CFX_WideString wsAttr;
+ WideString wsAttr;
SaveAttribute(pNode, pAttr->eName, pAttr->pName, false, wsAttr);
wsOutput += wsAttr;
}
if (!wsOutput.IsEmpty())
- pStream->WriteString(wsOutput.AsStringC());
+ pStream->WriteString(wsOutput.AsStringView());
CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode) {
@@ -391,17 +391,17 @@
if (pNode->IsModelNode()) {
pStream->WriteString(L"<form");
if (pChecksum) {
- CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum);
+ WideString wsChecksum = WideString::FromUTF8(pChecksum);
pStream->WriteString(L" checksum=\"");
- pStream->WriteString(wsChecksum.AsStringC());
+ pStream->WriteString(wsChecksum.AsStringView());
pStream->WriteString(L"\"");
}
pStream->WriteString(L" xmlns=\"");
const wchar_t* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI;
- pStream->WriteString(CFX_WideStringC(pURI, FXSYS_wcslen(pURI)));
+ pStream->WriteString(WideStringView(pURI, FXSYS_wcslen(pURI)));
- CFX_WideString wsVersionNumber;
+ WideString wsVersionNumber;
RecognizeXFAVersionNumber(
ToNode(pNode->GetDocument()->GetXFAObject(XFA_HASHCODE_Template)),
wsVersionNumber);
@@ -409,7 +409,7 @@
wsVersionNumber = L"2.8";
wsVersionNumber += L"/\"\n>";
- pStream->WriteString(wsVersionNumber.AsStringC());
+ pStream->WriteString(wsVersionNumber.AsStringView());
CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pChildNode) {
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 85d2758..3a46e26 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -151,11 +151,11 @@
if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data)
continue;
- CFX_WideString wsNamespaceURI;
+ WideString wsNamespaceURI;
if (!pDatasetsChild->TryNamespace(wsNamespaceURI))
continue;
- CFX_WideString wsDatasetsURI;
+ WideString wsDatasetsURI;
if (!pDatasetsNode->TryNamespace(wsDatasetsURI))
continue;
if (wsNamespaceURI == wsDatasetsURI)
@@ -255,7 +255,7 @@
if (!pConfig)
return false;
- CFX_WideString wsInteractive;
+ WideString wsInteractive;
CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present);
if (!pPresent)
return false;
@@ -297,11 +297,11 @@
}
XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
- const CFX_WideString& wsTemplateNS) {
- CFX_WideStringC wsTemplateURIPrefix =
+ const WideString& wsTemplateNS) {
+ WideStringView wsTemplateURIPrefix =
XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI;
FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength();
- if (CFX_WideStringC(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) !=
+ if (WideStringView(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) !=
wsTemplateURIPrefix) {
return XFA_VERSION_UNKNOWN;
}
@@ -325,14 +325,14 @@
}
CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot,
- const CFX_WideStringC& wsID) {
+ const WideStringView& wsID) {
if (!pRoot || wsID.IsEmpty())
return nullptr;
CXFA_NodeIterator sIterator(pRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- CFX_WideStringC wsIDVal;
+ WideStringView wsIDVal;
if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) {
if (wsIDVal == wsID)
return pNode;
@@ -351,11 +351,11 @@
CXFA_NodeIterator sIterator(pTemplateRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- CFX_WideStringC wsIDVal;
+ WideStringView wsIDVal;
if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) {
mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode;
}
- CFX_WideStringC wsUseVal;
+ WideStringView wsUseVal;
if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) {
sUseNodes.insert(pNode);
} else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) &&
@@ -365,33 +365,33 @@
}
for (CXFA_Node* pUseHrefNode : sUseNodes) {
- CFX_WideString wsUseVal;
- CFX_WideStringC wsURI, wsID, wsSOM;
+ WideString wsUseVal;
+ WideStringView wsURI, wsID, wsSOM;
if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) &&
!wsUseVal.IsEmpty()) {
auto uSharpPos = wsUseVal.Find('#');
if (!uSharpPos.has_value()) {
- wsURI = wsUseVal.AsStringC();
+ wsURI = wsUseVal.AsStringView();
} else {
- wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos.value());
+ wsURI = WideStringView(wsUseVal.c_str(), uSharpPos.value());
FX_STRSIZE uLen = wsUseVal.GetLength();
if (uLen >= uSharpPos.value() + 5 &&
- CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value(), 5) ==
+ WideStringView(wsUseVal.c_str() + uSharpPos.value(), 5) ==
L"#som(" &&
wsUseVal[uLen - 1] == ')') {
- wsSOM = CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value() + 5,
- uLen - 1 - uSharpPos.value() - 5);
+ wsSOM = WideStringView(wsUseVal.c_str() + uSharpPos.value() + 5,
+ uLen - 1 - uSharpPos.value() - 5);
} else {
- wsID = CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value() + 1,
- uLen - uSharpPos.value() - 1);
+ wsID = WideStringView(wsUseVal.c_str() + uSharpPos.value() + 1,
+ uLen - uSharpPos.value() - 1);
}
}
} else if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) &&
!wsUseVal.IsEmpty()) {
if (wsUseVal[0] == '#')
- wsID = CFX_WideStringC(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1);
+ wsID = WideStringView(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1);
else
- wsSOM = CFX_WideStringC(wsUseVal.c_str(), wsUseVal.GetLength());
+ wsSOM = WideStringView(wsUseVal.c_str(), wsUseVal.GetLength());
}
if (!wsURI.IsEmpty() && wsURI != L".")
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 8491feb..69154b2 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -70,7 +70,7 @@
CXFA_FFNotify* GetNotify() const;
CXFA_LocaleMgr* GetLocalMgr();
CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
- CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID);
+ CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const WideStringView& wsID);
CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes);
CXFA_LayoutProcessor* GetLayoutProcessor();
CXFA_LayoutProcessor* GetDocLayout();
@@ -87,7 +87,7 @@
bool IsInteractive();
XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; }
- XFA_VERSION RecognizeXFAVersionNumber(const CFX_WideString& wsTemplateNS);
+ XFA_VERSION RecognizeXFAVersionNumber(const WideString& wsTemplateNS);
CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement);
CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement);
diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp
index d753428..d541ea0 100644
--- a/xfa/fxfa/parser/cxfa_event.cpp
+++ b/xfa/fxfa/parser/cxfa_event.cpp
@@ -26,7 +26,7 @@
return XFA_Element::Unknown;
}
-void CXFA_Event::GetRef(CFX_WideStringC& wsRef) {
+void CXFA_Event::GetRef(WideStringView& wsRef) {
m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
}
@@ -38,12 +38,12 @@
return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit));
}
-void CXFA_Event::GetSignDataTarget(CFX_WideString& wsTarget) {
+void CXFA_Event::GetSignDataTarget(WideString& wsTarget) {
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::SignData);
if (!pNode)
return;
- CFX_WideStringC wsCData;
+ WideStringView wsCData;
pNode->TryCData(XFA_ATTRIBUTE_Target, wsCData);
wsTarget = wsCData;
}
diff --git a/xfa/fxfa/parser/cxfa_event.h b/xfa/fxfa/parser/cxfa_event.h
index fc0bcf3..3835454 100644
--- a/xfa/fxfa/parser/cxfa_event.h
+++ b/xfa/fxfa/parser/cxfa_event.h
@@ -24,8 +24,8 @@
XFA_Element GetEventType() const;
CXFA_Script GetScript() const;
CXFA_Submit GetSubmit() const;
- void GetRef(CFX_WideStringC& wsRef);
- void GetSignDataTarget(CFX_WideString& wsTarget);
+ void GetRef(WideStringView& wsRef);
+ void GetSignDataTarget(WideString& wsTarget);
};
#endif // XFA_FXFA_PARSER_CXFA_EVENT_H_
diff --git a/xfa/fxfa/parser/cxfa_exdata.cpp b/xfa/fxfa/parser/cxfa_exdata.cpp
index ac82b30..8ba9d02 100644
--- a/xfa/fxfa/parser/cxfa_exdata.cpp
+++ b/xfa/fxfa/parser/cxfa_exdata.cpp
@@ -10,6 +10,6 @@
CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-bool CXFA_ExData::SetContentType(const CFX_WideString& wsContentType) {
+bool CXFA_ExData::SetContentType(const WideString& wsContentType) {
return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
}
diff --git a/xfa/fxfa/parser/cxfa_exdata.h b/xfa/fxfa/parser/cxfa_exdata.h
index c92bacd..03913a2 100644
--- a/xfa/fxfa/parser/cxfa_exdata.h
+++ b/xfa/fxfa/parser/cxfa_exdata.h
@@ -16,7 +16,7 @@
public:
explicit CXFA_ExData(CXFA_Node* pNode);
- bool SetContentType(const CFX_WideString& wsContentType);
+ bool SetContentType(const WideString& wsContentType);
};
#endif // XFA_FXFA_PARSER_CXFA_EXDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index 8a7969d..6b39134 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -18,7 +18,7 @@
void CXFA_Fill::SetColor(FX_ARGB color) {
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Color);
- CFX_WideString wsColor;
+ WideString wsColor;
int a;
int r;
int g;
@@ -30,7 +30,7 @@
FX_ARGB CXFA_Fill::GetColor(bool bText) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color)) {
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
if (pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor, false))
return CXFA_Data::ToColor(wsColor);
}
@@ -54,7 +54,7 @@
int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) {
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Pattern);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) {
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false);
foreColor = CXFA_Data::ToColor(wsColor);
} else {
@@ -68,7 +68,7 @@
int32_t eAttr = 50;
pNode->TryInteger(XFA_ATTRIBUTE_Rate, eAttr);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) {
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false);
stippleColor = CXFA_Data::ToColor(wsColor);
} else {
@@ -82,7 +82,7 @@
XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight;
pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) {
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false);
endColor = CXFA_Data::ToColor(wsColor);
} else {
@@ -96,7 +96,7 @@
XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge;
pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) {
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false);
endColor = CXFA_Data::ToColor(wsColor);
} else {
diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp
index 56e04b7..71aa617 100644
--- a/xfa/fxfa/parser/cxfa_font.cpp
+++ b/xfa/fxfa/parser/cxfa_font.cpp
@@ -18,21 +18,21 @@
}
float CXFA_Font::GetHorizontalScale() {
- CFX_WideString wsValue;
+ WideString wsValue;
m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue);
int32_t iScale = FXSYS_wtoi(wsValue.c_str());
return iScale > 0 ? (float)iScale : 100.0f;
}
float CXFA_Font::GetVerticalScale() {
- CFX_WideString wsValue;
+ WideString wsValue;
m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue);
int32_t iScale = FXSYS_wtoi(wsValue.c_str());
return iScale > 0 ? (float)iScale : 100.0f;
}
float CXFA_Font::GetLetterSpacing() {
- CFX_WideStringC wsValue;
+ WideStringView wsValue;
if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue))
return 0;
@@ -66,7 +66,7 @@
return ms.ToUnit(XFA_UNIT_Pt);
}
-void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) {
+void CXFA_Font::GetTypeface(WideStringView& wsTypeFace) {
m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace);
}
diff --git a/xfa/fxfa/parser/cxfa_font.h b/xfa/fxfa/parser/cxfa_font.h
index 2a5fef1..af0c348 100644
--- a/xfa/fxfa/parser/cxfa_font.h
+++ b/xfa/fxfa/parser/cxfa_font.h
@@ -24,7 +24,7 @@
int32_t GetUnderline();
int32_t GetUnderlinePeriod();
float GetFontSize();
- void GetTypeface(CFX_WideStringC& wsTypeFace);
+ void GetTypeface(WideStringView& wsTypeFace);
bool IsBold();
bool IsItalic();
diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp
index 8d14d62..b6d78d9 100644
--- a/xfa/fxfa/parser/cxfa_image.cpp
+++ b/xfa/fxfa/parser/cxfa_image.cpp
@@ -15,11 +15,11 @@
return m_pNode->GetEnum(XFA_ATTRIBUTE_Aspect);
}
-bool CXFA_Image::GetContentType(CFX_WideString& wsContentType) {
+bool CXFA_Image::GetContentType(WideString& wsContentType) {
return m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType);
}
-bool CXFA_Image::GetHref(CFX_WideString& wsHref) {
+bool CXFA_Image::GetHref(WideString& wsHref) {
if (m_bDefValue)
return m_pNode->TryCData(XFA_ATTRIBUTE_Href, wsHref);
return m_pNode->GetAttribute(L"href", wsHref);
@@ -31,18 +31,18 @@
return XFA_ATTRIBUTEENUM_Base64;
}
-bool CXFA_Image::GetContent(CFX_WideString& wsText) {
+bool CXFA_Image::GetContent(WideString& wsText) {
return m_pNode->TryContent(wsText);
}
-bool CXFA_Image::SetContentType(const CFX_WideString& wsContentType) {
+bool CXFA_Image::SetContentType(const WideString& wsContentType) {
return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
}
-bool CXFA_Image::SetHref(const CFX_WideString& wsHref) {
+bool CXFA_Image::SetHref(const WideString& wsHref) {
if (m_bDefValue)
return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref);
- return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsStringC());
+ return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsStringView());
}
bool CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) {
diff --git a/xfa/fxfa/parser/cxfa_image.h b/xfa/fxfa/parser/cxfa_image.h
index 204441a..cc08bc3 100644
--- a/xfa/fxfa/parser/cxfa_image.h
+++ b/xfa/fxfa/parser/cxfa_image.h
@@ -18,12 +18,12 @@
CXFA_Image(CXFA_Node* pNode, bool bDefValue);
int32_t GetAspect();
- bool GetContentType(CFX_WideString& wsContentType);
- bool GetHref(CFX_WideString& wsHref);
+ bool GetContentType(WideString& wsContentType);
+ bool GetHref(WideString& wsHref);
int32_t GetTransferEncoding();
- bool GetContent(CFX_WideString& wsText);
- bool SetContentType(const CFX_WideString& wsContentType);
- bool SetHref(const CFX_WideString& wsHref);
+ bool GetContent(WideString& wsText);
+ bool SetContentType(const WideString& wsContentType);
+ bool SetHref(const WideString& wsHref);
bool SetTransferEncoding(int32_t iTransferEncoding);
private:
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index f7a019d..7d9a218 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -29,10 +29,10 @@
namespace {
-std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr,
- int32_t iStrLen,
- wchar_t delimiter) {
- std::vector<CFX_WideString> ret;
+std::vector<WideString> SeparateStringW(const wchar_t* pStr,
+ int32_t iStrLen,
+ wchar_t delimiter) {
+ std::vector<WideString> ret;
if (!pStr)
return ret;
if (iStrLen < 0)
@@ -42,7 +42,7 @@
const wchar_t* pEnd = pStr + iStrLen;
while (true) {
if (pStr >= pEnd || delimiter == *pStr) {
- ret.push_back(CFX_WideString(pToken, pStr - pToken));
+ ret.push_back(WideString(pToken, pStr - pToken));
pToken = pStr + 1;
if (pStr >= pEnd)
break;
@@ -1746,7 +1746,7 @@
float fContentWidthLimit =
bContainerWidthAutoSize ? FLT_MAX
: containerSize.width - fLeftInset - fRightInset;
- CFX_WideStringC wsColumnWidths;
+ WideStringView wsColumnWidths;
if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
auto widths = SeparateStringW(wsColumnWidths.unterminated_c_str(),
wsColumnWidths.GetLength(), L' ');
@@ -1756,7 +1756,7 @@
continue;
m_rgSpecifiedColumnWidths.push_back(
- CXFA_Measurement(width.AsStringC()).ToUnit(XFA_UNIT_Pt));
+ CXFA_Measurement(width.AsStringView()).ToUnit(XFA_UNIT_Pt));
}
}
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index b80100a..d8fdbb4 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -65,7 +65,7 @@
uint32_t GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) {
uint32_t dwRelevant = XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable;
- CFX_WideStringC wsRelevant;
+ WideStringView wsRelevant;
if (pFormItem->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant)) {
if (wsRelevant == L"+print" || wsRelevant == L"print")
dwRelevant &= ~XFA_WidgetStatus_Viewable;
@@ -136,18 +136,18 @@
CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bNewExprStyle,
- CFX_WideStringC& wsTargetExpr) {
+ WideStringView& wsTargetExpr) {
CXFA_Document* pDocument = pPageSetRoot->GetDocument();
if (wsTargetExpr.IsEmpty())
return nullptr;
- CFX_WideString wsTargetAll(wsTargetExpr);
+ WideString wsTargetAll(wsTargetExpr);
wsTargetAll.TrimLeft();
wsTargetAll.TrimRight();
int32_t iSplitIndex = 0;
bool bTargetAllFind = true;
while (iSplitIndex != -1) {
- CFX_WideString wsExpr;
+ WideString wsExpr;
pdfium::Optional<FX_STRSIZE> iSplitNextIndex = 0;
if (!bTargetAllFind) {
iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex);
@@ -165,17 +165,17 @@
if (wsExpr[0] == '#') {
CXFA_Node* pNode = pDocument->GetNodeByID(
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
- wsExpr.Right(wsExpr.GetLength() - 1).AsStringC());
+ wsExpr.Right(wsExpr.GetLength() - 1).AsStringView());
if (pNode)
return pNode;
} else if (bNewExprStyle) {
- CFX_WideString wsProcessedTarget = wsExpr;
+ WideString wsProcessedTarget = wsExpr;
if (wsExpr.Left(4) == L"som(" && wsExpr.Last() == L')') {
wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5);
}
XFA_RESOLVENODE_RS rs;
int32_t iCount = pDocument->GetScriptContext()->ResolveObjects(
- pPageSetRoot, wsProcessedTarget.AsStringC(), rs,
+ pPageSetRoot, wsProcessedTarget.AsStringView(), rs,
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings |
XFA_RESOLVENODE_Parent);
@@ -477,7 +477,7 @@
}
bool XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) {
- CFX_WideString wsExpression;
+ WideString wsExpression;
pTestScript->TryContent(wsExpression);
if (wsExpression.IsEmpty())
return true;
@@ -801,7 +801,7 @@
switch (eType) {
case XFA_Element::BreakBefore:
case XFA_Element::BreakAfter: {
- CFX_WideStringC wsBreakLeader, wsBreakTrailer;
+ WideStringView wsBreakLeader, wsBreakTrailer;
CXFA_Node* pFormNode = pCurNode->GetNodeItem(
XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode);
CXFA_Node* pContainer = pFormNode->GetTemplateNode();
@@ -810,7 +810,7 @@
if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript))
return false;
- CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target);
+ WideStringView wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target);
CXFA_Node* pTarget =
ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget);
wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer);
@@ -845,7 +845,7 @@
}
case XFA_Element::Break: {
bool bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0;
- CFX_WideStringC wsTarget = pCurNode->GetCData(
+ WideStringView wsTarget = pCurNode->GetCData(
bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget);
CXFA_Node* pTarget =
ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget);
@@ -936,9 +936,9 @@
->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)
->GetTemplateNode();
if (pOverflowNode->GetElementType() == XFA_Element::Break) {
- CFX_WideStringC wsOverflowLeader;
- CFX_WideStringC wsOverflowTarget;
- CFX_WideStringC wsOverflowTrailer;
+ WideStringView wsOverflowLeader;
+ WideStringView wsOverflowTarget;
+ WideStringView wsOverflowTrailer;
pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader);
pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer);
pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget);
@@ -978,9 +978,9 @@
if (pOverflowNode->GetElementType() != XFA_Element::Overflow)
return nullptr;
- CFX_WideStringC wsOverflowLeader;
- CFX_WideStringC wsOverflowTrailer;
- CFX_WideStringC wsOverflowTarget;
+ WideStringView wsOverflowLeader;
+ WideStringView wsOverflowTrailer;
+ WideStringView wsOverflowTarget;
pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader);
pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer);
pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget);
@@ -1067,7 +1067,7 @@
CXFA_Node* pBookendNode,
bool bLeader,
CXFA_Node*& pBookendAppendTemplate) {
- CFX_WideStringC wsBookendLeader;
+ WideStringView wsBookendLeader;
CXFA_Node* pContainer =
pBookendNode
->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)
@@ -1642,9 +1642,9 @@
for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
- CFX_WideStringC wsOverflowLeader;
- CFX_WideStringC wsOverflowTarget;
- CFX_WideStringC wsOverflowTrailer;
+ WideStringView wsOverflowLeader;
+ WideStringView wsOverflowTarget;
+ WideStringView wsOverflowTrailer;
pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader);
pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer);
pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget);
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 833f72c..5d74c9b 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1078,7 +1078,7 @@
: nullptr;
}
-static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) {
+static uint16_t XFA_GetLanguage(WideString wsLanguage) {
if (wsLanguage.GetLength() < 2)
return FX_LANG_en_US;
@@ -1121,7 +1121,7 @@
return FX_LANG_en_US;
}
-CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid)
+CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid)
: m_dwLocaleFlags(0x00) {
m_dwDeflcid = XFA_GetLanguage(wsDeflcid);
if (pLocaleSet) {
@@ -1194,8 +1194,7 @@
}
}
-IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(
- const CFX_WideString& wsLocaleName) {
+IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(const WideString& wsLocaleName) {
for (size_t i = 0; i < m_LocaleArray.size(); i++) {
IFX_Locale* pLocale = m_LocaleArray[i].get();
if (pLocale->GetName() == wsLocaleName)
@@ -1220,7 +1219,7 @@
m_pDefLocale = pLocale;
}
-CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) {
+WideStringView CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) {
if (!(m_dwLocaleFlags & 0x01)) {
m_wsConfigLocale.clear();
if (pConfig) {
@@ -1242,5 +1241,5 @@
}
m_dwLocaleFlags |= 0x01;
}
- return m_wsConfigLocale.AsStringC();
+ return m_wsConfigLocale.AsStringView();
}
diff --git a/xfa/fxfa/parser/cxfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h
index f730304..d77a94a 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.h
+++ b/xfa/fxfa/parser/cxfa_localemgr.h
@@ -19,15 +19,15 @@
class CXFA_LocaleMgr {
public:
- CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
+ CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid);
~CXFA_LocaleMgr();
uint16_t GetDefLocaleID() const;
IFX_Locale* GetDefLocale();
- IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName);
+ IFX_Locale* GetLocaleByName(const WideString& wsLocaleName);
void SetDefLocale(IFX_Locale* pLocale);
- CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
+ WideStringView GetConfigLocaleName(CXFA_Node* pConfig);
private:
std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid);
@@ -35,7 +35,7 @@
std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray;
std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray;
IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray.
- CFX_WideString m_wsConfigLocale;
+ WideString m_wsConfigLocale;
uint16_t m_dwDeflcid;
uint16_t m_dwLocaleFlags;
};
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index dd56e6d..109254f 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -41,9 +41,9 @@
return FX_LOCALECATEGORY_Unknown;
}
-bool ValueSplitDateTime(const CFX_WideString& wsDateTime,
- CFX_WideString& wsDate,
- CFX_WideString& wsTime) {
+bool ValueSplitDateTime(const WideString& wsDateTime,
+ WideString& wsDate,
+ WideString& wsTime) {
wsDate = L"";
wsTime = L"";
if (wsDateTime.IsEmpty())
@@ -77,7 +77,7 @@
m_bValid(m_dwType != XFA_VT_NULL) {}
CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
+ const WideString& wsValue,
CXFA_LocaleMgr* pLocaleMgr)
: m_pLocaleMgr(pLocaleMgr),
m_wsValue(wsValue),
@@ -85,8 +85,8 @@
m_bValid(ValidateCanonicalValue(wsValue, dwType)) {}
CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- const CFX_WideString& wsFormat,
+ const WideString& wsValue,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
CXFA_LocaleMgr* pLocaleMgr)
: m_pLocaleMgr(pLocaleMgr),
@@ -103,24 +103,24 @@
CXFA_LocaleValue::~CXFA_LocaleValue() {}
-bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
+bool CXFA_LocaleValue::ValidateValue(const WideString& wsValue,
+ const WideString& wsPattern,
IFX_Locale* pLocale,
- CFX_WideString* pMatchFormat) {
- CFX_WideString wsOutput;
+ WideString* pMatchFormat) {
+ WideString wsOutput;
IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
if (pLocale)
m_pLocaleMgr->SetDefLocale(pLocale);
auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
- std::vector<CFX_WideString> wsPatterns;
+ std::vector<WideString> wsPatterns;
pFormat->SplitFormatString(wsPattern, &wsPatterns);
bool bRet = false;
int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
int32_t i = 0;
for (; i < iCount && !bRet; i++) {
- CFX_WideString wsFormat = wsPatterns[i];
+ WideString wsFormat = wsPatterns[i];
switch (ValueCategory(pFormat->GetCategory(wsFormat), m_dwType)) {
case FX_LOCALECATEGORY_Null:
bRet = pFormat->ParseNull(wsValue, wsFormat);
@@ -133,7 +133,7 @@
bRet = wsValue == L"0";
break;
case FX_LOCALECATEGORY_Num: {
- CFX_WideString fNum;
+ WideString fNum;
bRet = pFormat->ParseNum(wsValue, wsFormat, &fNum);
if (!bRet)
bRet = pFormat->FormatNum(wsValue, wsFormat, &wsOutput);
@@ -285,7 +285,7 @@
return CFX_DateTime();
CFX_DateTime dt;
- FX_TimeFromCanonical(m_wsValue.AsStringC(), &dt,
+ FX_TimeFromCanonical(m_wsValue.AsStringView(), &dt,
m_pLocaleMgr->GetDefLocale());
return dt;
}
@@ -301,7 +301,7 @@
m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
t.GetSecond());
if (t.GetMillisecond() > 0) {
- CFX_WideString wsTemp;
+ WideString wsTemp;
wsTemp.Format(L"%:03d", t.GetMillisecond());
m_wsValue += wsTemp;
}
@@ -314,19 +314,19 @@
dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(),
dt.GetSecond());
if (dt.GetMillisecond() > 0) {
- CFX_WideString wsTemp;
+ WideString wsTemp;
wsTemp.Format(L"%:03d", dt.GetMillisecond());
m_wsValue += wsTemp;
}
return true;
}
-bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
+bool CXFA_LocaleValue::FormatPatterns(WideString& wsResult,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
XFA_VALUEPICTURE eValueType) const {
auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
- std::vector<CFX_WideString> wsPatterns;
+ std::vector<WideString> wsPatterns;
pFormat->SplitFormatString(wsFormat, &wsPatterns);
wsResult.clear();
int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
@@ -337,8 +337,8 @@
return false;
}
-bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
+bool CXFA_LocaleValue::FormatSinglePattern(WideString& wsResult,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
XFA_VALUEPICTURE eValueType) const {
IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
@@ -391,7 +391,7 @@
return bRet;
}
-bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue,
+bool CXFA_LocaleValue::ValidateCanonicalValue(const WideString& wsValue,
uint32_t dwVType) {
if (wsValue.IsEmpty())
return true;
@@ -402,8 +402,8 @@
if (ValidateCanonicalDate(wsValue, &dt))
return true;
- CFX_WideString wsDate;
- CFX_WideString wsTime;
+ WideString wsDate;
+ WideString wsTime;
if (ValueSplitDateTime(wsValue, wsDate, wsTime) &&
ValidateCanonicalDate(wsDate, &dt)) {
return true;
@@ -414,8 +414,8 @@
if (ValidateCanonicalTime(wsValue))
return true;
- CFX_WideString wsDate;
- CFX_WideString wsTime;
+ WideString wsDate;
+ WideString wsTime;
if (ValueSplitDateTime(wsValue, wsDate, wsTime) &&
ValidateCanonicalTime(wsTime)) {
return true;
@@ -423,7 +423,7 @@
return false;
}
case XFA_VT_DATETIME: {
- CFX_WideString wsDate, wsTime;
+ WideString wsDate, wsTime;
if (ValueSplitDateTime(wsValue, wsDate, wsTime) &&
ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime)) {
return true;
@@ -433,7 +433,7 @@
return true;
}
-bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate,
+bool CXFA_LocaleValue::ValidateCanonicalDate(const WideString& wsDate,
CFX_DateTime* unDate) {
static const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
@@ -510,7 +510,7 @@
return true;
}
-bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
+bool CXFA_LocaleValue::ValidateCanonicalTime(const WideString& wsTime) {
int nLen = wsTime.GetLength();
if (nLen < 2)
return false;
@@ -605,20 +605,20 @@
wFraction <= 999;
}
-bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
+bool CXFA_LocaleValue::ParsePatternValue(const WideString& wsValue,
+ const WideString& wsPattern,
IFX_Locale* pLocale) {
IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
if (pLocale)
m_pLocaleMgr->SetDefLocale(pLocale);
auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
- std::vector<CFX_WideString> wsPatterns;
+ std::vector<WideString> wsPatterns;
pFormat->SplitFormatString(wsPattern, &wsPatterns);
bool bRet = false;
int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
for (int32_t i = 0; i < iCount && !bRet; i++) {
- CFX_WideString wsFormat = wsPatterns[i];
+ WideString wsFormat = wsPatterns[i];
switch (ValueCategory(pFormat->GetCategory(wsFormat), m_dwType)) {
case FX_LOCALECATEGORY_Null:
bRet = pFormat->ParseNull(wsValue, wsFormat);
@@ -631,7 +631,7 @@
m_wsValue = L"0";
break;
case FX_LOCALECATEGORY_Num: {
- CFX_WideString fNum;
+ WideString fNum;
bRet = pFormat->ParseNum(wsValue, wsFormat, &fNum);
if (bRet)
m_wsValue = fNum;
@@ -682,7 +682,7 @@
return bRet;
}
-void CXFA_LocaleValue::GetNumericFormat(CFX_WideString& wsFormat,
+void CXFA_LocaleValue::GetNumericFormat(WideString& wsFormat,
int32_t nIntLen,
int32_t nDecLen) {
ASSERT(wsFormat.IsEmpty());
@@ -718,8 +718,8 @@
wsFormat.ReleaseBuffer(nTotalLen);
}
-bool CXFA_LocaleValue::ValidateNumericTemp(const CFX_WideString& wsNumeric,
- const CFX_WideString& wsFormat,
+bool CXFA_LocaleValue::ValidateNumericTemp(const WideString& wsNumeric,
+ const WideString& wsFormat,
IFX_Locale* pLocale) {
if (wsFormat.IsEmpty() || wsNumeric.IsEmpty())
return true;
@@ -761,15 +761,15 @@
++nf;
}
- CFX_WideString wsDecimalSymbol;
+ WideString wsDecimalSymbol;
if (pLocale)
wsDecimalSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
else
- wsDecimalSymbol = CFX_WideString(L'.');
+ wsDecimalSymbol = WideString(L'.');
if (pFmt[nf] != L'.')
return false;
- if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.')
+ if (wsDecimalSymbol != WideStringView(c) && c != L'.')
return false;
++nf;
diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
index caf4b0c..d493763 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.h
+++ b/xfa/fxfa/parser/cxfa_localevalue.h
@@ -31,34 +31,32 @@
CXFA_LocaleValue(const CXFA_LocaleValue& value);
CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr);
CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
+ const WideString& wsValue,
CXFA_LocaleMgr* pLocaleMgr);
CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- const CFX_WideString& wsFormat,
+ const WideString& wsValue,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
CXFA_LocaleMgr* pLocaleMgr);
~CXFA_LocaleValue();
CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value);
- bool ValidateValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
+ bool ValidateValue(const WideString& wsValue,
+ const WideString& wsPattern,
IFX_Locale* pLocale,
- CFX_WideString* pMatchFormat);
+ WideString* pMatchFormat);
- bool FormatPatterns(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
+ bool FormatPatterns(WideString& wsResult,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
XFA_VALUEPICTURE eValueType) const;
- void GetNumericFormat(CFX_WideString& wsFormat,
- int32_t nIntLen,
- int32_t nDecLen);
- bool ValidateNumericTemp(const CFX_WideString& wsNumeric,
- const CFX_WideString& wsFormat,
+ void GetNumericFormat(WideString& wsFormat, int32_t nIntLen, int32_t nDecLen);
+ bool ValidateNumericTemp(const WideString& wsNumeric,
+ const WideString& wsFormat,
IFX_Locale* pLocale);
- CFX_WideString GetValue() const { return m_wsValue; }
+ WideString GetValue() const { return m_wsValue; }
uint32_t GetType() const { return m_dwType; }
double GetDoubleNum() const;
bool SetDate(const CFX_DateTime& d);
@@ -68,24 +66,23 @@
bool IsValid() const { return m_bValid; }
private:
- bool FormatSinglePattern(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
+ bool FormatSinglePattern(WideString& wsResult,
+ const WideString& wsFormat,
IFX_Locale* pLocale,
XFA_VALUEPICTURE eValueType) const;
- bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType);
- bool ValidateCanonicalDate(const CFX_WideString& wsDate,
- CFX_DateTime* unDate);
- bool ValidateCanonicalTime(const CFX_WideString& wsTime);
+ bool ValidateCanonicalValue(const WideString& wsValue, uint32_t dwVType);
+ bool ValidateCanonicalDate(const WideString& wsDate, CFX_DateTime* unDate);
+ bool ValidateCanonicalTime(const WideString& wsTime);
bool SetTime(const CFX_DateTime& t);
bool SetDateTime(const CFX_DateTime& dt);
- bool ParsePatternValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
+ bool ParsePatternValue(const WideString& wsValue,
+ const WideString& wsPattern,
IFX_Locale* pLocale);
CXFA_LocaleMgr* m_pLocaleMgr;
- CFX_WideString m_wsValue;
+ WideString m_wsValue;
uint32_t m_dwType;
bool m_bValid;
};
diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp
index 1c42720..24b5ba2 100644
--- a/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -18,7 +18,7 @@
} // namespace
-CXFA_Measurement::CXFA_Measurement(const CFX_WideStringC& wsMeasure) {
+CXFA_Measurement::CXFA_Measurement(const WideStringView& wsMeasure) {
SetString(wsMeasure);
}
@@ -30,7 +30,7 @@
Set(fValue, eUnit);
}
-void CXFA_Measurement::SetString(const CFX_WideStringC& wsMeasure) {
+void CXFA_Measurement::SetString(const WideStringView& wsMeasure) {
if (wsMeasure.IsEmpty()) {
m_fValue = 0;
m_eUnit = XFA_UNIT_Unknown;
@@ -45,7 +45,7 @@
Set(fValue, eUnit);
}
-bool CXFA_Measurement::ToString(CFX_WideString* wsMeasure) const {
+bool CXFA_Measurement::ToString(WideString* wsMeasure) const {
switch (GetUnit()) {
case XFA_UNIT_Mm:
wsMeasure->Format(L"%.8gmm", GetValue());
@@ -135,7 +135,7 @@
}
// static
-XFA_UNIT CXFA_Measurement::GetUnitFromString(const CFX_WideStringC& wsUnit) {
+XFA_UNIT CXFA_Measurement::GetUnitFromString(const WideStringView& wsUnit) {
if (wsUnit == L"mm")
return XFA_UNIT_Mm;
if (wsUnit == L"pt")
diff --git a/xfa/fxfa/parser/cxfa_measurement.h b/xfa/fxfa/parser/cxfa_measurement.h
index 2c03ec0..0212ea1 100644
--- a/xfa/fxfa/parser/cxfa_measurement.h
+++ b/xfa/fxfa/parser/cxfa_measurement.h
@@ -13,11 +13,11 @@
class CXFA_Measurement {
public:
- explicit CXFA_Measurement(const CFX_WideStringC& wsMeasure);
+ explicit CXFA_Measurement(const WideStringView& wsMeasure);
CXFA_Measurement();
CXFA_Measurement(float fValue, XFA_UNIT eUnit);
- static XFA_UNIT GetUnitFromString(const CFX_WideStringC& wsUnit);
+ static XFA_UNIT GetUnitFromString(const WideStringView& wsUnit);
void Set(float fValue, XFA_UNIT eUnit) {
m_fValue = fValue;
@@ -27,11 +27,11 @@
XFA_UNIT GetUnit() const { return m_eUnit; }
float GetValue() const { return m_fValue; }
- bool ToString(CFX_WideString* wsMeasure) const;
+ bool ToString(WideString* wsMeasure) const;
float ToUnit(XFA_UNIT eUnit) const;
private:
- void SetString(const CFX_WideStringC& wsMeasure);
+ void SetString(const WideStringView& wsMeasure);
bool ToUnitInternal(XFA_UNIT eUnit, float* fValue) const;
float m_fValue;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 2f741c5..1dc2048 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -40,12 +40,12 @@
namespace {
void XFA_DeleteWideString(void* pData) {
- delete static_cast<CFX_WideString*>(pData);
+ delete static_cast<WideString*>(pData);
}
void XFA_CopyWideString(void*& pData) {
if (pData) {
- CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData);
+ WideString* pNewData = new WideString(*(WideString*)pData);
pData = pNewData;
}
}
@@ -74,8 +74,8 @@
continue;
}
if (iCount == 0) {
- CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
return iCount;
@@ -195,8 +195,8 @@
continue;
}
if (iCount == 0) {
- CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
return nullptr;
@@ -377,7 +377,7 @@
};
const XFA_ExecEventParaInfo* GetEventParaInfoByName(
- const CFX_WideStringC& wsEventName) {
+ const WideStringView& wsEventName) {
uint32_t uHash = FX_HashCode_GetW(wsEventName, false);
int32_t iStart = 0;
int32_t iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1;
@@ -394,10 +394,7 @@
return nullptr;
}
-void StrToRGB(const CFX_WideString& strRGB,
- int32_t& r,
- int32_t& g,
- int32_t& b) {
+void StrToRGB(const WideString& strRGB, int32_t& r, int32_t& g, int32_t& b) {
r = 0;
g = 0;
b = 0;
@@ -434,7 +431,7 @@
XFA_KEYTYPE_Element,
};
-void* GetMapKey_Custom(const CFX_WideStringC& wsKey) {
+void* GetMapKey_Custom(const WideStringView& wsKey) {
uint32_t dwKey = FX_HashCode_GetW(wsKey, false);
return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom);
}
@@ -481,7 +478,7 @@
uint16_t ePacket,
XFA_ObjectType oType,
XFA_Element eType,
- const CFX_WideStringC& elementName)
+ const WideStringView& elementName)
: CXFA_Object(pDoc, oType, eType, elementName),
m_pNext(nullptr),
m_pChild(nullptr),
@@ -520,12 +517,12 @@
if (IsNeedSavingXMLNode()) {
std::unique_ptr<CFX_XMLNode> pCloneXML;
if (IsAttributeInXML()) {
- CFX_WideString wsName;
+ WideString wsName;
GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName);
- CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
+ WideStringView wsValue = GetCData(XFA_ATTRIBUTE_Value);
if (!wsValue.IsEmpty()) {
- pCloneXMLElement->SetTextData(CFX_WideString(wsValue));
+ pCloneXMLElement->SetTextData(WideString(wsValue));
}
pCloneXML.reset(pCloneXMLElement.release());
pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
@@ -802,7 +799,7 @@
XFA_ATTRIBUTEENUM_MultiSelect) {
return nullptr;
} else {
- CFX_WideString wsPicture;
+ WideString wsPicture;
if (pFieldWidgetData) {
pFieldWidgetData->GetPictureContent(wsPicture,
XFA_VALUEPICTURE_DataBind);
@@ -846,7 +843,7 @@
: nullptr;
}
-bool CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) {
+bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode();
CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_Element::Subform);
ASSERT(pTopSubform);
@@ -971,8 +968,8 @@
ThrowParamCountMismatchException(L"resolveNode");
return;
}
- CFX_WideString wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString wsExpression =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
if (!pScriptContext)
return;
@@ -984,7 +981,7 @@
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag);
+ refNode, wsExpression.AsStringView(), resoveNodeRS, dwFlag);
if (iRet < 1) {
pArguments->GetReturnValue()->SetNull();
return;
@@ -1014,8 +1011,8 @@
ThrowParamCountMismatchException(L"resolveNodes");
return;
}
- CFX_WideString wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString wsExpression =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (!pValue)
return;
@@ -1029,7 +1026,7 @@
}
void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- CFX_WideString wsExpression,
+ WideString wsExpression,
uint32_t dwFlag,
CXFA_Node* refNode) {
CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
@@ -1038,7 +1035,7 @@
XFA_RESOLVENODE_RS resoveNodeRS;
if (!refNode)
refNode = this;
- pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(),
+ pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
resoveNodeRS, dwFlag);
CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument.Get());
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
@@ -1067,9 +1064,9 @@
}
uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
- CFX_WideString wsName;
+ WideString wsName;
GetAttribute(XFA_ATTRIBUTE_Name, wsName);
- CFX_WideString wsExpression = wsName + L"[*]";
+ WideString wsExpression = wsName + L"[*]";
Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
}
@@ -1080,8 +1077,8 @@
if (!pScriptContext)
return;
if (bSetting) {
- CFX_WideString wsMessage = L"Unable to set ";
- FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC());
+ WideString wsMessage = L"Unable to set ";
+ FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView());
} else {
CXFA_AttachNodeList* pNodeList =
new CXFA_AttachNodeList(m_pDocument.Get(), this);
@@ -1097,7 +1094,7 @@
return;
}
uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
- CFX_WideString wsExpression = L"#" + GetClassName() + L"[*]";
+ WideString wsExpression = L"#" + GetClassName() + L"[*]";
Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
}
@@ -1143,9 +1140,9 @@
ThrowInvalidPropertyException();
return;
}
- CFX_WideString wsSOMExpression;
+ WideString wsSOMExpression;
GetSOMExpression(wsSOMExpression);
- pValue->SetString(wsSOMExpression.UTF8Encode().AsStringC());
+ pValue->SetString(wsSOMExpression.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
@@ -1154,8 +1151,8 @@
ThrowParamCountMismatchException(L"applyXSL");
return;
}
- CFX_WideString wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString wsExpression =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
// TODO(weili): check whether we need to implement this, pdfium:501.
// For now, just put the variables here to avoid unused variable warning.
(void)wsExpression;
@@ -1167,14 +1164,13 @@
ThrowParamCountMismatchException(L"assignNode");
return;
}
- CFX_WideString wsExpression;
- CFX_WideString wsValue;
+ WideString wsExpression;
+ WideString wsValue;
int32_t iAction = 0;
wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
if (iLength >= 2) {
- wsValue =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
+ wsValue = WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView());
}
if (iLength >= 3)
iAction = pArguments->GetInt32(2);
@@ -1203,13 +1199,13 @@
ThrowParamCountMismatchException(L"getAttribute");
return;
}
- CFX_WideString wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
- CFX_WideString wsValue;
- GetAttribute(wsExpression.AsStringC(), wsValue);
+ WideString wsExpression =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
+ WideString wsValue;
+ GetAttribute(wsExpression.AsStringView(), wsValue);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
@@ -1218,14 +1214,14 @@
ThrowParamCountMismatchException(L"getElement");
return;
}
- CFX_WideString wsExpression;
+ WideString wsExpression;
int32_t iValue = 0;
wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
if (iLength >= 2)
iValue = pArguments->GetInt32(1);
- CXFA_Node* pNode =
- GetProperty(iValue, XFA_GetElementTypeForName(wsExpression.AsStringC()));
+ CXFA_Node* pNode = GetProperty(
+ iValue, XFA_GetElementTypeForName(wsExpression.AsStringView()));
pArguments->GetReturnValue()->Assign(
m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
}
@@ -1242,15 +1238,15 @@
if (!pValue)
return;
- CFX_WideString wsExpression =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
+ WideString wsExpression =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
const XFA_ATTRIBUTEINFO* pAttributeInfo =
- XFA_GetAttributeByName(wsExpression.AsStringC());
+ XFA_GetAttributeByName(wsExpression.AsStringView());
bool bHas = pAttributeInfo ? HasAttribute(pAttributeInfo->eName) : false;
if (!bHas) {
bool bParent = iLength < 2 || pArguments->GetInt32(1);
int32_t iIndex = iLength == 3 ? pArguments->GetInt32(2) : 0;
- XFA_Element eType = XFA_GetElementTypeForName(wsExpression.AsStringC());
+ XFA_Element eType = XFA_GetElementTypeForName(wsExpression.AsStringView());
bHas = !!GetProperty(iIndex, eType);
if (!bHas && bParent && m_pParent) {
// Also check on the parent.
@@ -1271,7 +1267,7 @@
bool bIgnoreRoot = true;
bool bOverwrite = 0;
- CFX_ByteString wsExpression = pArguments->GetUTF8String(0);
+ ByteString wsExpression = pArguments->GetUTF8String(0);
if (wsExpression.IsEmpty())
return;
if (iLength >= 2)
@@ -1291,10 +1287,9 @@
bIgnoreRoot = false;
}
CXFA_Node* pFakeRoot = Clone(false);
- CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType);
+ WideStringView wsContentType = GetCData(XFA_ATTRIBUTE_ContentType);
if (!wsContentType.IsEmpty()) {
- pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType,
- CFX_WideString(wsContentType));
+ pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, WideString(wsContentType));
}
std::unique_ptr<CFX_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode());
@@ -1304,7 +1299,7 @@
}
if (!pFakeXMLRoot) {
pFakeXMLRoot =
- pdfium::MakeUnique<CFX_XMLElement>(CFX_WideString(GetClassName()));
+ pdfium::MakeUnique<CFX_XMLElement>(WideString(GetClassName()));
}
if (bIgnoreRoot) {
@@ -1391,7 +1386,7 @@
}
bPrettyMode = true;
}
- CFX_WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
if (GetPacketID() == XFA_XDPPACKET_Form ||
GetPacketID() == XFA_XDPPACKET_Datasets) {
CFX_XMLNode* pElement = nullptr;
@@ -1399,7 +1394,7 @@
pElement = GetXMLMappingNode();
if (!pElement || pElement->GetType() != FX_XMLNODE_Element) {
pArguments->GetReturnValue()->SetString(
- bsXMLHeader.UTF8Encode().AsStringC());
+ bsXMLHeader.UTF8Encode().AsStringView());
return;
}
XFA_DataExporter_DealWithDataGroupNode(this);
@@ -1408,7 +1403,7 @@
auto pStream =
pdfium::MakeRetain<CFX_SeekableStreamProxy>(pMemoryStream, true);
pStream->SetCodePage(FX_CODEPAGE_UTF8);
- pStream->WriteString(bsXMLHeader.AsStringC());
+ pStream->WriteString(bsXMLHeader.AsStringView());
if (GetPacketID() == XFA_XDPPACKET_Form)
XFA_DataExporter_RegenerateFormFile(this, pStream, nullptr, true);
@@ -1418,7 +1413,7 @@
// For now, just put it here to avoid unused variable warning.
(void)bPrettyMode;
pArguments->GetReturnValue()->SetString(
- CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()));
+ ByteStringView(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()));
return;
}
pArguments->GetReturnValue()->SetString("");
@@ -1430,11 +1425,12 @@
ThrowParamCountMismatchException(L"setAttribute");
return;
}
- CFX_WideString wsAttributeValue =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
- CFX_WideString wsAttribute =
- CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
- SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), true);
+ WideString wsAttributeValue =
+ WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView());
+ WideString wsAttribute =
+ WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView());
+ SetAttribute(wsAttribute.AsStringView(), wsAttributeValue.AsStringView(),
+ true);
}
void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
@@ -1444,10 +1440,10 @@
return;
}
CXFA_Node* pNode = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
if (iLength == 2)
- wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
+ wsName = WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView());
// TODO(weili): check whether we need to implement this, pdfium:501.
// For now, just put the variables here to avoid unused variable warning.
(void)pNode;
@@ -1462,9 +1458,9 @@
return;
}
- CFX_WideString wsNameSpace;
+ WideString wsNameSpace;
TryNamespace(wsNameSpace);
- pValue->SetString(wsNameSpace.UTF8Encode().AsStringC());
+ pValue->SetString(wsNameSpace.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue,
@@ -1499,7 +1495,7 @@
pValue->SetBoolean(false);
return;
}
- CFX_WideString strValue;
+ WideString strValue;
pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty());
}
@@ -1538,12 +1534,12 @@
ThrowParamCountMismatchException(L"isCompatibleNS");
return;
}
- CFX_WideString wsNameSpace;
+ WideString wsNameSpace;
if (iLength >= 1) {
- CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0);
- wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC());
+ ByteString bsNameSpace = pArguments->GetUTF8String(0);
+ wsNameSpace = WideString::FromUTF8(bsNameSpace.AsStringView());
}
- CFX_WideString wsNodeNameSpace;
+ WideString wsNodeNameSpace;
TryNamespace(wsNodeNameSpace);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
@@ -1755,8 +1751,8 @@
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- CFX_WideString wsValue = pValue->ToWideString();
- SetAttribute(eAttribute, wsValue.AsStringC(), true);
+ WideString wsValue = pValue->ToWideString();
+ SetAttribute(eAttribute, wsValue.AsStringView(), true);
if (eAttribute == XFA_ATTRIBUTE_Use &&
GetElementType() == XFA_Element::Desc) {
CXFA_Node* pTemplateNode =
@@ -1765,11 +1761,11 @@
pTemplateNode->GetFirstChildByClass(XFA_Element::Subform)
->GetFirstChildByClass(XFA_Element::Proto);
- CFX_WideString wsID;
- CFX_WideString wsSOM;
+ WideString wsID;
+ WideString wsSOM;
if (!wsValue.IsEmpty()) {
if (wsValue[0] == '#') {
- wsID = CFX_WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1);
+ wsID = WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1);
} else {
wsSOM = wsValue;
}
@@ -1782,12 +1778,12 @@
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
- pProtoRoot, wsSOM.AsStringC(), resoveNodeRS, dwFlag);
+ pProtoRoot, wsSOM.AsStringView(), resoveNodeRS, dwFlag);
if (iRet > 0 && resoveNodeRS.objects.front()->IsNode()) {
pProtoNode = resoveNodeRS.objects.front()->AsNode();
}
} else if (!wsID.IsEmpty()) {
- pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringC());
+ pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringView());
}
if (pProtoNode) {
CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -1811,9 +1807,9 @@
}
}
} else {
- CFX_WideString wsValue;
+ WideString wsValue;
GetAttribute(eAttribute, wsValue);
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
}
@@ -1825,9 +1821,9 @@
return;
}
- CFX_WideString wsValue;
+ WideString wsValue;
GetAttribute(eAttribute, wsValue);
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) {
@@ -1891,7 +1887,7 @@
pNotify->AddCalcValidate(this);
}
} else {
- CFX_WideString wsMessage;
+ WideString wsMessage;
switch (iMessageType) {
case XFA_SOM_ValidationMessage:
validate.GetScriptMessageText(wsMessage);
@@ -1905,7 +1901,7 @@
default:
break;
}
- pValue->SetString(wsMessage.UTF8Encode().AsStringC());
+ pValue->SetString(wsMessage.UTF8Encode().AsStringView());
}
}
@@ -1948,14 +1944,14 @@
return;
}
if (bSetting) {
- CFX_WideString wsNewValue;
+ WideString wsNewValue;
if (!(pValue && (pValue->IsNull() || pValue->IsUndefined())))
wsNewValue = pValue->ToWideString();
- CFX_WideString wsFormatValue(wsNewValue);
+ WideString wsFormatValue(wsNewValue);
CXFA_WidgetData* pContainerWidgetData = nullptr;
if (GetPacketID() == XFA_XDPPACKET_Datasets) {
- CFX_WideString wsPicture;
+ WideString wsPicture;
for (CXFA_Node* pFormNode : GetBindItems()) {
if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
@@ -1976,17 +1972,17 @@
}
SetScriptContent(wsNewValue, wsFormatValue, true, true);
} else {
- CFX_WideString content = GetScriptContent(true);
+ WideString content = GetScriptContent(true);
if (content.IsEmpty() && eType != XFA_Element::Text &&
eType != XFA_Element::SubmitUrl) {
pValue->SetNull();
} else if (eType == XFA_Element::Integer) {
pValue->SetInteger(FXSYS_wtoi(content.c_str()));
} else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) {
- CFX_Decimal decimal(content.AsStringC());
+ CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
} else {
- pValue->SetString(content.UTF8Encode().AsStringC());
+ pValue->SetString(content.UTF8Encode().AsStringView());
}
}
}
@@ -1999,32 +1995,32 @@
return;
}
- CFX_WideString content = GetScriptContent(true);
+ WideString content = GetScriptContent(true);
if (content.IsEmpty()) {
pValue->SetNull();
return;
}
- pValue->SetString(content.UTF8Encode().AsStringC());
+ pValue->SetString(content.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Boolean_Value(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- CFX_ByteString newValue;
+ ByteString newValue;
if (!(pValue && (pValue->IsNull() || pValue->IsUndefined())))
newValue = pValue->ToString();
int32_t iValue = FXSYS_atoi(newValue.c_str());
- CFX_WideString wsNewValue(iValue == 0 ? L"0" : L"1");
- CFX_WideString wsFormatValue(wsNewValue);
+ WideString wsNewValue(iValue == 0 ? L"0" : L"1");
+ WideString wsFormatValue(wsNewValue);
CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
if (pContainerWidgetData) {
pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
}
SetScriptContent(wsNewValue, wsFormatValue, true, true);
} else {
- CFX_WideString wsValue = GetScriptContent(true);
+ WideString wsValue = GetScriptContent(true);
pValue->SetBoolean(wsValue == L"1");
}
}
@@ -2056,9 +2052,9 @@
int32_t g;
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- CFX_WideString strColor;
+ WideString strColor;
strColor.Format(L"%d,%d,%d", r, g, b);
- pValue->SetString(strColor.UTF8Encode().AsStringC());
+ pValue->SetString(strColor.UTF8Encode().AsStringView());
}
}
@@ -2071,19 +2067,19 @@
}
CXFA_Border border = pWidgetData->GetBorder(true);
int32_t iSize = border.CountEdges();
- CFX_WideString wsThickness;
+ WideString wsThickness;
if (bSetting) {
wsThickness = pValue->ToWideString();
for (int32_t i = 0; i < iSize; ++i) {
CXFA_Edge edge = border.GetEdge(i);
- CXFA_Measurement thickness(wsThickness.AsStringC());
+ CXFA_Measurement thickness(wsThickness.AsStringView());
edge.SetMSThickness(thickness);
}
} else {
CXFA_Edge edge = border.GetEdge(0);
CXFA_Measurement thickness = edge.GetMSThickness();
thickness.ToString(&wsThickness);
- pValue->SetString(wsThickness.UTF8Encode().AsStringC());
+ pValue->SetString(wsThickness.UTF8Encode().AsStringView());
}
}
@@ -2114,9 +2110,9 @@
int32_t g;
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- CFX_WideString wsColor;
+ WideString wsColor;
wsColor.Format(L"%d,%d,%d", r, g, b);
- pValue->SetString(wsColor.UTF8Encode().AsStringC());
+ pValue->SetString(wsColor.UTF8Encode().AsStringView());
}
}
@@ -2146,17 +2142,17 @@
ASSERT(pWidgetData);
XFA_Element uiType = pWidgetData->GetUIType();
if (uiType == XFA_Element::Text) {
- CFX_WideString wsNewValue = pValue->ToWideString();
- CFX_WideString wsFormatValue(wsNewValue);
+ WideString wsNewValue = pValue->ToWideString();
+ WideString wsFormatValue(wsNewValue);
SetScriptContent(wsNewValue, wsFormatValue, true, true);
}
}
} else {
- CFX_WideString content = GetScriptContent(true);
+ WideString content = GetScriptContent(true);
if (content.IsEmpty())
pValue->SetNull();
else
- pValue->SetString(content.UTF8Encode().AsStringC());
+ pValue->SetString(content.UTF8Encode().AsStringView());
}
}
@@ -2175,7 +2171,7 @@
pWidgetData->m_bPreNull = pWidgetData->m_bIsNull;
pWidgetData->m_bIsNull = false;
}
- CFX_WideString wsNewText;
+ WideString wsNewText;
if (!(pValue && (pValue->IsNull() || pValue->IsUndefined())))
wsNewText = pValue->ToWideString();
@@ -2189,13 +2185,13 @@
pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits);
}
CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
- CFX_WideString wsFormatText(wsNewText);
+ WideString wsFormatText(wsNewText);
if (pContainerWidgetData) {
pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText);
}
SetScriptContent(wsNewText, wsFormatText, true, true);
} else {
- CFX_WideString content = GetScriptContent(true);
+ WideString content = GetScriptContent(true);
if (content.IsEmpty()) {
pValue->SetNull();
} else {
@@ -2205,9 +2201,9 @@
if (pNode && pNode->GetElementType() == XFA_Element::Decimal) {
if (pUIChild->GetElementType() == XFA_Element::NumericEdit &&
(pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) {
- pValue->SetString(content.UTF8Encode().AsStringC());
+ pValue->SetString(content.UTF8Encode().AsStringView());
} else {
- CFX_Decimal decimal(content.AsStringC());
+ CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
}
} else if (pNode && pNode->GetElementType() == XFA_Element::Integer) {
@@ -2215,10 +2211,10 @@
} else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) {
pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true);
} else if (pNode && pNode->GetElementType() == XFA_Element::Float) {
- CFX_Decimal decimal(content.AsStringC());
+ CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
} else {
- pValue->SetString(content.UTF8Encode().AsStringC());
+ pValue->SetString(content.UTF8Encode().AsStringView());
}
}
}
@@ -2234,9 +2230,9 @@
if (bSetting) {
pWidgetData->SetValue(pValue->ToWideString(), XFA_VALUEPICTURE_Edit);
} else {
- CFX_WideString wsValue;
+ WideString wsValue;
pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit);
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
}
@@ -2266,9 +2262,9 @@
int32_t g;
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- CFX_WideString wsColor;
+ WideString wsColor;
wsColor.Format(L"%d,%d,%d", r, g, b);
- pValue->SetString(wsColor.UTF8Encode().AsStringC());
+ pValue->SetString(wsColor.UTF8Encode().AsStringView());
}
}
@@ -2288,9 +2284,9 @@
if (bSetting) {
pWidgetData->SetValue(pValue->ToWideString(), XFA_VALUEPICTURE_Display);
} else {
- CFX_WideString wsValue;
+ WideString wsValue;
pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display);
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
}
@@ -2308,10 +2304,10 @@
int32_t iValue = validate.GetNullTest();
const XFA_ATTRIBUTEENUMINFO* pInfo =
GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue);
- CFX_WideString wsValue;
+ WideString wsValue;
if (pInfo)
wsValue = pInfo->pName;
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
}
@@ -2364,9 +2360,9 @@
return;
}
- CFX_ByteString eventString = pArguments->GetUTF8String(0);
+ ByteString eventString = pArguments->GetUTF8String(0);
int32_t iRet = execSingleEventByName(
- CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
+ WideString::FromUTF8(eventString.AsStringView()).AsStringView(),
XFA_Element::Field);
if (eventString != "validate")
return;
@@ -2421,12 +2417,12 @@
pArguments->GetReturnValue()->SetNull();
return;
}
- CFX_WideString wsValue;
+ WideString wsValue;
if (!pWidgetData->GetChoiceListItem(wsValue, iIndex, true)) {
pArguments->GetReturnValue()->SetNull();
return;
}
- pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC());
+ pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) {
@@ -2439,13 +2435,13 @@
if (!pWidgetData) {
return;
}
- CFX_ByteString bsValue = pArguments->GetUTF8String(0);
- CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
- CFX_WideString wsBoundValue;
- pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue);
+ ByteString bsValue = pArguments->GetUTF8String(0);
+ WideString wsValue = WideString::FromUTF8(bsValue.AsStringView());
+ WideString wsBoundValue;
+ pWidgetData->GetItemValue(wsValue.AsStringView(), wsBoundValue);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetString(wsBoundValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsBoundValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) {
@@ -2496,12 +2492,12 @@
pArguments->GetReturnValue()->SetNull();
return;
}
- CFX_WideString wsValue;
+ WideString wsValue;
if (!pWidgetData->GetChoiceListItem(wsValue, iIndex, false)) {
pArguments->GetReturnValue()->SetNull();
return;
}
- pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC());
+ pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) {
@@ -2533,15 +2529,15 @@
if (!pWidgetData) {
return;
}
- CFX_WideString wsLabel;
- CFX_WideString wsValue;
+ WideString wsLabel;
+ WideString wsValue;
if (iLength >= 1) {
- CFX_ByteString bsLabel = pArguments->GetUTF8String(0);
- wsLabel = CFX_WideString::FromUTF8(bsLabel.AsStringC());
+ ByteString bsLabel = pArguments->GetUTF8String(0);
+ wsLabel = WideString::FromUTF8(bsLabel.AsStringView());
}
if (iLength >= 2) {
- CFX_ByteString bsValue = pArguments->GetUTF8String(1);
- wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
+ ByteString bsValue = pArguments->GetUTF8String(1);
+ wsValue = WideString::FromUTF8(bsValue.AsStringView());
}
pWidgetData->InsertItem(wsLabel, wsValue, true);
}
@@ -2579,15 +2575,15 @@
return;
}
if (bSetting) {
- pWidgetData->SetSelectedMemberByValue(pValue->ToWideString().AsStringC(),
+ pWidgetData->SetSelectedMemberByValue(pValue->ToWideString().AsStringView(),
true, true, true);
} else {
- CFX_WideString wsValue = GetScriptContent(true);
+ WideString wsValue = GetScriptContent(true);
XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) {
pValue->SetNull();
} else {
- pValue->SetString(wsValue.UTF8Encode().AsStringC());
+ pValue->SetString(wsValue.UTF8Encode().AsStringView());
}
}
}
@@ -2602,9 +2598,9 @@
return;
}
- CFX_ByteString eventString = pArguments->GetUTF8String(0);
+ ByteString eventString = pArguments->GetUTF8String(0);
execSingleEventByName(
- CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
+ WideString::FromUTF8(eventString.AsStringView()).AsStringView(),
XFA_Element::ExclGroup);
}
@@ -2625,10 +2621,10 @@
if (argc == 0) {
pReturnNode = pWidgetData->GetSelectedMember();
} else {
- CFX_ByteString szName;
+ ByteString szName;
szName = pArguments->GetUTF8String(0);
pReturnNode = pWidgetData->SetSelectedMember(
- CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC(), true);
+ WideString::FromUTF8(szName.AsStringView()).AsStringView(), true);
}
if (!pReturnNode) {
pArguments->GetReturnValue()->SetNull();
@@ -2725,12 +2721,12 @@
return;
}
- CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsName = GetCData(XFA_ATTRIBUTE_Name);
CXFA_Node* pInstanceMgr = nullptr;
for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
if (pNode->GetElementType() == XFA_Element::InstanceManager) {
- CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name);
if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName[0] == '_' &&
wsInstMgrName.Right(wsInstMgrName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
@@ -2753,9 +2749,9 @@
if (bSetting) {
SetCData(XFA_ATTRIBUTE_Locale, pValue->ToWideString(), true, true);
} else {
- CFX_WideString wsLocaleName;
+ WideString wsLocaleName;
GetLocaleName(wsLocaleName);
- pValue->SetString(wsLocaleName.UTF8Encode().AsStringC());
+ pValue->SetString(wsLocaleName.UTF8Encode().AsStringView());
}
}
@@ -2765,9 +2761,9 @@
return;
}
- CFX_ByteString eventString = pArguments->GetUTF8String(0);
+ ByteString eventString = pArguments->GetUTF8String(0);
execSingleEventByName(
- CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
+ WideString::FromUTF8(eventString.AsStringView()).AsStringView(),
XFA_Element::Subform);
}
@@ -2870,20 +2866,20 @@
return;
}
- CFX_WideString strName;
- CFX_WideString strNameSpace;
- CFX_ByteString bsTagName = pArguments->GetUTF8String(0);
- CFX_WideString strTagName = CFX_WideString::FromUTF8(bsTagName.AsStringC());
+ WideString strName;
+ WideString strNameSpace;
+ ByteString bsTagName = pArguments->GetUTF8String(0);
+ WideString strTagName = WideString::FromUTF8(bsTagName.AsStringView());
if (argc > 1) {
- CFX_ByteString bsName = pArguments->GetUTF8String(1);
- strName = CFX_WideString::FromUTF8(bsName.AsStringC());
+ ByteString bsName = pArguments->GetUTF8String(1);
+ strName = WideString::FromUTF8(bsName.AsStringView());
if (argc == 3) {
- CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2);
- strNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC());
+ ByteString bsNameSpace = pArguments->GetUTF8String(2);
+ strNameSpace = WideString::FromUTF8(bsNameSpace.AsStringView());
}
}
- XFA_Element eType = XFA_GetElementTypeForName(strTagName.AsStringC());
+ XFA_Element eType = XFA_GetElementTypeForName(strTagName.AsStringView());
CXFA_Node* pNewNode = CreateSamePacketNode(eType);
if (!pNewNode) {
pArguments->GetReturnValue()->SetNull();
@@ -2902,7 +2898,7 @@
return;
}
- pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true);
+ pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringView(), true);
if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets)
pNewNode->CreateXMLMappingNode();
@@ -3156,13 +3152,13 @@
return 0;
}
if (iDesired < iCount) {
- CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideString wsInstanceName = CFX_WideString(
+ WideStringView wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name);
+ WideString wsInstanceName = WideString(
wsInstManagerName.IsEmpty()
? wsInstManagerName
: wsInstManagerName.Right(wsInstManagerName.GetLength() - 1));
uint32_t dInstanceNameHash =
- FX_HashCode_GetW(wsInstanceName.AsStringC(), false);
+ FX_HashCode_GetW(wsInstanceName.AsStringView(), false);
CXFA_Node* pPrevSibling =
(iDesired == 0) ? this : GetItem(this, iDesired - 1);
while (iCount > iDesired) {
@@ -3352,12 +3348,12 @@
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- SetAttribute(XFA_ATTRIBUTE_Checksum, pValue->ToWideString().AsStringC());
+ SetAttribute(XFA_ATTRIBUTE_Checksum, pValue->ToWideString().AsStringView());
return;
}
- CFX_WideString wsChecksum;
+ WideString wsChecksum;
GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, false);
- pValue->SetString(wsChecksum.UTF8Encode().AsStringC());
+ pValue->SetString(wsChecksum.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
@@ -3365,15 +3361,15 @@
ThrowParamCountMismatchException(L"getAttribute");
return;
}
- CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0);
- CFX_WideString wsAttributeValue;
+ ByteString bsAttributeName = pArguments->GetUTF8String(0);
+ WideString wsAttributeValue;
CFX_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
wsAttributeValue = static_cast<CFX_XMLElement*>(pXMLNode)->GetString(
- CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str());
+ WideString::FromUTF8(bsAttributeName.AsStringView()).c_str());
}
pArguments->GetReturnValue()->SetString(
- wsAttributeValue.UTF8Encode().AsStringC());
+ wsAttributeValue.UTF8Encode().AsStringView());
}
void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) {
@@ -3381,13 +3377,13 @@
ThrowParamCountMismatchException(L"setAttribute");
return;
}
- CFX_ByteString bsValue = pArguments->GetUTF8String(0);
- CFX_ByteString bsName = pArguments->GetUTF8String(1);
+ ByteString bsValue = pArguments->GetUTF8String(0);
+ ByteString bsName = pArguments->GetUTF8String(1);
CFX_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
static_cast<CFX_XMLElement*>(pXMLNode)->SetString(
- CFX_WideString::FromUTF8(bsName.AsStringC()),
- CFX_WideString::FromUTF8(bsValue.AsStringC()));
+ WideString::FromUTF8(bsName.AsStringView()),
+ WideString::FromUTF8(bsValue.AsStringView()));
}
pArguments->GetReturnValue()->SetNull();
}
@@ -3398,8 +3394,8 @@
return;
}
- CFX_ByteString bsName = pArguments->GetUTF8String(0);
- CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
+ ByteString bsName = pArguments->GetUTF8String(0);
+ WideString wsName = WideString::FromUTF8(bsName.AsStringView());
CFX_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
@@ -3420,13 +3416,13 @@
pXMLElement->SetTextData(pValue->ToWideString());
}
} else {
- CFX_WideString wsTextData;
+ WideString wsTextData;
CFX_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
wsTextData = pXMLElement->GetTextData();
}
- pValue->SetString(wsTextData.UTF8Encode().AsStringC());
+ pValue->SetString(wsTextData.UTF8Encode().AsStringView());
}
}
@@ -3548,7 +3544,7 @@
ThrowInvalidPropertyException();
return;
}
- pValue->SetString(FX_UTF8Encode(CFX_WideStringC(L"0", 1)).AsStringC());
+ pValue->SetString(FX_UTF8Encode(WideStringView(L"0", 1)).AsStringView());
}
void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue,
@@ -3561,7 +3557,7 @@
}
bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
- const CFX_WideStringC& wsValue,
+ const WideStringView& wsValue,
bool bNotify) {
const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr);
if (!pAttr)
@@ -3582,7 +3578,7 @@
bNotify);
} break;
case XFA_ATTRIBUTETYPE_Cdata:
- return SetCData(pAttr->eName, CFX_WideString(wsValue), bNotify);
+ return SetCData(pAttr->eName, WideString(wsValue), bNotify);
case XFA_ATTRIBUTETYPE_Boolean:
return SetBoolean(pAttr->eName, wsValue != L"0", bNotify);
case XFA_ATTRIBUTETYPE_Integer:
@@ -3599,7 +3595,7 @@
}
bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
+ WideString& wsValue,
bool bUseDefault) {
const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr);
if (!pAttr)
@@ -3621,7 +3617,7 @@
return true;
}
case XFA_ATTRIBUTETYPE_Cdata: {
- CFX_WideStringC wsValueC;
+ WideStringView wsValueC;
if (!TryCData(pAttr->eName, wsValueC, bUseDefault))
return false;
@@ -3657,8 +3653,8 @@
}
}
-bool CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr,
- const CFX_WideStringC& wsValue,
+bool CXFA_Node::SetAttribute(const WideStringView& wsAttr,
+ const WideStringView& wsValue,
bool bNotify) {
const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue);
if (pAttributeInfo) {
@@ -3669,22 +3665,22 @@
return true;
}
-bool CXFA_Node::GetAttribute(const CFX_WideStringC& wsAttr,
- CFX_WideString& wsValue,
+bool CXFA_Node::GetAttribute(const WideStringView& wsAttr,
+ WideString& wsValue,
bool bUseDefault) {
const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsAttr);
if (pAttributeInfo) {
return GetAttribute(pAttributeInfo->eName, wsValue, bUseDefault);
}
void* pKey = GetMapKey_Custom(wsAttr);
- CFX_WideStringC wsValueC;
+ WideStringView wsValueC;
if (GetMapModuleString(pKey, wsValueC)) {
wsValue = wsValueC;
}
return true;
}
-bool CXFA_Node::RemoveAttribute(const CFX_WideStringC& wsAttr) {
+bool CXFA_Node::RemoveAttribute(const WideStringView& wsAttr) {
void* pKey = GetMapKey_Custom(wsAttr);
RemoveMapModuleKey(pKey);
return true;
@@ -3755,16 +3751,16 @@
}
bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
- const CFX_WideString& wsValue,
+ const WideString& wsValue,
bool bNotify,
bool bScriptModify) {
void* pKey = GetMapKey_Element(GetElementType(), eAttr);
OnChanging(eAttr, bNotify);
if (eAttr == XFA_ATTRIBUTE_Value) {
- CFX_WideString* pClone = new CFX_WideString(wsValue);
+ WideString* pClone = new WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
} else {
- SetMapModuleString(pKey, wsValue.AsStringC());
+ SetMapModuleString(pKey, wsValue.AsStringView());
if (eAttr == XFA_ATTRIBUTE_Name)
UpdateNameHash();
}
@@ -3787,7 +3783,7 @@
case FX_XMLNODE_Element:
if (IsAttributeInXML()) {
static_cast<CFX_XMLElement*>(m_pXMLNode)
- ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
+ ->SetString(WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
wsValue);
} else {
bool bDeleteChildren = true;
@@ -3820,7 +3816,7 @@
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
if (pInfo) {
ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element);
- CFX_WideString wsAttrName = pInfo->pName;
+ WideString wsAttrName = pInfo->pName;
if (pInfo->eName == XFA_ATTRIBUTE_ContentType) {
wsAttrName = L"xfa:" + wsAttrName;
}
@@ -3829,13 +3825,13 @@
return true;
}
-bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsXMLValue,
+bool CXFA_Node::SetAttributeValue(const WideString& wsValue,
+ const WideString& wsXMLValue,
bool bNotify,
bool bScriptModify) {
void* pKey = GetMapKey_Element(GetElementType(), XFA_ATTRIBUTE_Value);
OnChanging(XFA_ATTRIBUTE_Value, bNotify);
- CFX_WideString* pClone = new CFX_WideString(wsValue);
+ WideString* pClone = new WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
if (IsNeedSavingXMLNode()) {
@@ -3844,7 +3840,7 @@
case FX_XMLNODE_Element:
if (IsAttributeInXML()) {
static_cast<CFX_XMLElement*>(m_pXMLNode)
- ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
+ ->SetString(WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
wsXMLValue);
} else {
bool bDeleteChildren = true;
@@ -3876,18 +3872,18 @@
}
bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
+ WideString& wsValue,
bool bUseDefault,
bool bProto) {
void* pKey = GetMapKey_Element(GetElementType(), eAttr);
if (eAttr == XFA_ATTRIBUTE_Value) {
- CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto);
+ WideString* pStr = (WideString*)GetUserData(pKey, bProto);
if (pStr) {
wsValue = *pStr;
return true;
}
} else {
- CFX_WideStringC wsValueC;
+ WideStringView wsValueC;
if (GetMapModuleString(pKey, wsValueC)) {
wsValue = wsValueC;
return true;
@@ -3906,14 +3902,14 @@
}
bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideStringC& wsValue,
+ WideStringView& wsValue,
bool bUseDefault,
bool bProto) {
void* pKey = GetMapKey_Element(GetElementType(), eAttr);
if (eAttr == XFA_ATTRIBUTE_Value) {
- CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto);
+ WideString* pStr = (WideString*)GetUserData(pKey, bProto);
if (pStr) {
- wsValue = pStr->AsStringC();
+ wsValue = pStr->AsStringView();
return true;
}
} else {
@@ -3927,7 +3923,7 @@
void* pValue = nullptr;
if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr,
XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) {
- wsValue = (CFX_WideStringC)(const wchar_t*)pValue;
+ wsValue = (WideStringView)(const wchar_t*)pValue;
return true;
}
return false;
@@ -3971,7 +3967,7 @@
->SetString(pInfo->pName, pValue ? L"1" : L"0");
break;
case XFA_ATTRIBUTETYPE_Integer: {
- CFX_WideString wsValue;
+ WideString wsValue;
wsValue.Format(
L"%d", static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue)));
static_cast<CFX_XMLElement*>(m_pXMLNode)
@@ -4017,8 +4013,8 @@
return iBytes == sizeof(void*) && memcpy(&pData, pData, iBytes);
}
-bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
+bool CXFA_Node::SetScriptContent(const WideString& wsContent,
+ const WideString& wsXMLValue,
bool bNotify,
bool bScriptModify,
bool bSyncData) {
@@ -4038,7 +4034,7 @@
bScriptModify, false);
CXFA_Node* pBind = GetBindData();
if (bSyncData && pBind) {
- std::vector<CFX_WideString> wsSaveTextArray;
+ std::vector<WideString> wsSaveTextArray;
size_t iSize = 0;
if (!wsContent.IsEmpty()) {
FX_STRSIZE iStart = 0;
@@ -4132,12 +4128,12 @@
break;
}
case XFA_ObjectType::ContentNode: {
- CFX_WideString wsContentType;
+ WideString wsContentType;
if (GetElementType() == XFA_Element::ExData) {
GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (wsContentType == L"text/html") {
wsContentType = L"";
- SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC());
+ SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringView());
}
}
CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -4193,8 +4189,8 @@
return true;
}
-bool CXFA_Node::SetContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
+bool CXFA_Node::SetContent(const WideString& wsContent,
+ const WideString& wsXMLValue,
bool bNotify,
bool bScriptModify,
bool bSyncData) {
@@ -4202,16 +4198,16 @@
bSyncData);
}
-CFX_WideString CXFA_Node::GetScriptContent(bool bScriptModify) {
- CFX_WideString wsContent;
- return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString();
+WideString CXFA_Node::GetScriptContent(bool bScriptModify) {
+ WideString wsContent;
+ return TryContent(wsContent, bScriptModify) ? wsContent : WideString();
}
-CFX_WideString CXFA_Node::GetContent() {
+WideString CXFA_Node::GetContent() {
return GetScriptContent();
}
-bool CXFA_Node::TryContent(CFX_WideString& wsContent,
+bool CXFA_Node::TryContent(WideString& wsContent,
bool bScriptModify,
bool bProto) {
CXFA_Node* pNode = nullptr;
@@ -4238,7 +4234,7 @@
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
+ WideString wsContentType;
GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (wsContentType == L"text/html") {
element = XFA_Element::SharpxHTML;
@@ -4298,7 +4294,7 @@
}
}
-bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
+bool CXFA_Node::TryNamespace(WideString& wsNamespace) {
wsNamespace.clear();
if (IsModelNode() || GetElementType() == XFA_Element::Packet) {
CFX_XMLNode* pXMLNode = GetXMLMappingNode();
@@ -4554,17 +4550,17 @@
if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement =
static_cast<CFX_XMLElement*>(pNode->m_pXMLNode);
- CFX_WideStringC wsAttributeName =
+ WideStringView wsAttributeName =
pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
// TODO(tsepez): check usage of c_str() below.
pXMLElement->RemoveAttribute(wsAttributeName.unterminated_c_str());
}
- CFX_WideString wsName;
+ WideString wsName;
pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName);
- CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
+ WideStringView wsValue = GetCData(XFA_ATTRIBUTE_Value);
if (!wsValue.IsEmpty()) {
- pNewXMLElement->SetTextData(CFX_WideString(wsValue));
+ pNewXMLElement->SetTextData(WideString(wsValue));
}
pNode->m_pXMLNode = pNewXMLElement;
pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
@@ -4576,7 +4572,7 @@
return true;
}
-CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const {
+CXFA_Node* CXFA_Node::GetFirstChildByName(const WideStringView& wsName) const {
return GetFirstChildByName(FX_HashCode_GetW(wsName, false));
}
@@ -4611,7 +4607,7 @@
}
CXFA_Node* CXFA_Node::GetNextSameNameSibling(
- const CFX_WideStringC& wsNodeName) const {
+ const WideStringView& wsNodeName) const {
return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false));
}
@@ -4641,7 +4637,7 @@
return pScriptContext->GetIndexByClassName(const_cast<CXFA_Node*>(this));
}
-void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) {
+void CXFA_Node::GetSOMExpression(WideString& wsSOMExpression) {
CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
if (!pScriptContext) {
return;
@@ -4664,8 +4660,8 @@
break;
}
if (eType == XFA_Element::InstanceManager) {
- CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsName = GetCData(XFA_ATTRIBUTE_Name);
+ WideStringView wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name);
if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' &&
wsInstName.Right(wsInstName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
@@ -4733,7 +4729,7 @@
}
}
-int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName,
+int32_t CXFA_Node::execSingleEventByName(const WideStringView& wsEventName,
XFA_Element eType) {
int32_t iRet = XFA_EVENTERROR_NotExist;
const XFA_ExecEventParaInfo* eventParaInfo =
@@ -4797,7 +4793,7 @@
void CXFA_Node::UpdateNameHash() {
const XFA_NOTSUREATTRIBUTE* pNotsure =
XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name);
- CFX_WideStringC wsName;
+ WideStringView wsName;
if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) {
wsName = GetCData(XFA_ATTRIBUTE_Name);
m_dwNameHash = FX_HashCode_GetW(wsName, false);
@@ -4809,7 +4805,7 @@
CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() {
if (!m_pXMLNode) {
- CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
+ WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
m_pXMLNode = new CFX_XMLElement(wsTag);
SetFlag(XFA_NodeFlag_OwnXMLNode, false);
}
@@ -4852,19 +4848,19 @@
return false;
}
-void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) {
+void CXFA_Node::SetMapModuleString(void* pKey, const WideStringView& wsValue) {
SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(),
wsValue.GetLength() * sizeof(wchar_t));
}
-bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) {
+bool CXFA_Node::GetMapModuleString(void* pKey, WideStringView& wsValue) {
void* pValue;
int32_t iBytes;
if (!GetMapModuleBuffer(pKey, pValue, iBytes))
return false;
// Defensive measure: no out-of-bounds pointers even if zero length.
int32_t iChars = iBytes / sizeof(wchar_t);
- wsValue = CFX_WideStringC(iChars ? (const wchar_t*)pValue : nullptr, iChars);
+ wsValue = WideStringView(iChars ? (const wchar_t*)pValue : nullptr, iChars);
return true;
}
@@ -5047,8 +5043,8 @@
}
}
if (pDstModule->IsNodeV()) {
- CFX_WideString wsValue = pDstModule->GetScriptContent(false);
- CFX_WideString wsFormatValue(wsValue);
+ WideString wsValue = pDstModule->GetScriptContent(false);
+ WideString wsFormatValue(wsValue);
CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
if (pWidgetData) {
pWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
@@ -5076,15 +5072,13 @@
pSrcModule->MoveBufferMapData(pDstModule, pKey);
}
-void CXFA_Node::ThrowMissingPropertyException(
- const CFX_WideString& obj,
- const CFX_WideString& prop) const {
+void CXFA_Node::ThrowMissingPropertyException(const WideString& obj,
+ const WideString& prop) const {
ThrowException(L"'%s' doesn't have property '%s'.", obj.c_str(),
prop.c_str());
}
-void CXFA_Node::ThrowTooManyOccurancesException(
- const CFX_WideString& obj) const {
+void CXFA_Node::ThrowTooManyOccurancesException(const WideString& obj) const {
ThrowException(
L"The element [%s] has violated its allowable number of occurrences.",
obj.c_str());
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index db4b2ce..7faed0e 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -105,29 +105,29 @@
void UpdateNameHash();
bool HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit = false);
bool SetAttribute(XFA_ATTRIBUTE eAttr,
- const CFX_WideStringC& wsValue,
+ const WideStringView& wsValue,
bool bNotify = false);
bool GetAttribute(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
+ WideString& wsValue,
bool bUseDefault = true);
- bool SetAttribute(const CFX_WideStringC& wsAttr,
- const CFX_WideStringC& wsValue,
+ bool SetAttribute(const WideStringView& wsAttr,
+ const WideStringView& wsValue,
bool bNotify = false);
- bool GetAttribute(const CFX_WideStringC& wsAttr,
- CFX_WideString& wsValue,
+ bool GetAttribute(const WideStringView& wsAttr,
+ WideString& wsValue,
bool bUseDefault = true);
- bool RemoveAttribute(const CFX_WideStringC& wsAttr);
- bool SetContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
+ bool RemoveAttribute(const WideStringView& wsAttr);
+ bool SetContent(const WideString& wsContent,
+ const WideString& wsXMLValue,
bool bNotify = false,
bool bScriptModify = false,
bool bSyncData = true);
- bool TryContent(CFX_WideString& wsContent,
+ bool TryContent(WideString& wsContent,
bool bScriptModify = false,
bool bProto = true);
- CFX_WideString GetContent();
+ WideString GetContent();
- bool TryNamespace(CFX_WideString& wsNamespace);
+ bool TryNamespace(WideString& wsNamespace);
bool SetBoolean(XFA_ATTRIBUTE eAttr, bool bValue, bool bNotify = false) {
return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue,
@@ -163,24 +163,24 @@
return TryEnum(eAttr, eValue, true) ? eValue : XFA_ATTRIBUTEENUM_Unknown;
}
bool SetCData(XFA_ATTRIBUTE eAttr,
- const CFX_WideString& wsValue,
+ const WideString& wsValue,
bool bNotify = false,
bool bScriptModify = false);
- bool SetAttributeValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsXMLValue,
+ bool SetAttributeValue(const WideString& wsValue,
+ const WideString& wsXMLValue,
bool bNotify = false,
bool bScriptModify = false);
bool TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
+ WideString& wsValue,
bool bUseDefault = true,
bool bProto = true);
bool TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideStringC& wsValue,
+ WideStringView& wsValue,
bool bUseDefault = true,
bool bProto = true);
- CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr) {
- CFX_WideStringC wsValue;
- return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC();
+ WideStringView GetCData(XFA_ATTRIBUTE eAttr) {
+ WideStringView wsValue;
+ return TryCData(eAttr, wsValue) ? wsValue : WideStringView();
}
bool SetMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement mValue,
@@ -236,24 +236,24 @@
bool HasBindItem();
CXFA_WidgetData* GetWidgetData();
CXFA_WidgetData* GetContainerWidgetData();
- bool GetLocaleName(CFX_WideString& wsLocaleName);
+ bool GetLocaleName(WideString& wsLocaleName);
XFA_ATTRIBUTEENUM GetIntact();
- CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const;
+ CXFA_Node* GetFirstChildByName(const WideStringView& wsNodeName) const;
CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const;
CXFA_Node* GetFirstChildByClass(XFA_Element eType) const;
CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const;
- CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const;
+ CXFA_Node* GetNextSameNameSibling(const WideStringView& wsNodeName) const;
CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const;
int32_t GetNodeSameNameIndex() const;
int32_t GetNodeSameClassIndex() const;
- void GetSOMExpression(CFX_WideString& wsSOMExpression);
+ void GetSOMExpression(WideString& wsSOMExpression);
CXFA_Node* GetInstanceMgrOfSubform();
CXFA_Node* GetOccurNode();
void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- CFX_WideString wsExpression,
+ WideString wsExpression,
uint32_t dwFlag,
CXFA_Node* refNode = nullptr);
void Script_TreeClass_All(CFXJSE_Value* pValue,
@@ -540,7 +540,7 @@
uint16_t ePacket,
XFA_ObjectType oType,
XFA_Element eType,
- const CFX_WideStringC& elementName);
+ const WideStringView& elementName);
~CXFA_Node() override;
bool HasFlag(XFA_NodeFlag dwFlag) const;
@@ -556,20 +556,20 @@
void OnRemoved(bool bNotify);
void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify);
- int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
+ int32_t execSingleEventByName(const WideStringView& wsEventName,
XFA_Element eType);
- bool SetScriptContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
+ bool SetScriptContent(const WideString& wsContent,
+ const WideString& wsXMLValue,
bool bNotify = true,
bool bScriptModify = false,
bool bSyncData = true);
- CFX_WideString GetScriptContent(bool bScriptModify = false);
+ WideString GetScriptContent(bool bScriptModify = false);
XFA_MAPMODULEDATA* CreateMapModuleData();
XFA_MAPMODULEDATA* GetMapModuleData() const;
void SetMapModuleValue(void* pKey, void* pValue);
bool GetMapModuleValue(void* pKey, void*& pValue);
- void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue);
- bool GetMapModuleString(void* pKey, CFX_WideStringC& wsValue);
+ void SetMapModuleString(void* pKey, const WideStringView& wsValue);
+ bool GetMapModuleString(void* pKey, WideStringView& wsValue);
void SetMapModuleBuffer(
void* pKey,
void* pValue,
@@ -600,9 +600,9 @@
XFA_MAPMODULEDATA* m_pMapModuleData;
private:
- void ThrowMissingPropertyException(const CFX_WideString& obj,
- const CFX_WideString& prop) const;
- void ThrowTooManyOccurancesException(const CFX_WideString& obj) const;
+ void ThrowMissingPropertyException(const WideString& obj,
+ const WideString& prop) const;
+ void ThrowTooManyOccurancesException(const WideString& obj) const;
};
#endif // XFA_FXFA_PARSER_CXFA_NODE_H_
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 4f1ed04..bc91c66 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -31,7 +31,7 @@
return nullptr;
std::vector<CXFA_Node*> siblings;
- uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false);
+ uint32_t uNameHash = FX_HashCode_GetW(WideStringView(pwsName), false);
NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName);
return !siblings.empty() ? siblings[0] : nullptr;
}
@@ -228,13 +228,13 @@
}
void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode,
- CFX_WideString& wsName,
+ WideString& wsName,
bool bIsAllPath,
XFA_LOGIC_TYPE eLogicType) {
wsName.clear();
if (bIsAllPath) {
GetNameExpression(refNode, wsName, false, eLogicType);
- CFX_WideString wsParent;
+ WideString wsParent;
CXFA_Node* parent =
ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent);
while (parent) {
@@ -247,7 +247,7 @@
return;
}
- CFX_WideString ws;
+ WideString ws;
bool bIsProperty = NodeIsProperty(refNode);
if (refNode->IsUnnamed() ||
(bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) {
@@ -275,9 +275,9 @@
return false;
}
-bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) {
+bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) {
int32_t iLen = wsCondition.GetLength();
- CFX_WideString wsIndex(L"0");
+ WideString wsIndex(L"0");
bool bAll = false;
if (iLen == 0) {
m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne;
@@ -314,8 +314,8 @@
}
bool CXFA_NodeHelper::ResolveNodes_CreateNode(
- CFX_WideString wsName,
- CFX_WideString wsCondition,
+ WideString wsName,
+ WideString wsCondition,
bool bLastNode,
CXFA_ScriptContext* pScriptContext) {
if (!m_pCreateParent) {
@@ -336,7 +336,7 @@
CreateNode_ForCondition(wsCondition);
}
if (bIsClassName) {
- XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC());
+ XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringView());
if (eType == XFA_Element::Unknown)
return false;
@@ -358,7 +358,7 @@
for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) {
CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType);
if (pNewNode) {
- pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringC());
+ pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringView());
pNewNode->CreateXMLMappingNode();
m_pCreateParent->InsertChild(pNewNode);
if (iIndex == m_iCreateCount - 1) {
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h
index cf6c2f1..4c7d7ae 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.h
+++ b/xfa/fxfa/parser/cxfa_nodehelper.h
@@ -49,15 +49,15 @@
bool bIsProperty = false,
bool bIsClassIndex = false);
void GetNameExpression(CXFA_Node* refNode,
- CFX_WideString& wsName,
+ WideString& wsName,
bool bIsAllPath,
XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
bool NodeIsTransparent(CXFA_Node* refNode);
- bool ResolveNodes_CreateNode(CFX_WideString wsName,
- CFX_WideString wsCondition,
+ bool ResolveNodes_CreateNode(WideString wsName,
+ WideString wsCondition,
bool bLastNode,
CXFA_ScriptContext* pScriptContext);
- bool CreateNode_ForCondition(CFX_WideString& wsCondition);
+ bool CreateNode_ForCondition(WideString& wsCondition);
void SetCreateNodeType(CXFA_Node* refNode);
bool NodeIsProperty(CXFA_Node* refNode);
diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp
index f47a1b1..cea1f12 100644
--- a/xfa/fxfa/parser/cxfa_nodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_nodelist.cpp
@@ -17,14 +17,14 @@
: CXFA_Object(pDocument,
XFA_ObjectType::NodeList,
XFA_Element::NodeList,
- CFX_WideStringC(L"nodeList")) {
+ WideStringView(L"nodeList")) {
m_pDocument->GetScriptContext()->AddToCacheList(
std::unique_ptr<CXFA_NodeList>(this));
}
CXFA_NodeList::~CXFA_NodeList() {}
-CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
+CXFA_Node* CXFA_NodeList::NamedItem(const WideStringView& wsName) {
uint32_t dwHashCode = FX_HashCode_GetW(wsName, false);
int32_t iCount = GetLength();
for (int32_t i = 0; i < iCount; i++) {
@@ -105,9 +105,9 @@
return;
}
- CFX_ByteString szName = pArguments->GetUTF8String(0);
+ ByteString szName = pArguments->GetUTF8String(0);
CXFA_Node* pNode =
- NamedItem(CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
+ NamedItem(WideString::FromUTF8(szName.AsStringView()).AsStringView());
if (!pNode)
return;
diff --git a/xfa/fxfa/parser/cxfa_nodelist.h b/xfa/fxfa/parser/cxfa_nodelist.h
index 6fffb7b..2fccd5d 100644
--- a/xfa/fxfa/parser/cxfa_nodelist.h
+++ b/xfa/fxfa/parser/cxfa_nodelist.h
@@ -19,7 +19,7 @@
explicit CXFA_NodeList(CXFA_Document* pDocument);
~CXFA_NodeList() override;
- CXFA_Node* NamedItem(const CFX_WideStringC& wsName);
+ CXFA_Node* NamedItem(const WideStringView& wsName);
virtual int32_t GetLength() = 0;
virtual bool Append(CXFA_Node* pNode) = 0;
virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp
index 78b0cef..d0d1fd3 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.cpp
+++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp
@@ -24,7 +24,7 @@
} // namespace
-CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) {
+WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) {
switch (category) {
case FX_LOCALENUMPATTERN_Percent:
return g_FX_Percent;
@@ -35,20 +35,19 @@
case FX_LOCALENUMPATTERN_Integer:
return g_FX_Integer;
}
- return CFX_WideString();
+ return WideString();
}
CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {}
CXFA_NodeLocale::~CXFA_NodeLocale() {}
-CFX_WideString CXFA_NodeLocale::GetName() const {
- return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
- : nullptr);
+WideString CXFA_NodeLocale::GetName() const {
+ return WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
+ : nullptr);
}
-CFX_WideString CXFA_NodeLocale::GetNumbericSymbol(
- FX_LOCALENUMSYMBOL eType) const {
+WideString CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const {
switch (eType) {
case FX_LOCALENUMSYMBOL_Decimal:
return GetSymbol(XFA_Element::NumberSymbols, L"decimal");
@@ -65,25 +64,25 @@
case FX_LOCALENUMSYMBOL_CurrencyName:
return GetSymbol(XFA_Element::CurrencySymbols, L"isoname");
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CXFA_NodeLocale::GetDateTimeSymbols() const {
+WideString CXFA_NodeLocale::GetDateTimeSymbols() const {
CXFA_Node* pSymbols =
m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols)
: nullptr;
- return pSymbols ? pSymbols->GetContent() : CFX_WideString();
+ return pSymbols ? pSymbols->GetContent() : WideString();
}
-CFX_WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
+WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
return GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr);
}
-CFX_WideString CXFA_NodeLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
+WideString CXFA_NodeLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
return GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr);
}
-CFX_WideString CXFA_NodeLocale::GetMeridiemName(bool bAM) const {
+WideString CXFA_NodeLocale::GetMeridiemName(bool bAM) const {
return GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false);
}
@@ -91,11 +90,11 @@
return CXFA_TimeZoneProvider().GetTimeZone();
}
-CFX_WideString CXFA_NodeLocale::GetEraName(bool bAD) const {
+WideString CXFA_NodeLocale::GetEraName(bool bAD) const {
return GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false);
}
-CFX_WideString CXFA_NodeLocale::GetDatePattern(
+WideString CXFA_NodeLocale::GetDatePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const {
switch (eType) {
case FX_LOCALEDATETIMESUBCATEGORY_Short:
@@ -108,10 +107,10 @@
case FX_LOCALEDATETIMESUBCATEGORY_Long:
return GetSymbol(XFA_Element::DatePatterns, L"long");
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CXFA_NodeLocale::GetTimePattern(
+WideString CXFA_NodeLocale::GetTimePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const {
switch (eType) {
case FX_LOCALEDATETIMESUBCATEGORY_Short:
@@ -124,20 +123,19 @@
case FX_LOCALEDATETIMESUBCATEGORY_Long:
return GetSymbol(XFA_Element::TimePatterns, L"long");
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CXFA_NodeLocale::GetNumPattern(
- FX_LOCALENUMSUBCATEGORY eType) const {
+WideString CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const {
return XFA_PatternToString(eType);
}
CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const {
+ const WideStringView& wsName) const {
CXFA_Node* pChild =
pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
while (pChild) {
- CFX_WideString wsChild;
+ WideString wsChild;
if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) {
if (wsChild == wsName)
return pChild;
@@ -147,29 +145,28 @@
return nullptr;
}
-CFX_WideString CXFA_NodeLocale::GetSymbol(
- XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const {
+WideString CXFA_NodeLocale::GetSymbol(XFA_Element eElement,
+ const WideStringView& symbol_type) const {
CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr;
CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+ return pSymbol ? pSymbol->GetContent() : WideString();
}
-CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const {
+WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const {
CXFA_Node* pCalendar =
m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols)
: nullptr;
if (!pCalendar)
- return CFX_WideString();
+ return WideString();
CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+ return pSymbol ? pSymbol->GetContent() : WideString();
}
}
- return CFX_WideString();
+ return WideString();
}
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h
index e051bb6..5ad0d4c 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.h
+++ b/xfa/fxfa/parser/cxfa_nodelocale.h
@@ -14,7 +14,7 @@
class CXFA_Node;
-CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
+WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
class CXFA_NodeLocale : public IFX_Locale {
public:
@@ -22,30 +22,28 @@
~CXFA_NodeLocale() override;
// IFX_Locale
- CFX_WideString GetName() const override;
- CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
+ WideString GetName() const override;
+ WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
- CFX_WideString GetDateTimeSymbols() const override;
- CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
- CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
- CFX_WideString GetMeridiemName(bool bAM) const override;
+ WideString GetDateTimeSymbols() const override;
+ WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
+ WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
+ WideString GetMeridiemName(bool bAM) const override;
FX_TIMEZONE GetTimeZone() const override;
- CFX_WideString GetEraName(bool bAD) const override;
+ WideString GetEraName(bool bAD) const override;
- CFX_WideString GetDatePattern(
- FX_LOCALEDATETIMESUBCATEGORY eType) const override;
- CFX_WideString GetTimePattern(
- FX_LOCALEDATETIMESUBCATEGORY eType) const override;
- CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
+ WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
private:
CXFA_Node* GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const;
- CFX_WideString GetSymbol(XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const;
- CFX_WideString GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const;
+ const WideStringView& wsName) const;
+ WideString GetSymbol(XFA_Element eElement,
+ const WideStringView& symbol_type) const;
+ WideString GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const;
CFX_UnownedPtr<CXFA_Node> const m_pLocale;
};
diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp
index 8ebedf9..c234204 100644
--- a/xfa/fxfa/parser/cxfa_object.cpp
+++ b/xfa/fxfa/parser/cxfa_object.cpp
@@ -16,7 +16,7 @@
CXFA_Object::CXFA_Object(CXFA_Document* pDocument,
XFA_ObjectType objectType,
XFA_Element elementType,
- const CFX_WideStringC& elementName)
+ const WideStringView& elementName)
: CFXJSE_HostObject(kXFA),
m_pDocument(pDocument),
m_objectType(objectType),
@@ -33,7 +33,7 @@
ThrowInvalidPropertyException();
return;
}
- pValue->SetString(FX_UTF8Encode(GetClassName()).AsStringC());
+ pValue->SetString(FX_UTF8Encode(GetClassName()).AsStringView());
}
void CXFA_Object::ThrowInvalidPropertyException() const {
@@ -45,7 +45,7 @@
}
void CXFA_Object::ThrowParamCountMismatchException(
- const CFX_WideString& method) const {
+ const WideString& method) const {
ThrowException(L"Incorrect number of parameters calling method '%.16s'.",
method.c_str());
}
@@ -55,13 +55,13 @@
}
void CXFA_Object::ThrowException(const wchar_t* str, ...) const {
- CFX_WideString wsMessage;
+ WideString wsMessage;
va_list arg_ptr;
va_start(arg_ptr, str);
wsMessage.FormatV(str, arg_ptr);
va_end(arg_ptr);
ASSERT(!wsMessage.IsEmpty());
- FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC());
+ FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView());
}
CXFA_Node* CXFA_Object::AsNode() {
diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h
index 4f1850f..49442d2 100644
--- a/xfa/fxfa/parser/cxfa_object.h
+++ b/xfa/fxfa/parser/cxfa_object.h
@@ -35,7 +35,7 @@
CXFA_Object(CXFA_Document* pDocument,
XFA_ObjectType objectType,
XFA_Element eType,
- const CFX_WideStringC& elementName);
+ const WideStringView& elementName);
~CXFA_Object() override;
CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
@@ -71,7 +71,7 @@
const CXFA_NodeList* AsNodeList() const;
XFA_Element GetElementType() const { return m_elementType; }
- CFX_WideStringC GetClassName() const { return m_elementName; }
+ WideStringView GetClassName() const { return m_elementName; }
uint32_t GetClassHashCode() const { return m_elementNameHash; }
void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
@@ -81,7 +81,7 @@
void ThrowInvalidPropertyException() const;
void ThrowArgumentMismatchException() const;
void ThrowIndexOutOfBoundsException() const;
- void ThrowParamCountMismatchException(const CFX_WideString& method) const;
+ void ThrowParamCountMismatchException(const WideString& method) const;
protected:
void ThrowException(const wchar_t* str, ...) const;
@@ -91,7 +91,7 @@
const XFA_Element m_elementType;
const uint32_t m_elementNameHash;
- const CFX_WideStringC m_elementName;
+ const WideStringView m_elementName;
};
CXFA_Node* ToNode(CXFA_Object* pObj);
diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
index 15c3f14..4d0ec51 100644
--- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
@@ -34,7 +34,7 @@
if (!rnd.m_CurObject->IsNode()) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) {
return ResolveForAttributeRs(rnd.m_CurObject, rnd,
- rnd.m_wsName.AsStringC());
+ rnd.m_wsName.AsStringView());
}
return 0;
}
@@ -72,7 +72,7 @@
rnd.m_Objects.push_back(rnd.m_CurObject);
} else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) &&
ResolveForAttributeRs(rnd.m_CurObject, rnd,
- rnd.m_wsName.AsStringC())) {
+ rnd.m_wsName.AsStringView())) {
return 1;
}
if (!rnd.m_Objects.empty())
@@ -87,8 +87,8 @@
}
int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) {
- CFX_WideString wsName = rnd.m_wsName;
- CFX_WideString wsCondition = rnd.m_wsCondition;
+ WideString wsName = rnd.m_wsName;
+ WideString wsCondition = rnd.m_wsCondition;
CXFA_Node* findNode = nullptr;
bool bClassName = false;
if (wsName.GetLength() && wsName[0] == '#') {
@@ -115,8 +115,8 @@
}
int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) {
- CFX_WideString wsName = rnd.m_wsName;
- CFX_WideString wsCondition = rnd.m_wsCondition;
+ WideString wsName = rnd.m_wsName;
+ WideString wsCondition = rnd.m_wsCondition;
int32_t iNameLen = wsName.GetLength();
if (iNameLen == 1) {
rnd.m_Objects.push_back(rnd.m_CurObject);
@@ -126,7 +126,7 @@
return -1;
}
XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(FX_HashCode_GetW(
- CFX_WideStringC(wsName.c_str() + 1, iNameLen - 1), false));
+ WideStringView(wsName.c_str() + 1, iNameLen - 1), false));
if (dwNameHash == XFA_HASHCODE_Xfa) {
rnd.m_Objects.push_back(rnd.m_pSC->GetDocument()->GetRoot());
} else {
@@ -154,7 +154,7 @@
rndFind.m_CurObject = datasets;
rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
rndFind.m_uHashName = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
+ FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false));
rndFind.m_nLevel = rnd.m_nLevel + 1;
rndFind.m_dwStyles = XFA_RESOLVENODE_Children;
rndFind.m_wsCondition = rnd.m_wsCondition;
@@ -165,10 +165,10 @@
}
int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) {
- CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
- CFX_WideString wsCondition = rnd.m_wsCondition;
+ WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
+ WideString wsCondition = rnd.m_wsCondition;
CXFA_Node* curNode = ToNode(rnd.m_CurObject);
- if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC()))
+ if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringView()))
return 1;
CXFA_ResolveNodesData rndFind;
@@ -179,7 +179,7 @@
rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes;
rndFind.m_wsName = wsName;
rndFind.m_uHashName = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
+ FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false));
rndFind.m_wsCondition = wsCondition;
rndFind.m_CurObject = curNode;
ResolveNormal(rndFind);
@@ -199,7 +199,7 @@
int32_t CXFA_ResolveProcessor::ResolveForAttributeRs(
CXFA_Object* curNode,
CXFA_ResolveNodesData& rnd,
- const CFX_WideStringC& strAttr) {
+ const WideStringView& strAttr) {
const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute =
XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr);
if (!lpScriptAttribute)
@@ -218,9 +218,9 @@
CXFA_Node* curNode = rnd.m_CurObject->AsNode();
size_t nNum = rnd.m_Objects.size();
uint32_t dwStyles = rnd.m_dwStyles;
- CFX_WideString& wsName = rnd.m_wsName;
+ WideString& wsName = rnd.m_wsName;
XFA_HashCode uNameHash = rnd.m_uHashName;
- CFX_WideString& wsCondition = rnd.m_wsCondition;
+ WideString& wsCondition = rnd.m_wsCondition;
CXFA_ResolveNodesData rndFind;
rndFind.m_wsName = rnd.m_wsName;
rndFind.m_wsCondition = rnd.m_wsCondition;
@@ -256,7 +256,7 @@
} else {
rndFind.m_CurObject = pVariablesNode;
SetStylesForChild(dwStyles, rndFind);
- CFX_WideString wsSaveCondition = rndFind.m_wsCondition;
+ WideString wsSaveCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
ResolveNormal(rndFind);
rndFind.m_wsCondition = wsSaveCondition;
@@ -288,7 +288,7 @@
bSetFlag = true;
}
rndFind.m_CurObject = child;
- CFX_WideString wsSaveCondition = rndFind.m_wsCondition;
+ WideString wsSaveCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
ResolveNormal(rndFind);
rndFind.m_wsCondition = wsSaveCondition;
@@ -317,7 +317,7 @@
}
}
if (dwStyles & XFA_RESOLVENODE_Attributes) {
- if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC()))
+ if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringView()))
return 1;
}
if (dwStyles & XFA_RESOLVENODE_Properties) {
@@ -346,7 +346,7 @@
pProp = pInstanceManager->GetProperty(0, XFA_Element::Occur, true);
}
} else {
- XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC());
+ XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringView());
if (eType != XFA_Element::Unknown) {
pProp = curNode->AsNode()->GetProperty(0, eType,
eType != XFA_Element::PageSet);
@@ -419,7 +419,7 @@
}
if (bInnerSearch) {
rndFind.m_CurObject = child;
- CFX_WideString wsOriginCondition = rndFind.m_wsCondition;
+ WideString wsOriginCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
uint32_t dwOriginStyle = rndFind.m_dwStyles;
rndFind.m_dwStyles = dwOriginStyle | XFA_RESOLVENODE_ALL;
@@ -488,7 +488,7 @@
return nType;
}
-int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
+int32_t CXFA_ResolveProcessor::GetFilter(const WideStringView& wsExpression,
int32_t nStart,
CXFA_ResolveNodesData& rnd) {
ASSERT(nStart > -1);
@@ -496,8 +496,8 @@
if (nStart >= iLength) {
return 0;
}
- CFX_WideString& wsName = rnd.m_wsName;
- CFX_WideString& wsCondition = rnd.m_wsCondition;
+ WideString& wsName = rnd.m_wsName;
+ WideString& wsCondition = rnd.m_wsCondition;
wchar_t* pNameBuf = wsName.GetBuffer(iLength - nStart);
wchar_t* pConditionBuf = wsCondition.GetBuffer(iLength - nStart);
int32_t nNameCount = 0;
@@ -585,11 +585,11 @@
wsCondition.TrimLeft();
wsCondition.TrimRight();
rnd.m_uHashName =
- static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringC(), false));
+ static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringView(), false));
return nStart;
}
void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex,
- CFX_WideString wsCondition,
+ WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd) {
int32_t iLen = wsCondition.GetLength();
@@ -635,7 +635,7 @@
if (iFoundCount == 1 && !iLen) {
return;
}
- CFX_WideString wsIndex;
+ WideString wsIndex;
wsIndex = wsCondition.Mid(i, iLen - 1 - i);
int32_t iIndex = wsIndex.GetInteger();
if (bRelative) {
@@ -655,11 +655,11 @@
}
void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex,
- CFX_WideString wsCondition,
+ WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd) {
ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects));
- CFX_WideString wsExpression;
+ WideString wsExpression;
XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown;
if (wsCondition.Left(2) == L".[" && wsCondition.Last() == L']') {
eLangType = XFA_SCRIPTLANGTYPE_Formcalc;
@@ -673,7 +673,7 @@
wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3);
for (int32_t i = iFoundCount - 1; i >= 0; i--) {
auto pRetValue = pdfium::MakeUnique<CFXJSE_Value>(rnd.m_pSC->GetRuntime());
- bool bRet = pContext->RunScript(eLangType, wsExpression.AsStringC(),
+ bool bRet = pContext->RunScript(eLangType, wsExpression.AsStringView(),
pRetValue.get(), rnd.m_Objects[i]);
if (!bRet || !pRetValue->ToBoolean())
rnd.m_Objects.erase(rnd.m_Objects.begin() + i);
@@ -681,7 +681,7 @@
}
void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd,
- CFX_WideString wsCondition) {
+ WideString wsCondition) {
int32_t iCurrIndex = 0;
const std::vector<CXFA_Node*>* pArray = rnd.m_pSC->GetUpObjectArray();
if (!pArray->empty()) {
@@ -753,7 +753,7 @@
int32_t CXFA_ResolveProcessor::SetResultCreateNode(
XFA_RESOLVENODE_RS& resolveNodeRS,
- CFX_WideString& wsLastCondition) {
+ WideString& wsLastCondition) {
if (m_pNodeHelper->m_pCreateParent)
resolveNodeRS.objects.push_back(m_pNodeHelper->m_pCreateParent);
else
@@ -767,7 +767,7 @@
return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects);
}
-void CXFA_ResolveProcessor::SetIndexDataBind(CFX_WideString& wsNextCondition,
+void CXFA_ResolveProcessor::SetIndexDataBind(WideString& wsNextCondition,
int32_t& iIndex,
int32_t iCount) {
if (m_pNodeHelper->CreateNode_ForCondition(wsNextCondition)) {
diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.h b/xfa/fxfa/parser/cxfa_resolveprocessor.h
index f4eafea..b48ee36 100644
--- a/xfa/fxfa/parser/cxfa_resolveprocessor.h
+++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h
@@ -22,9 +22,9 @@
CXFA_ScriptContext* m_pSC;
CXFA_Object* m_CurObject;
- CFX_WideString m_wsName;
+ WideString m_wsName;
XFA_HashCode m_uHashName;
- CFX_WideString m_wsCondition;
+ WideString m_wsCondition;
int32_t m_nLevel;
std::vector<CXFA_Object*> m_Objects; // Not owned.
uint32_t m_dwStyles;
@@ -38,12 +38,12 @@
~CXFA_ResolveProcessor();
int32_t Resolve(CXFA_ResolveNodesData& rnd);
- int32_t GetFilter(const CFX_WideStringC& wsExpression,
+ int32_t GetFilter(const WideStringView& wsExpression,
int32_t nStart,
CXFA_ResolveNodesData& rnd);
int32_t SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS,
- CFX_WideString& wsLastCondition);
- void SetIndexDataBind(CFX_WideString& wsNextCondition,
+ WideString& wsLastCondition);
+ void SetIndexDataBind(WideString& wsNextCondition,
int32_t& iIndex,
int32_t iCount);
void SetCurStart(int32_t start) { m_iCurStart = start; }
@@ -53,7 +53,7 @@
private:
int32_t ResolveForAttributeRs(CXFA_Object* curNode,
CXFA_ResolveNodesData& rnd,
- const CFX_WideStringC& strAttr);
+ const WideStringView& strAttr);
int32_t ResolveAnyChild(CXFA_ResolveNodesData& rnd);
int32_t ResolveDollar(CXFA_ResolveNodesData& rnd);
int32_t ResolveExcalmatory(CXFA_ResolveNodesData& rnd);
@@ -64,14 +64,14 @@
void SetStylesForChild(uint32_t dwParentStyles, CXFA_ResolveNodesData& rnd);
void ConditionArray(int32_t iCurIndex,
- CFX_WideString wsCondition,
+ WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd);
void DoPredicateFilter(int32_t iCurIndex,
- CFX_WideString wsCondition,
+ WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd);
- void FilterCondition(CXFA_ResolveNodesData& rnd, CFX_WideString wsCondition);
+ void FilterCondition(CXFA_ResolveNodesData& rnd, WideString wsCondition);
int32_t m_iCurStart;
std::unique_ptr<CXFA_NodeHelper> m_pNodeHelper;
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp
index ccd1997..6b6f6ba 100644
--- a/xfa/fxfa/parser/cxfa_script.cpp
+++ b/xfa/fxfa/parser/cxfa_script.cpp
@@ -11,7 +11,7 @@
CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {}
XFA_SCRIPTTYPE CXFA_Script::GetContentType() {
- CFX_WideStringC cData;
+ WideStringView cData;
if (m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, cData, false)) {
if (cData == L"application/x-javascript")
return XFA_SCRIPTTYPE_Javascript;
@@ -26,6 +26,6 @@
return m_pNode->GetEnum(XFA_ATTRIBUTE_RunAt);
}
-void CXFA_Script::GetExpression(CFX_WideString& wsExpression) {
+void CXFA_Script::GetExpression(WideString& wsExpression) {
m_pNode->TryContent(wsExpression);
}
diff --git a/xfa/fxfa/parser/cxfa_script.h b/xfa/fxfa/parser/cxfa_script.h
index d890624..bb98f58 100644
--- a/xfa/fxfa/parser/cxfa_script.h
+++ b/xfa/fxfa/parser/cxfa_script.h
@@ -26,7 +26,7 @@
XFA_SCRIPTTYPE GetContentType();
int32_t GetRunAt();
- void GetExpression(CFX_WideString& wsExpression);
+ void GetExpression(WideString& wsExpression);
};
#endif // XFA_FXFA_PARSER_CXFA_SCRIPT_H_
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 98b5da0..38d5039 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -81,7 +81,7 @@
}
const XFA_METHODINFO* GetMethodByName(XFA_Element eElement,
- const CFX_WideStringC& wsMethodName) {
+ const WideStringView& wsMethodName) {
if (wsMethodName.IsEmpty())
return nullptr;
@@ -146,10 +146,10 @@
}
bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
- const CFX_WideStringC& wsScript,
+ const WideStringView& wsScript,
CFXJSE_Value* hRetValue,
CXFA_Object* pThisObject) {
- CFX_ByteString btScript;
+ ByteString btScript;
CFX_AutoRestorer<XFA_SCRIPTLANGTYPE> typeRestorer(&m_eScriptType);
m_eScriptType = eScriptType;
if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) {
@@ -162,7 +162,7 @@
hRetValue->SetUndefined();
return false;
}
- btScript = FX_UTF8Encode(wsJavaScript.AsStringC());
+ btScript = FX_UTF8Encode(wsJavaScript.AsStringView());
} else {
btScript = FX_UTF8Encode(wsScript);
}
@@ -173,21 +173,21 @@
}
void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
CXFA_Object* lpOrginalNode = ToObject(pObject, nullptr);
CXFA_Document* pDoc = lpOrginalNode->GetDocument();
CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext();
CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode);
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
+ WideString wsPropName = WideString::FromUTF8(szPropName);
uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings |
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes;
CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject());
if (lpOrginalNode->IsVariablesThis())
pRefNode = ToNode(lpCurNode);
- if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue,
- dwFlag, true)) {
+ if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(),
+ pValue, dwFlag, true)) {
return;
}
if (lpOrginalNode->IsVariablesThis()) {
@@ -204,7 +204,7 @@
szPropName, pValue);
}
bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode,
- const CFX_WideStringC& propname,
+ const WideStringView& propname,
CFXJSE_Value* pValue,
uint32_t dwFlag,
bool bSetting) {
@@ -227,20 +227,20 @@
return true;
}
void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
CXFA_Object* pOriginalObject = ToObject(pObject, nullptr);
CXFA_Document* pDoc = pOriginalObject->GetDocument();
CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext();
CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject);
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
+ WideString wsPropName = WideString::FromUTF8(szPropName);
if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) {
if (szPropName == kFormCalcRuntime) {
lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue);
return;
}
XFA_HashCode uHashCode = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(wsPropName.AsStringC(), false));
+ FX_HashCode_GetW(wsPropName.AsStringView(), false));
if (uHashCode != XFA_HASHCODE_Layout) {
CXFA_Object* pObj =
lpScriptContext->GetDocument()->GetXFAObject(uHashCode);
@@ -256,13 +256,13 @@
if (pOriginalObject->IsVariablesThis()) {
pRefNode = ToNode(lpCurNode);
}
- if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue,
- dwFlag, false)) {
+ if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(),
+ pValue, dwFlag, false)) {
return;
}
dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings;
- if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue,
- dwFlag, false)) {
+ if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(),
+ pValue, dwFlag, false)) {
return;
}
CXFA_Object* pScriptObject =
@@ -280,14 +280,14 @@
szPropName, pValue);
}
void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pReturnValue) {
CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr);
if (!pOriginalObject) {
pReturnValue->SetUndefined();
return;
}
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
+ WideString wsPropName = WideString::FromUTF8(szPropName);
CXFA_ScriptContext* lpScriptContext =
pOriginalObject->GetDocument()->GetScriptContext();
CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject);
@@ -300,7 +300,7 @@
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes;
bool bRet = lpScriptContext->QueryNodeByFlag(
- ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, false);
+ ToNode(pObject), wsPropName.AsStringView(), pReturnValue, dwFlag, false);
if (bRet) {
return;
}
@@ -308,8 +308,9 @@
(lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript &&
!lpScriptContext->IsStrictScopeInJavaScript())) {
dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings;
- bRet = lpScriptContext->QueryNodeByFlag(
- ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, false);
+ bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject),
+ wsPropName.AsStringView(),
+ pReturnValue, dwFlag, false);
}
if (bRet) {
return;
@@ -325,7 +326,7 @@
}
}
void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pReturnValue) {
CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr);
if (!pOriginalObject)
@@ -334,9 +335,9 @@
CXFA_ScriptContext* lpScriptContext =
pOriginalObject->GetDocument()->GetScriptContext();
CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject);
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
+ WideString wsPropName = WideString::FromUTF8(szPropName);
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(
- pObject->GetElementType(), wsPropName.AsStringC());
+ pObject->GetElementType(), wsPropName.AsStringView());
if (lpAttributeInfo) {
(pObject->*(lpAttributeInfo->lpfnCallback))(
pReturnValue, true, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
@@ -347,17 +348,17 @@
}
CXFA_Node* pNode = ToNode(pObject);
CXFA_Node* pPropOrChild = nullptr;
- XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringC());
+ XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringView());
if (eType != XFA_Element::Unknown)
pPropOrChild = pNode->GetProperty(0, eType);
else
- pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC());
+ pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringView());
if (pPropOrChild) {
- CFX_WideString wsDefaultName(L"{default}");
+ WideString wsDefaultName(L"{default}");
const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo =
XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(),
- wsDefaultName.AsStringC());
+ wsDefaultName.AsStringView());
if (lpAttrInfo) {
(pPropOrChild->*(lpAttrInfo->lpfnCallback))(
pReturnValue, true, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute);
@@ -375,7 +376,7 @@
}
int32_t CXFA_ScriptContext::NormalPropTypeGetter(
CFXJSE_Value* pOriginalValue,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn) {
CXFA_Object* pObject = ToObject(pOriginalValue, nullptr);
if (!pObject)
@@ -385,19 +386,19 @@
pObject->GetDocument()->GetScriptContext();
pObject = lpScriptContext->GetVariablesThis(pObject);
XFA_Element eType = pObject->GetElementType();
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
- if (GetMethodByName(eType, wsPropName.AsStringC())) {
+ WideString wsPropName = WideString::FromUTF8(szPropName);
+ if (GetMethodByName(eType, wsPropName.AsStringView())) {
return FXJSE_ClassPropType_Method;
}
if (bQueryIn &&
- !XFA_GetScriptAttributeByName(eType, wsPropName.AsStringC())) {
+ !XFA_GetScriptAttributeByName(eType, wsPropName.AsStringView())) {
return FXJSE_ClassPropType_None;
}
return FXJSE_ClassPropType_Property;
}
int32_t CXFA_ScriptContext::GlobalPropTypeGetter(
CFXJSE_Value* pOriginalValue,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn) {
CXFA_Object* pObject = ToObject(pOriginalValue, nullptr);
if (!pObject)
@@ -407,14 +408,14 @@
pObject->GetDocument()->GetScriptContext();
pObject = lpScriptContext->GetVariablesThis(pObject);
XFA_Element eType = pObject->GetElementType();
- CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
- if (GetMethodByName(eType, wsPropName.AsStringC())) {
+ WideString wsPropName = WideString::FromUTF8(szPropName);
+ if (GetMethodByName(eType, wsPropName.AsStringView())) {
return FXJSE_ClassPropType_Method;
}
return FXJSE_ClassPropType_Property;
}
void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args) {
CXFA_Object* pObject = ToObject(pThis, nullptr);
if (!pObject)
@@ -423,9 +424,9 @@
CXFA_ScriptContext* lpScriptContext =
pObject->GetDocument()->GetScriptContext();
pObject = lpScriptContext->GetVariablesThis(pObject);
- CFX_WideString wsFunName = CFX_WideString::FromUTF8(szFuncName);
+ WideString wsFunName = WideString::FromUTF8(szFuncName);
const XFA_METHODINFO* lpMethodInfo =
- GetMethodByName(pObject->GetElementType(), wsFunName.AsStringC());
+ GetMethodByName(pObject->GetElementType(), wsFunName.AsStringView());
if (!lpMethodInfo)
return;
@@ -488,11 +489,11 @@
if (!pTextNode)
return false;
- CFX_WideStringC wsScript;
+ WideStringView wsScript;
if (!pTextNode->TryCData(XFA_ATTRIBUTE_Value, wsScript))
return false;
- CFX_ByteString btScript = FX_UTF8Encode(wsScript);
+ ByteString btScript = FX_UTF8Encode(wsScript);
auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent);
CFXJSE_Context* pVariablesContext =
@@ -503,7 +504,7 @@
}
bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue,
bool bGetter) {
if (!pScriptNode || pScriptNode->GetElementType() != XFA_Element::Script)
@@ -544,7 +545,7 @@
}
void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const {
- static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"};
+ static const ByteStringView OBJ_NAME[2] = {"Number", "Date"};
std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject();
auto hProp = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
for (int i = 0; i < 2; ++i) {
@@ -557,7 +558,7 @@
}
int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject,
- const CFX_WideStringC& wsExpression,
+ const WideStringView& wsExpression,
XFA_RESOLVENODE_RS& resolveNodeRS,
uint32_t dwStyles,
CXFA_Node* bindNode) {
@@ -757,7 +758,7 @@
lpNodeHelper->NodeIsProperty(refNode), true);
}
void CXFA_ScriptContext::GetSomExpression(CXFA_Node* refNode,
- CFX_WideString& wsExpression) {
+ WideString& wsExpression) {
CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper();
lpNodeHelper->GetNameExpression(refNode, wsExpression, true,
XFA_LOGIC_Transparent);
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h
index 45e6897..d3632e2 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.h
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.h
@@ -30,12 +30,12 @@
void SetEventParam(CXFA_EventParam param) { m_eventParam = param; }
CXFA_EventParam* GetEventParam() { return &m_eventParam; }
bool RunScript(XFA_SCRIPTLANGTYPE eScriptType,
- const CFX_WideStringC& wsScript,
+ const WideStringView& wsScript,
CFXJSE_Value* pRetValue,
CXFA_Object* pThisObject);
int32_t ResolveObjects(CXFA_Object* refObject,
- const CFX_WideStringC& wsExpression,
+ const WideStringView& wsExpression,
XFA_RESOLVENODE_RS& resolveNodeRS,
uint32_t dwStyles = XFA_RESOLVENODE_Children,
CXFA_Node* bindNode = nullptr);
@@ -46,7 +46,7 @@
int32_t GetIndexByName(CXFA_Node* refNode);
int32_t GetIndexByClassName(CXFA_Node* refNode);
- void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression);
+ void GetSomExpression(CXFA_Node* refNode, WideString& wsExpression);
void SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray);
void AddNodesOfRunScript(const std::vector<CXFA_Node*>& nodes);
@@ -56,36 +56,36 @@
void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; }
bool IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; }
bool QueryNodeByFlag(CXFA_Node* refNode,
- const CFX_WideStringC& propname,
+ const WideStringView& propname,
CFXJSE_Value* pValue,
uint32_t dwFlag,
bool bSetting);
bool QueryVariableValue(CXFA_Node* pScriptNode,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue,
bool bGetter);
- bool QueryBuiltinValue(const CFX_ByteStringC& szPropName,
+ bool QueryBuiltinValue(const ByteStringView& szPropName,
CFXJSE_Value* pValue);
static void GlobalPropertyGetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
static void GlobalPropertySetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
static void NormalPropertyGetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
static void NormalPropertySetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
static void NormalMethodCall(CFXJSE_Value* hThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
static int32_t NormalPropTypeGetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn);
static int32_t GlobalPropTypeGetter(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn);
bool RunVariablesScript(CXFA_Node* pScriptNode);
CXFA_Object* GetVariablesThis(CXFA_Object* pObject, bool bScriptNode = false);
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index dd72f40..5b58761 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -57,25 +57,25 @@
return nullptr;
}
-CFX_WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) {
- CFX_WideString wsNodeStr = pElement->GetNamespacePrefix();
- CFX_WideString wsNamespaceURI;
+WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) {
+ WideString wsNodeStr = pElement->GetNamespacePrefix();
+ WideString wsNamespaceURI;
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNodeStr.AsStringC(), &wsNamespaceURI)) {
- return CFX_WideString();
+ pElement, wsNodeStr.AsStringView(), &wsNamespaceURI)) {
+ return WideString();
}
return wsNamespaceURI;
}
bool MatchNodeName(CFX_XMLNode* pNode,
- const CFX_WideStringC& wsLocalTagName,
- const CFX_WideStringC& wsNamespaceURIPrefix,
+ const WideStringView& wsLocalTagName,
+ const WideStringView& wsNamespaceURIPrefix,
uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) {
if (!pNode || pNode->GetType() != FX_XMLNODE_Element)
return false;
CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pNode);
- CFX_WideString wsNodeStr = pElement->GetLocalTagName();
+ WideString wsNodeStr = pElement->GetLocalTagName();
if (wsNodeStr != wsLocalTagName)
return false;
@@ -90,9 +90,9 @@
return wsNodeStr == wsNamespaceURIPrefix;
}
-bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName,
- CFX_WideString& wsLocalAttrName) {
- CFX_WideString wsAttrName(wsAttributeName);
+bool GetAttributeLocalName(const WideStringView& wsAttributeName,
+ WideString& wsLocalAttrName) {
+ WideString wsAttrName(wsAttributeName);
auto pos = wsAttrName.Find(L':', 0);
if (!pos.has_value()) {
wsLocalAttrName = wsAttrName;
@@ -103,11 +103,11 @@
}
bool ResolveAttribute(CFX_XMLElement* pElement,
- const CFX_WideStringC& wsAttributeName,
- CFX_WideString& wsLocalAttrName,
- CFX_WideString& wsNamespaceURI) {
- CFX_WideString wsAttrName(wsAttributeName);
- CFX_WideString wsNSPrefix;
+ const WideStringView& wsAttributeName,
+ WideString& wsLocalAttrName,
+ WideString& wsNamespaceURI) {
+ WideString wsAttrName(wsAttributeName);
+ WideString wsNSPrefix;
if (GetAttributeLocalName(wsAttributeName, wsLocalAttrName)) {
wsNSPrefix = wsAttrName.Left(wsAttributeName.GetLength() -
wsLocalAttrName.GetLength() - 1);
@@ -117,7 +117,7 @@
return false;
}
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringC(), &wsNamespaceURI)) {
+ pElement, wsNSPrefix.AsStringView(), &wsNamespaceURI)) {
wsNamespaceURI.clear();
return false;
}
@@ -125,17 +125,17 @@
}
bool FindAttributeWithNS(CFX_XMLElement* pElement,
- const CFX_WideStringC& wsLocalAttributeName,
- const CFX_WideStringC& wsNamespaceURIPrefix,
- CFX_WideString& wsValue,
+ const WideStringView& wsLocalAttributeName,
+ const WideStringView& wsNamespaceURIPrefix,
+ WideString& wsValue,
bool bMatchNSAsPrefix = false) {
if (!pElement)
return false;
- CFX_WideString wsAttrNS;
+ WideString wsAttrNS;
for (auto it : pElement->GetAttributes()) {
auto pos = it.first.Find(L':', 0);
- CFX_WideString wsNSPrefix;
+ WideString wsNSPrefix;
if (!pos.has_value()) {
if (wsLocalAttributeName != it.first)
continue;
@@ -148,7 +148,7 @@
}
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringC(), &wsAttrNS)) {
+ pElement, wsNSPrefix.AsStringView(), &wsAttrNS)) {
continue;
}
if (bMatchNSAsPrefix) {
@@ -194,20 +194,19 @@
return nullptr;
}
-bool IsStringAllWhitespace(CFX_WideString wsText) {
+bool IsStringAllWhitespace(WideString wsText) {
wsText.TrimRight(L"\x20\x9\xD\xA");
return wsText.IsEmpty();
}
-void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode,
- CFX_WideString& wsOutput) {
+void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, WideString& wsOutput) {
for (CFX_XMLNode* pXMLChild =
pRootXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
switch (pXMLChild->GetType()) {
case FX_XMLNODE_Element: {
- CFX_WideString wsTextData =
+ WideString wsTextData =
static_cast<CFX_XMLElement*>(pXMLChild)->GetTextData();
wsTextData += L"\n";
wsOutput += wsTextData;
@@ -215,7 +214,7 @@
}
case FX_XMLNODE_Text:
case FX_XMLNODE_CharData: {
- CFX_WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
+ WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
if (IsStringAllWhitespace(wsText))
continue;
@@ -229,7 +228,7 @@
}
}
-const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) {
+const XFA_PACKETINFO* GetPacketByName(const WideStringView& wsName) {
if (wsName.IsEmpty())
return nullptr;
@@ -315,7 +314,7 @@
return XFA_PARSESTATUS_Done;
}
-CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML) {
+CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const ByteString& wsXML) {
CloseParser();
m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>();
@@ -353,9 +352,9 @@
return;
CFX_XMLElement* child = static_cast<CFX_XMLElement*>(pXMLChild);
- CFX_WideString wsNodeStr = child->GetLocalTagName();
+ WideString wsNodeStr = child->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
- CFX_WideString wsChildValue;
+ WideString wsChildValue;
XFA_GetPlainTextFromRichText(child, wsChildValue);
if (!wsChildValue.IsEmpty())
pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsChildValue);
@@ -388,13 +387,13 @@
bool XFA_FDEExtension_ResolveNamespaceQualifier(
CFX_XMLElement* pNode,
- const CFX_WideStringC& wsQualifier,
- CFX_WideString* wsNamespaceURI) {
+ const WideStringView& wsQualifier,
+ WideString* wsNamespaceURI) {
if (!pNode)
return false;
CFX_XMLNode* pFakeRoot = pNode->GetNodeItem(CFX_XMLNode::Root);
- CFX_WideString wsNSAttribute;
+ WideString wsNSAttribute;
bool bRet = false;
if (wsQualifier.IsEmpty()) {
wsNSAttribute = L"xmlns";
@@ -503,9 +502,9 @@
continue;
CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pChildItem);
- CFX_WideString wsPacketName = pElement->GetLocalTagName();
+ WideString wsPacketName = pElement->GetLocalTagName();
const XFA_PACKETINFO* pPacketInfo =
- GetPacketByName(wsPacketName.AsStringC());
+ GetPacketByName(wsPacketName.AsStringView());
if (pPacketInfo && pPacketInfo->pURI) {
if (!MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI,
pPacketInfo->eFlags)) {
@@ -612,7 +611,7 @@
if (m_bDocumentParser) {
CFX_XMLElement* pXMLDocumentElement =
static_cast<CFX_XMLElement*>(pXMLDocumentNode);
- CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI();
+ WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI();
if (wsNamespaceURI.IsEmpty())
wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa");
@@ -628,7 +627,7 @@
XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) {
CFX_XMLElement* pXMLDocumentElement =
static_cast<CFX_XMLElement*>(pXMLDocumentNode);
- CFX_WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum");
+ WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum");
if (wsChecksum.GetLength() != 28 ||
m_pXMLParser->m_dwCheckStatus != 0x03) {
return nullptr;
@@ -641,7 +640,7 @@
pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1],
m_pXMLParser->m_nSize[1]);
pChecksum->FinishChecksum();
- CFX_ByteString bsCheck = pChecksum->GetChecksum();
+ ByteString bsCheck = pChecksum->GetChecksum();
if (bsCheck != wsChecksum.UTF8Encode())
return nullptr;
@@ -651,7 +650,7 @@
pNode->SetCData(XFA_ATTRIBUTE_Name,
XFA_GetPacketByIndex(XFA_PACKET_Form)->pName);
- pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringC());
+ pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringView());
CXFA_Node* pTemplateRoot =
m_pRootNode->GetFirstChildByClass(XFA_Element::Template);
CXFA_Node* pTemplateChosen =
@@ -724,7 +723,7 @@
delete pDataXMLNode;
return nullptr;
}
- CFX_WideString wsLocalName =
+ WideString wsLocalName =
static_cast<CFX_XMLElement*>(pDataXMLNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName);
if (!DataLoader(pNode, pDataXMLNode, true))
@@ -821,7 +820,7 @@
if (!pNode)
return nullptr;
- CFX_WideString wsName =
+ WideString wsName =
static_cast<CFX_XMLElement*>(pXMLDocumentNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsName);
if (!UserPacketLoader(pNode, pXMLDocumentNode))
@@ -854,8 +853,8 @@
switch (pXMLChild->GetType()) {
case FX_XMLNODE_Element: {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
- CFX_WideString wsTagName = pXMLElement->GetLocalTagName();
- XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringC());
+ WideString wsTagName = pXMLElement->GetLocalTagName();
+ XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringView());
if (eType == XFA_Element::Unknown)
continue;
@@ -873,17 +872,17 @@
if (!pXFAChild)
return nullptr;
if (ePacketID == XFA_XDPPACKET_Config)
- pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringC());
+ pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringView());
bool IsNeedValue = true;
for (auto it : pXMLElement->GetAttributes()) {
- CFX_WideString wsAttrName;
- GetAttributeLocalName(it.first.AsStringC(), wsAttrName);
+ WideString wsAttrName;
+ GetAttributeLocalName(it.first.AsStringView(), wsAttrName);
if (wsAttrName == L"nil" && it.second == L"true")
IsNeedValue = false;
const XFA_ATTRIBUTEINFO* lpAttrInfo =
- XFA_GetAttributeByName(wsAttrName.AsStringC());
+ XFA_GetAttributeByName(wsAttrName.AsStringView());
if (!lpAttrInfo)
continue;
@@ -891,7 +890,7 @@
lpAttrInfo->eName != XFA_ATTRIBUTE_Save) {
continue;
}
- pXFAChild->SetAttribute(lpAttrInfo->eName, it.second.AsStringC());
+ pXFAChild->SetAttribute(lpAttrInfo->eName, it.second.AsStringView());
}
pXFANode->InsertChild(pXFAChild);
if (eType == XFA_Element::Validate || eType == XFA_Element::Locale) {
@@ -931,7 +930,7 @@
XFA_XDPPACKET ePacketID) {
XFA_Element element = XFA_Element::Sharptext;
if (pXFANode->GetElementType() == XFA_Element::ExData) {
- CFX_WideStringC wsContentType =
+ WideStringView wsContentType =
pXFANode->GetCData(XFA_ATTRIBUTE_ContentType);
if (wsContentType == L"text/html")
element = XFA_Element::SharpxHTML;
@@ -941,7 +940,7 @@
if (element == XFA_Element::SharpxHTML)
pXFANode->SetXMLMappingNode(pXMLNode);
- CFX_WideString wsValue;
+ WideString wsValue;
for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
@@ -992,8 +991,7 @@
case FX_XMLNODE_Element: {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
{
- CFX_WideString wsNamespaceURI =
- GetElementTagNamespaceURI(pXMLElement);
+ WideString wsNamespaceURI = GetElementTagNamespaceURI(pXMLElement);
if (wsNamespaceURI == L"http://www.xfa.com/schema/xfa-package/" ||
wsNamespaceURI == L"http://www.xfa.org/schema/xfa-package/" ||
wsNamespaceURI == L"http://www.w3.org/2001/XMLSchema-instance") {
@@ -1003,7 +1001,7 @@
XFA_Element eNodeType = XFA_Element::DataModel;
if (eNodeType == XFA_Element::DataModel) {
- CFX_WideString wsDataNodeAttr;
+ WideString wsDataNodeAttr;
if (FindAttributeWithNS(pXMLElement, L"dataNode",
L"http://www.xfa.org/schema/xfa-data/1.0/",
wsDataNodeAttr)) {
@@ -1013,7 +1011,7 @@
eNodeType = XFA_Element::DataValue;
}
}
- CFX_WideString wsContentType;
+ WideString wsContentType;
if (eNodeType == XFA_Element::DataModel) {
if (FindAttributeWithNS(pXMLElement, L"contentType",
L"http://www.xfa.org/schema/xfa-data/1.0/",
@@ -1048,9 +1046,9 @@
bool bNeedValue = true;
for (auto it : pXMLElement->GetAttributes()) {
- CFX_WideString wsName;
- CFX_WideString wsNS;
- if (!ResolveAttribute(pXMLElement, it.first.AsStringC(), wsName,
+ WideString wsName;
+ WideString wsNS;
+ if (!ResolveAttribute(pXMLElement, it.first.AsStringView(), wsName,
wsNS)) {
continue;
}
@@ -1080,7 +1078,7 @@
}
if (!bNeedValue) {
- CFX_WideString wsNilName(L"xsi:nil");
+ WideString wsNilName(L"xsi:nil");
pXMLElement->RemoveAttribute(wsNilName.c_str());
}
pXFANode->InsertChild(pXFAChild);
@@ -1096,7 +1094,7 @@
case FX_XMLNODE_CharData:
case FX_XMLNODE_Text: {
CFX_XMLText* pXMLText = static_cast<CFX_XMLText*>(pXMLChild);
- CFX_WideString wsText = pXMLText->GetText();
+ WideString wsText = pXMLText->GetText();
if (IsStringAllWhitespace(wsText))
continue;
@@ -1131,7 +1129,7 @@
if (eNodeType == FX_XMLNODE_Instruction)
continue;
- CFX_WideString wsText;
+ WideString wsText;
if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) {
wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
if (!pXMLCurValueNode)
@@ -1148,7 +1146,7 @@
} else {
bMarkAsCompound = true;
if (pXMLCurValueNode) {
- CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString();
+ WideString wsCurValue = wsCurValueTextBuf.MakeString();
if (!wsCurValue.IsEmpty()) {
CXFA_Node* pXFAChild =
m_pFactory->CreateNode(ePacketID, XFA_Element::DataValue);
@@ -1170,19 +1168,19 @@
if (!pXFAChild)
return;
- CFX_WideString wsNodeStr =
+ WideString wsNodeStr =
static_cast<CFX_XMLElement*>(pXMLChild)->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLChild);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
- CFX_WideStringC wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value);
+ WideStringView wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value);
wsValueTextBuf << wsCurValue;
}
}
if (pXMLCurValueNode) {
- CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString();
+ WideString wsCurValue = wsCurValueTextBuf.MakeString();
if (!wsCurValue.IsEmpty()) {
if (bMarkAsCompound) {
CXFA_Node* pXFAChild =
@@ -1201,7 +1199,7 @@
}
pXMLCurValueNode = nullptr;
}
- CFX_WideString wsNodeValue = wsValueTextBuf.MakeString();
+ WideString wsNodeValue = wsValueTextBuf.MakeString();
pXFANode->SetCData(XFA_ATTRIBUTE_Value, wsNodeValue);
}
@@ -1211,9 +1209,8 @@
if (!m_bDocumentParser)
return;
- CFX_WideString wsTargetName = pXMLInstruction->GetName();
- const std::vector<CFX_WideString>& target_data =
- pXMLInstruction->GetTargetData();
+ WideString wsTargetName = pXMLInstruction->GetName();
+ const std::vector<WideString>& target_data = pXMLInstruction->GetTargetData();
if (wsTargetName == L"originalXFAVersion") {
if (target_data.size() > 1 &&
(pXFANode->GetDocument()->RecognizeXFAVersionNumber(target_data[0]) !=
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h
index 705b6bd..91bfb05 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.h
+++ b/xfa/fxfa/parser/cxfa_simple_parser.h
@@ -28,7 +28,7 @@
int32_t StartParse(const CFX_RetainPtr<IFX_SeekableStream>& pStream,
XFA_XDPPACKET ePacketID);
int32_t DoParse();
- CFX_XMLNode* ParseXMLData(const CFX_ByteString& wsXML);
+ CFX_XMLNode* ParseXMLData(const ByteString& wsXML);
void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode);
CXFA_Node* GetRootNode() const;
CFX_XMLDoc* GetXMLDoc() const;
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
index e81c0ce..f131934 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -52,7 +52,7 @@
if (!pNode)
return 0xFF000000;
- CFX_WideStringC wsColor;
+ WideStringView wsColor;
pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor);
return CXFA_Data::ToColor(wsColor);
}
@@ -62,7 +62,7 @@
return;
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Color);
- CFX_WideString wsColor;
+ WideString wsColor;
int a;
int r;
int g;
diff --git a/xfa/fxfa/parser/cxfa_submit.cpp b/xfa/fxfa/parser/cxfa_submit.cpp
index e390e63..7fb04a3 100644
--- a/xfa/fxfa/parser/cxfa_submit.cpp
+++ b/xfa/fxfa/parser/cxfa_submit.cpp
@@ -18,10 +18,10 @@
return m_pNode->GetEnum(XFA_ATTRIBUTE_Format);
}
-void CXFA_Submit::GetSubmitTarget(CFX_WideStringC& wsTarget) {
+void CXFA_Submit::GetSubmitTarget(WideStringView& wsTarget) {
m_pNode->TryCData(XFA_ATTRIBUTE_Target, wsTarget);
}
-void CXFA_Submit::GetSubmitXDPContent(CFX_WideStringC& wsContent) {
+void CXFA_Submit::GetSubmitXDPContent(WideStringView& wsContent) {
m_pNode->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent);
}
diff --git a/xfa/fxfa/parser/cxfa_submit.h b/xfa/fxfa/parser/cxfa_submit.h
index f10435e..9d4d7fe 100644
--- a/xfa/fxfa/parser/cxfa_submit.h
+++ b/xfa/fxfa/parser/cxfa_submit.h
@@ -19,8 +19,8 @@
bool IsSubmitEmbedPDF();
int32_t GetSubmitFormat();
- void GetSubmitTarget(CFX_WideStringC& wsTarget);
- void GetSubmitXDPContent(CFX_WideStringC& wsContent);
+ void GetSubmitTarget(WideStringView& wsTarget);
+ void GetSubmitXDPContent(WideStringView& wsContent);
};
#endif // XFA_FXFA_PARSER_CXFA_SUBMIT_H_
diff --git a/xfa/fxfa/parser/cxfa_text.cpp b/xfa/fxfa/parser/cxfa_text.cpp
index 192a4de..cab11a6 100644
--- a/xfa/fxfa/parser/cxfa_text.cpp
+++ b/xfa/fxfa/parser/cxfa_text.cpp
@@ -10,6 +10,6 @@
CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-void CXFA_Text::GetContent(CFX_WideString& wsText) {
+void CXFA_Text::GetContent(WideString& wsText) {
m_pNode->TryContent(wsText);
}
diff --git a/xfa/fxfa/parser/cxfa_text.h b/xfa/fxfa/parser/cxfa_text.h
index ca41c0d..18b5628 100644
--- a/xfa/fxfa/parser/cxfa_text.h
+++ b/xfa/fxfa/parser/cxfa_text.h
@@ -16,7 +16,7 @@
public:
explicit CXFA_Text(CXFA_Node* pNode);
- void GetContent(CFX_WideString& wsText);
+ void GetContent(WideString& wsText);
};
#endif // XFA_FXFA_PARSER_CXFA_TEXT_H_
diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp
index 2938c1f..55e676e 100644
--- a/xfa/fxfa/parser/cxfa_thisproxy.cpp
+++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp
@@ -12,7 +12,7 @@
: CXFA_Object(pThisNode->GetDocument(),
XFA_ObjectType::VariablesThis,
XFA_Element::Unknown,
- CFX_WideStringC()),
+ WideStringView()),
m_pThisNode(nullptr),
m_pScriptNode(nullptr) {
m_pThisNode = pThisNode;
diff --git a/xfa/fxfa/parser/cxfa_tooltip.cpp b/xfa/fxfa/parser/cxfa_tooltip.cpp
index f3de7aa..9561ef2 100644
--- a/xfa/fxfa/parser/cxfa_tooltip.cpp
+++ b/xfa/fxfa/parser/cxfa_tooltip.cpp
@@ -10,6 +10,6 @@
CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-bool CXFA_ToolTip::GetTip(CFX_WideString& wsTip) {
+bool CXFA_ToolTip::GetTip(WideString& wsTip) {
return m_pNode->TryContent(wsTip);
}
diff --git a/xfa/fxfa/parser/cxfa_tooltip.h b/xfa/fxfa/parser/cxfa_tooltip.h
index 433885d..cc4bc31 100644
--- a/xfa/fxfa/parser/cxfa_tooltip.h
+++ b/xfa/fxfa/parser/cxfa_tooltip.h
@@ -16,7 +16,7 @@
public:
explicit CXFA_ToolTip(CXFA_Node* pNode);
- bool GetTip(CFX_WideString& wsTip);
+ bool GetTip(WideString& wsTip);
};
#endif // XFA_FXFA_PARSER_CXFA_TOOLTIP_H_
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 712d0f2..fc47274 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -16,10 +16,10 @@
}
bool CXFA_Validate::SetTestValue(int32_t iType,
- CFX_WideString& wsValue,
+ WideString& wsValue,
XFA_ATTRIBUTEENUM eName) {
const XFA_ATTRIBUTEENUMINFO* pInfo =
- XFA_GetAttributeEnumByName(wsValue.AsStringC());
+ XFA_GetAttributeEnumByName(wsValue.AsStringView());
if (pInfo)
eName = pInfo->eName;
@@ -27,7 +27,7 @@
return true;
}
-bool CXFA_Validate::SetNullTest(CFX_WideString wsValue) {
+bool CXFA_Validate::SetNullTest(WideString wsValue) {
return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue,
XFA_ATTRIBUTEENUM_Disabled);
}
@@ -40,8 +40,8 @@
return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest);
}
-void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage,
- const CFX_WideString& wsMessageType) {
+void CXFA_Validate::GetMessageText(WideString& wsMessage,
+ const WideString& wsMessageType) {
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, false);
if (!pNode)
return;
@@ -52,7 +52,7 @@
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
- CFX_WideStringC wsName;
+ WideStringView wsName;
pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
if (wsName.IsEmpty() || wsName == wsMessageType) {
pItemNode->TryContent(wsMessage);
@@ -61,24 +61,24 @@
}
}
-void CXFA_Validate::SetFormatMessageText(CFX_WideString wsMessage) {
+void CXFA_Validate::SetFormatMessageText(WideString wsMessage) {
SetMessageText(wsMessage, L"formatTest");
}
-void CXFA_Validate::GetFormatMessageText(CFX_WideString& wsMessage) {
+void CXFA_Validate::GetFormatMessageText(WideString& wsMessage) {
GetMessageText(wsMessage, L"formatTest");
}
-void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) {
+void CXFA_Validate::SetNullMessageText(WideString wsMessage) {
SetMessageText(wsMessage, L"nullTest");
}
-void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) {
+void CXFA_Validate::GetNullMessageText(WideString& wsMessage) {
GetMessageText(wsMessage, L"nullTest");
}
-void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage,
- const CFX_WideString& wsMessageType) {
+void CXFA_Validate::SetMessageText(WideString& wsMessage,
+ const WideString& wsMessageType) {
CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, true);
if (!pNode)
return;
@@ -89,7 +89,7 @@
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
- CFX_WideStringC wsName;
+ WideStringView wsName;
pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
if (wsName.IsEmpty() || wsName == wsMessageType) {
pItemNode->SetContent(wsMessage, wsMessage, false);
@@ -102,15 +102,15 @@
pTextNode->SetContent(wsMessage, wsMessage, false);
}
-void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) {
+void CXFA_Validate::GetScriptMessageText(WideString& wsMessage) {
GetMessageText(wsMessage, L"scriptTest");
}
-void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) {
+void CXFA_Validate::SetScriptMessageText(WideString wsMessage) {
SetMessageText(wsMessage, L"scriptTest");
}
-void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) {
+void CXFA_Validate::GetPicture(WideString& wsPicture) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture))
pNode->TryContent(wsPicture);
}
diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h
index 470cefe..ce4ba64 100644
--- a/xfa/fxfa/parser/cxfa_validate.h
+++ b/xfa/fxfa/parser/cxfa_validate.h
@@ -20,24 +20,22 @@
int32_t GetFormatTest();
int32_t GetNullTest();
- bool SetNullTest(CFX_WideString wsValue);
+ bool SetNullTest(WideString wsValue);
int32_t GetScriptTest();
- void GetFormatMessageText(CFX_WideString& wsMessage);
- void SetFormatMessageText(CFX_WideString wsMessage);
- void GetNullMessageText(CFX_WideString& wsMessage);
- void SetNullMessageText(CFX_WideString wsMessage);
- void GetScriptMessageText(CFX_WideString& wsMessage);
- void SetScriptMessageText(CFX_WideString wsMessage);
- void GetPicture(CFX_WideString& wsPicture);
+ void GetFormatMessageText(WideString& wsMessage);
+ void SetFormatMessageText(WideString wsMessage);
+ void GetNullMessageText(WideString& wsMessage);
+ void SetNullMessageText(WideString wsMessage);
+ void GetScriptMessageText(WideString& wsMessage);
+ void SetScriptMessageText(WideString wsMessage);
+ void GetPicture(WideString& wsPicture);
CXFA_Script GetScript();
private:
- void GetMessageText(CFX_WideString& wsMessage,
- const CFX_WideString& wsMessageType);
- void SetMessageText(CFX_WideString& wsMessage,
- const CFX_WideString& wsMessageType);
+ void GetMessageText(WideString& wsMessage, const WideString& wsMessageType);
+ void SetMessageText(WideString& wsMessage, const WideString& wsMessageType);
bool SetTestValue(int32_t iType,
- CFX_WideString& wsValue,
+ WideString& wsValue,
XFA_ATTRIBUTEENUM eName);
};
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index 4f166d5..abf55da 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -16,7 +16,7 @@
return XFA_Element::Unknown;
}
-bool CXFA_Value::GetChildValueContent(CFX_WideString& wsContent) {
+bool CXFA_Value::GetChildValueContent(WideString& wsContent) {
if (!m_pNode)
return false;
if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild))
diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h
index 225e187..52df169 100644
--- a/xfa/fxfa/parser/cxfa_value.h
+++ b/xfa/fxfa/parser/cxfa_value.h
@@ -23,7 +23,7 @@
explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {}
XFA_Element GetChildValueClassID();
- bool GetChildValueContent(CFX_WideString& wsContent);
+ bool GetChildValueContent(WideString& wsContent);
CXFA_Arc GetArc();
CXFA_Line GetLine();
CXFA_Rectangle GetRectangle();
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 80981d9..1879377 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -34,9 +34,9 @@
return fThickness;
}
-bool SplitDateTime(const CFX_WideString& wsDateTime,
- CFX_WideString& wsDate,
- CFX_WideString& wsTime) {
+bool SplitDateTime(const WideString& wsDateTime,
+ WideString& wsDate,
+ WideString& wsTime) {
wsDate = L"";
wsTime = L"";
if (wsDateTime.IsEmpty())
@@ -208,9 +208,9 @@
return XFA_ATTRIBUTEENUM_Unknown;
}
-CFX_WideStringC GetAttributeDefaultValue_Cdata(XFA_Element eElement,
- XFA_ATTRIBUTE eAttribute,
- uint32_t dwPacket) {
+WideStringView GetAttributeDefaultValue_Cdata(XFA_Element eElement,
+ XFA_ATTRIBUTE eAttribute,
+ uint32_t dwPacket) {
void* pValue;
if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
XFA_ATTRIBUTETYPE_Cdata, dwPacket)) {
@@ -251,7 +251,7 @@
return m_eUIType;
}
-CFX_WideString CXFA_WidgetData::GetRawValue() {
+WideString CXFA_WidgetData::GetRawValue() {
return m_pNode->GetContent();
}
@@ -309,13 +309,13 @@
CXFA_Event event(pNode);
if (event.GetActivity() == iActivity) {
if (iActivity == XFA_ATTRIBUTEENUM_Ready) {
- CFX_WideStringC wsRef;
+ WideStringView wsRef;
event.GetRef(wsRef);
if (bIsFormReady) {
- if (wsRef == CFX_WideStringC(L"$form"))
+ if (wsRef == WideStringView(L"$form"))
events.push_back(pNode);
} else {
- if (wsRef == CFX_WideStringC(L"$layout"))
+ if (wsRef == WideStringView(L"$layout"))
events.push_back(pNode);
}
} else {
@@ -430,12 +430,12 @@
XFA_Element::Button, XFA_ATTRIBUTE_Highlight, XFA_XDPPACKET_Form);
}
-bool CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover,
+bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover,
bool& bRichText) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pText) {
- CFX_WideStringC wsName;
+ WideStringView wsName;
pText->TryCData(XFA_ATTRIBUTE_Name, wsName);
if (wsName == L"rollover") {
pText->TryContent(wsRollover);
@@ -448,11 +448,11 @@
return false;
}
-bool CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown, bool& bRichText) {
+bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pText) {
- CFX_WideStringC wsName;
+ WideStringView wsName;
pText->TryCData(XFA_ATTRIBUTE_Name, wsName);
if (wsName == L"down") {
pText->TryContent(wsDown);
@@ -505,7 +505,7 @@
}
XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() {
- CFX_WideString wsValue = GetRawValue();
+ WideString wsValue = GetRawValue();
if (wsValue.IsEmpty())
return XFA_CHECKSTATE_Off;
@@ -513,7 +513,7 @@
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
int32_t i = 0;
while (pText) {
- CFX_WideString wsContent;
+ WideString wsContent;
if (pText->TryContent(wsContent) && (wsContent == wsValue))
return (XFA_CHECKSTATE)i;
@@ -527,7 +527,7 @@
void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) {
CXFA_WidgetData exclGroup(GetExclGroupNode());
if (exclGroup) {
- CFX_WideString wsValue;
+ WideString wsValue;
if (eCheckState != XFA_CHECKSTATE_Off) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -549,8 +549,8 @@
if (!pItemchild)
continue;
- CFX_WideString text = pItemchild->GetContent();
- CFX_WideString wsChildValue = text;
+ WideString text = pItemchild->GetContent();
+ WideString wsChildValue = text;
if (wsValue != text) {
pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
if (pItemchild)
@@ -569,7 +569,7 @@
int32_t i = -1;
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
- CFX_WideString wsContent;
+ WideString wsContent;
while (pText) {
i++;
if (i == eCheckState) {
@@ -591,7 +591,7 @@
CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
CXFA_Node* pSelectedMember = nullptr;
- CFX_WideString wsState = GetRawValue();
+ WideString wsState = GetRawValue();
if (wsState.IsEmpty())
return pSelectedMember;
@@ -606,7 +606,7 @@
return pSelectedMember;
}
-CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
+CXFA_Node* CXFA_WidgetData::SetSelectedMember(const WideStringView& wsName,
bool bNotify) {
uint32_t nameHash = FX_HashCode_GetW(wsName, false);
for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
@@ -620,11 +620,11 @@
return nullptr;
}
-void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
+void CXFA_WidgetData::SetSelectedMemberByValue(const WideStringView& wsValue,
bool bNotify,
bool bScriptModify,
bool bSyncData) {
- CFX_WideString wsExclGroup;
+ WideString wsExclGroup;
for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetElementType() != XFA_Element::Field)
@@ -638,7 +638,7 @@
if (!pItemchild)
continue;
- CFX_WideString wsChildValue = pItemchild->GetContent();
+ WideString wsChildValue = pItemchild->GetContent();
if (wsValue != wsChildValue) {
pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
if (pItemchild)
@@ -740,7 +740,7 @@
return pItem->CountChildren(XFA_Element::Unknown);
}
-bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
+bool CXFA_WidgetData::GetChoiceListItem(WideString& wsText,
int32_t nIndex,
bool bSaveValue) {
wsText.clear();
@@ -776,8 +776,7 @@
return false;
}
-std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems(
- bool bSaveValue) {
+std::vector<WideString> CXFA_WidgetData::GetChoiceListItems(bool bSaveValue) {
std::vector<CXFA_Node*> items;
for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pNode && items.size() < 2;
@@ -786,7 +785,7 @@
items.push_back(pNode);
}
if (items.empty())
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
CXFA_Node* pItem = items.front();
if (items.size() > 1) {
@@ -796,7 +795,7 @@
pItem = items[1];
}
- std::vector<CFX_WideString> wsTextArray;
+ std::vector<WideString> wsTextArray;
for (CXFA_Node* pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
wsTextArray.emplace_back();
@@ -806,12 +805,12 @@
}
int32_t CXFA_WidgetData::CountSelectedItems() {
- std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ std::vector<WideString> wsValueArray = GetSelectedItemsValue();
if (IsListBox() || !IsChoiceListAllowTextEntry())
return pdfium::CollectionSize<int32_t>(wsValueArray);
int32_t iSelected = 0;
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
for (const auto& value : wsValueArray) {
if (pdfium::ContainsValue(wsSaveTextArray, value))
iSelected++;
@@ -820,11 +819,11 @@
}
int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
- std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ std::vector<WideString> wsValueArray = GetSelectedItemsValue();
if (!pdfium::IndexInBounds(wsValueArray, nIndex))
return -1;
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(),
wsValueArray[nIndex]);
return it != wsSaveTextArray.end() ? it - wsSaveTextArray.begin() : -1;
@@ -832,8 +831,8 @@
std::vector<int32_t> CXFA_WidgetData::GetSelectedItems() {
std::vector<int32_t> iSelArray;
- std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ std::vector<WideString> wsValueArray = GetSelectedItemsValue();
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
for (const auto& value : wsValueArray) {
auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(), value);
if (it != wsSaveTextArray.end())
@@ -842,9 +841,9 @@
return iSelArray;
}
-std::vector<CFX_WideString> CXFA_WidgetData::GetSelectedItemsValue() {
- std::vector<CFX_WideString> wsSelTextArray;
- CFX_WideString wsValue = GetRawValue();
+std::vector<WideString> CXFA_WidgetData::GetSelectedItemsValue() {
+ std::vector<WideString> wsSelTextArray;
+ WideString wsValue = GetRawValue();
if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
if (!wsValue.IsEmpty()) {
FX_STRSIZE iStart = 0;
@@ -868,7 +867,7 @@
}
bool CXFA_WidgetData::GetItemState(int32_t nIndex) {
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
return pdfium::IndexInBounds(wsSaveTextArray, nIndex) &&
pdfium::ContainsValue(GetSelectedItemsValue(),
wsSaveTextArray[nIndex]);
@@ -879,12 +878,12 @@
bool bNotify,
bool bScriptModify,
bool bSyncData) {
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
if (!pdfium::IndexInBounds(wsSaveTextArray, nIndex))
return;
int32_t iSel = -1;
- std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ std::vector<WideString> wsValueArray = GetSelectedItemsValue();
auto it = std::find(wsValueArray.begin(), wsValueArray.end(),
wsSaveTextArray[nIndex]);
if (it != wsValueArray.end())
@@ -893,7 +892,7 @@
if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
if (bSelected) {
if (iSel < 0) {
- CFX_WideString wsValue = GetRawValue();
+ WideString wsValue = GetRawValue();
if (!wsValue.IsEmpty()) {
wsValue += L"\n";
}
@@ -911,15 +910,15 @@
} else {
if (bSelected) {
if (iSel < 0) {
- CFX_WideString wsSaveText = wsSaveTextArray[nIndex];
- CFX_WideString wsFormatText(wsSaveText);
+ WideString wsSaveText = wsSaveTextArray[nIndex];
+ WideString wsFormatText(wsSaveText);
GetFormatDataValue(wsSaveText, wsFormatText);
m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify,
bSyncData);
}
} else if (iSel >= 0) {
- m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify,
- bScriptModify, bSyncData);
+ m_pNode->SetContent(WideString(), WideString(), bNotify, bScriptModify,
+ bSyncData);
}
}
}
@@ -928,18 +927,18 @@
bool bNotify,
bool bScriptModify,
bool bSyncData) {
- CFX_WideString wsValue;
+ WideString wsValue;
int32_t iSize = pdfium::CollectionSize<int32_t>(iSelArray);
if (iSize >= 1) {
- std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
- CFX_WideString wsItemValue;
+ std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
+ WideString wsItemValue;
for (int32_t i = 0; i < iSize; i++) {
wsItemValue = (iSize == 1) ? wsSaveTextArray[iSelArray[i]]
: wsSaveTextArray[iSelArray[i]] + L"\n";
wsValue += wsItemValue;
}
}
- CFX_WideString wsFormat(wsValue);
+ WideString wsFormat(wsValue);
if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect)
GetFormatDataValue(wsValue, wsFormat);
@@ -949,7 +948,7 @@
void CXFA_WidgetData::ClearAllSelections() {
CXFA_Node* pBind = m_pNode->GetBindData();
if (!pBind || GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) {
- SyncValue(CFX_WideString(), false);
+ SyncValue(WideString(), false);
return;
}
@@ -957,11 +956,11 @@
pBind->RemoveChild(pChildNode);
}
-void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
- const CFX_WideString& wsValue,
+void CXFA_WidgetData::InsertItem(const WideString& wsLabel,
+ const WideString& wsValue,
bool bNotify) {
int32_t nIndex = -1;
- CFX_WideString wsNewValue(wsValue);
+ WideString wsNewValue(wsValue);
if (wsNewValue.IsEmpty())
wsNewValue = wsLabel;
@@ -999,7 +998,7 @@
CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
int32_t i = 0;
while (pListNode) {
- CFX_WideString wsOldValue;
+ WideString wsOldValue;
pListNode->TryContent(wsOldValue);
InsertListTextItem(pSaveItems, wsOldValue, i);
i++;
@@ -1015,8 +1014,8 @@
this, wsLabel.c_str(), wsValue.c_str(), nIndex);
}
-void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
- CFX_WideString& wsLabel) {
+void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue,
+ WideString& wsLabel) {
int32_t iCount = 0;
std::vector<CXFA_Node*> listitems;
CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -1040,7 +1039,7 @@
}
iCount = 0;
int32_t iSearch = -1;
- CFX_WideString wsContent;
+ WideString wsContent;
CXFA_Node* pChildItem = pSaveItems->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pChildItem;
pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) {
@@ -1060,8 +1059,8 @@
}
}
-void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel,
- CFX_WideString& wsValue) {
+void CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel,
+ WideString& wsValue) {
int32_t iCount = 0;
std::vector<CXFA_Node*> listitems;
for (CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -1085,7 +1084,7 @@
}
iCount = 0;
int32_t iSearch = -1;
- CFX_WideString wsContent;
+ WideString wsContent;
CXFA_Node* pChildItem = pLabelItems->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pChildItem;
pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) {
@@ -1154,15 +1153,15 @@
return -1;
}
-CFX_WideString CXFA_WidgetData::GetBarcodeType() {
+WideString CXFA_WidgetData::GetBarcodeType() {
CXFA_Node* pUIChild = GetUIChild();
- return pUIChild ? CFX_WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type))
- : CFX_WideString();
+ return pUIChild ? WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type))
+ : WideString();
}
bool CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideString wsCharEncoding;
+ WideString wsCharEncoding;
if (pUIChild->TryCData(XFA_ATTRIBUTE_CharEncoding, wsCharEncoding)) {
if (wsCharEncoding.CompareNoCase(L"UTF-16")) {
*val = CHAR_ENCODING_UNICODE;
@@ -1202,7 +1201,7 @@
bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideString wsDataLength;
+ WideString wsDataLength;
if (pUIChild->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) {
*val = FXSYS_wtoi(wsDataLength.c_str());
return true;
@@ -1212,7 +1211,7 @@
bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideStringC wsStartEndChar;
+ WideStringView wsStartEndChar;
if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) {
if (wsStartEndChar.GetLength()) {
*val = static_cast<char>(wsStartEndChar[0]);
@@ -1224,7 +1223,7 @@
bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideStringC wsStartEndChar;
+ WideStringView wsStartEndChar;
if (pUIChild->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) {
if (wsStartEndChar.GetLength()) {
*val = static_cast<char>(wsStartEndChar[0]);
@@ -1236,7 +1235,7 @@
bool CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideString wsECLevel;
+ WideString wsECLevel;
if (pUIChild->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, wsECLevel)) {
*val = FXSYS_wtoi(wsECLevel.c_str());
return true;
@@ -1313,7 +1312,7 @@
bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) {
CXFA_Node* pUIChild = GetUIChild();
- CFX_WideString wsWideNarrowRatio;
+ WideString wsWideNarrowRatio;
if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) {
auto ptPos = wsWideNarrowRatio.Find(':');
float fRatio = 0;
@@ -1335,7 +1334,7 @@
return false;
}
-void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) {
+void CXFA_WidgetData::GetPasswordChar(WideString& wsPassWord) {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild) {
pUIChild->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord);
@@ -1400,7 +1399,7 @@
return false;
}
-bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
+bool CXFA_WidgetData::SetValue(const WideString& wsValue,
XFA_VALUEPICTURE eValueType) {
if (wsValue.IsEmpty()) {
SyncValue(wsValue, true);
@@ -1408,8 +1407,8 @@
}
m_bPreNull = m_bIsNull;
m_bIsNull = false;
- CFX_WideString wsNewText(wsValue);
- CFX_WideString wsPicture;
+ WideString wsNewText(wsValue);
+ WideString wsPicture;
GetPictureContent(wsPicture, eValueType);
bool bValidate = true;
bool bSyncData = false;
@@ -1455,7 +1454,7 @@
return bValidate;
}
-bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
+bool CXFA_WidgetData::GetPictureContent(WideString& wsPicture,
XFA_VALUEPICTURE ePicture) {
if (ePicture == XFA_VALUEPICTURE_Raw)
return false;
@@ -1549,7 +1548,7 @@
if (!m_pNode)
return nullptr;
- CFX_WideString wsLocaleName;
+ WideString wsLocaleName;
if (!m_pNode->GetLocaleName(wsLocaleName))
return nullptr;
if (wsLocaleName == L"ambient")
@@ -1557,14 +1556,14 @@
return m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName);
}
-bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
+bool CXFA_WidgetData::GetValue(WideString& wsValue,
XFA_VALUEPICTURE eValueType) {
wsValue = m_pNode->GetContent();
if (eValueType == XFA_VALUEPICTURE_Display)
- GetItemLabel(wsValue.AsStringC(), wsValue);
+ GetItemLabel(wsValue.AsStringView(), wsValue);
- CFX_WideString wsPicture;
+ WideString wsPicture;
GetPictureContent(wsPicture, eValueType);
CXFA_Node* pNode = GetUIChild();
if (!pNode)
@@ -1584,7 +1583,7 @@
if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) {
IFX_Locale* pLocale = GetLocal();
if (eValueType == XFA_VALUEPICTURE_Display && pLocale) {
- CFX_WideString wsOutput;
+ WideString wsOutput;
NormalizeNumStr(wsValue, wsOutput);
FormatNumStr(wsOutput, pLocale, wsOutput);
wsValue = wsOutput;
@@ -1602,7 +1601,7 @@
CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr();
switch (widgetValue.GetType()) {
case XFA_VT_DATE: {
- CFX_WideString wsDate, wsTime;
+ WideString wsDate, wsTime;
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr);
if (date.FormatPatterns(wsValue, wsPicture, pLocale, eValueType))
@@ -1611,7 +1610,7 @@
break;
}
case XFA_VT_TIME: {
- CFX_WideString wsDate, wsTime;
+ WideString wsDate, wsTime;
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr);
if (time.FormatPatterns(wsValue, wsPicture, pLocale, eValueType))
@@ -1627,13 +1626,13 @@
return true;
}
-bool CXFA_WidgetData::GetNormalizeDataValue(const CFX_WideString& wsValue,
- CFX_WideString& wsNormalizeValue) {
+bool CXFA_WidgetData::GetNormalizeDataValue(const WideString& wsValue,
+ WideString& wsNormalizeValue) {
wsNormalizeValue = wsValue;
if (wsValue.IsEmpty())
return true;
- CFX_WideString wsPicture;
+ WideString wsPicture;
GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty())
return true;
@@ -1651,13 +1650,13 @@
return false;
}
-bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue,
- CFX_WideString& wsFormattedValue) {
+bool CXFA_WidgetData::GetFormatDataValue(const WideString& wsValue,
+ WideString& wsFormattedValue) {
wsFormattedValue = wsValue;
if (wsValue.IsEmpty())
return true;
- CFX_WideString wsPicture;
+ WideString wsPicture;
GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty())
return true;
@@ -1706,7 +1705,7 @@
CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr);
switch (widgetValue.GetType()) {
case XFA_VT_DATE: {
- CFX_WideString wsDate, wsTime;
+ WideString wsDate, wsTime;
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr);
if (date.FormatPatterns(wsFormattedValue, wsPicture, pLocale,
@@ -1717,7 +1716,7 @@
break;
}
case XFA_VT_TIME: {
- CFX_WideString wsDate, wsTime;
+ WideString wsDate, wsTime;
if (SplitDateTime(wsValue, wsDate, wsTime)) {
CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr);
if (time.FormatPatterns(wsFormattedValue, wsPicture, pLocale,
@@ -1736,8 +1735,8 @@
return false;
}
-void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue,
- CFX_WideString& wsOutput) {
+void CXFA_WidgetData::NormalizeNumStr(const WideString& wsValue,
+ WideString& wsOutput) {
if (wsValue.IsEmpty())
return;
@@ -1753,14 +1752,14 @@
wsOutput.InsertAtFront('0');
}
-void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
+void CXFA_WidgetData::FormatNumStr(const WideString& wsValue,
IFX_Locale* pLocale,
- CFX_WideString& wsOutput) {
+ WideString& wsOutput) {
if (wsValue.IsEmpty())
return;
- CFX_WideString wsSrcNum = wsValue;
- CFX_WideString wsGroupSymbol =
+ WideString wsSrcNum = wsValue;
+ WideString wsGroupSymbol =
pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
bool bNeg = false;
if (wsSrcNum[0] == '-') {
@@ -1791,11 +1790,11 @@
}
}
-void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, bool bNotify) {
+void CXFA_WidgetData::SyncValue(const WideString& wsValue, bool bNotify) {
if (!m_pNode)
return;
- CFX_WideString wsFormatValue(wsValue);
+ WideString wsFormatValue(wsValue);
CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData();
if (pContainerWidgetData)
pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
@@ -1804,20 +1803,20 @@
}
void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems,
- const CFX_WideString& wsText,
+ const WideString& wsText,
int32_t nIndex) {
CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_Element::Text);
pItems->InsertChild(nIndex, pText);
pText->SetContent(wsText, wsText, false, false, false);
}
-CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue,
- int32_t iLead,
- int32_t iTread) const {
+WideString CXFA_WidgetData::NumericLimit(const WideString& wsValue,
+ int32_t iLead,
+ int32_t iTread) const {
if ((iLead == -1) && (iTread == -1))
return wsValue;
- CFX_WideString wsRet;
+ WideString wsRet;
int32_t iLead_ = 0, iTread_ = -1;
int32_t iCount = wsValue.GetLength();
if (iCount == 0)
@@ -1839,7 +1838,7 @@
iTread_++;
if (iTread_ > iTread) {
if (iTread != -1) {
- CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsStringC());
+ CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsStringView());
wsDeci.SetScale(iTread);
wsRet = wsDeci;
}
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index f53d926..69f8d0d 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -45,7 +45,7 @@
CXFA_Node* GetUIChild();
XFA_Element GetUIType();
- CFX_WideString GetRawValue();
+ WideString GetRawValue();
int32_t GetAccess();
int32_t GetRotate();
@@ -73,8 +73,8 @@
CXFA_Border GetUIBorder();
CFX_RectF GetUIMargin();
int32_t GetButtonHighlight();
- bool GetButtonRollover(CFX_WideString& wsRollover, bool& bRichText);
- bool GetButtonDown(CFX_WideString& wsDown, bool& bRichText);
+ bool GetButtonRollover(WideString& wsRollover, bool& bRichText);
+ bool GetButtonDown(WideString& wsDown, bool& bRichText);
int32_t GetCheckButtonShape();
int32_t GetCheckButtonMark();
float GetCheckButtonSize();
@@ -84,8 +84,8 @@
void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify);
CXFA_Node* GetExclGroupNode();
CXFA_Node* GetSelectedMember();
- CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName, bool bNotify);
- void SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
+ CXFA_Node* SetSelectedMember(const WideStringView& wsName, bool bNotify);
+ void SetSelectedMemberByValue(const WideStringView& wsValue,
bool bNotify,
bool bScriptModify,
bool bSyncData);
@@ -96,14 +96,12 @@
int32_t GetChoiceListOpen();
bool IsListBox();
int32_t CountChoiceListItems(bool bSaveValue);
- bool GetChoiceListItem(CFX_WideString& wsText,
- int32_t nIndex,
- bool bSaveValue);
- std::vector<CFX_WideString> GetChoiceListItems(bool bSaveValue);
+ bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue);
+ std::vector<WideString> GetChoiceListItems(bool bSaveValue);
int32_t CountSelectedItems();
int32_t GetSelectedItem(int32_t nIndex);
std::vector<int32_t> GetSelectedItems();
- std::vector<CFX_WideString> GetSelectedItemsValue();
+ std::vector<WideString> GetSelectedItemsValue();
bool GetItemState(int32_t nIndex);
void SetItemState(int32_t nIndex,
bool bSelected,
@@ -115,25 +113,25 @@
bool bScriptModify,
bool bSyncData);
void ClearAllSelections();
- void InsertItem(const CFX_WideString& wsLabel,
- const CFX_WideString& wsValue,
+ void InsertItem(const WideString& wsLabel,
+ const WideString& wsValue,
bool bNotify);
- void GetItemLabel(const CFX_WideStringC& wsValue, CFX_WideString& wsLabel);
- void GetItemValue(const CFX_WideStringC& wsLabel, CFX_WideString& wsValue);
+ void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel);
+ void GetItemValue(const WideStringView& wsLabel, WideString& wsValue);
bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify);
int32_t GetHorizontalScrollPolicy();
int32_t GetNumberOfCells();
- bool SetValue(const CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
- bool GetPictureContent(CFX_WideString& wsPicture, XFA_VALUEPICTURE ePicture);
+ bool SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType);
+ bool GetPictureContent(WideString& wsPicture, XFA_VALUEPICTURE ePicture);
IFX_Locale* GetLocal();
- bool GetValue(CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
- bool GetNormalizeDataValue(const CFX_WideString& wsValue,
- CFX_WideString& wsNormalizeValue);
- bool GetFormatDataValue(const CFX_WideString& wsValue,
- CFX_WideString& wsFormattedValue);
- void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput);
+ bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType);
+ bool GetNormalizeDataValue(const WideString& wsValue,
+ WideString& wsNormalizeValue);
+ bool GetFormatDataValue(const WideString& wsValue,
+ WideString& wsFormattedValue);
+ void NormalizeNumStr(const WideString& wsValue, WideString& wsOutput);
- CFX_WideString GetBarcodeType();
+ WideString GetBarcodeType();
bool GetBarcodeAttribute_CharEncoding(int32_t* val);
bool GetBarcodeAttribute_Checksum(bool* val);
bool GetBarcodeAttribute_DataLength(int32_t* val);
@@ -146,7 +144,7 @@
bool GetBarcodeAttribute_TextLocation(int32_t* val);
bool GetBarcodeAttribute_Truncate(bool* val);
bool GetBarcodeAttribute_WideNarrowRatio(float* val);
- void GetPasswordChar(CFX_WideString& wsPassWord);
+ void GetPasswordChar(WideString& wsPassWord);
bool IsMultiLine();
int32_t GetVerticalScrollPolicy();
@@ -154,22 +152,22 @@
bool GetFracDigits(int32_t& iFracDigits);
bool GetLeadDigits(int32_t& iLeadDigits);
- CFX_WideString NumericLimit(const CFX_WideString& wsValue,
- int32_t iLead,
- int32_t iTread) const;
+ WideString NumericLimit(const WideString& wsValue,
+ int32_t iLead,
+ int32_t iTread) const;
bool m_bIsNull;
bool m_bPreNull;
private:
CXFA_Bind GetBind();
- void SyncValue(const CFX_WideString& wsValue, bool bNotify);
+ void SyncValue(const WideString& wsValue, bool bNotify);
void InsertListTextItem(CXFA_Node* pItems,
- const CFX_WideString& wsText,
+ const WideString& wsText,
int32_t nIndex);
- void FormatNumStr(const CFX_WideString& wsValue,
+ void FormatNumStr(const WideString& wsValue,
IFX_Locale* pLocale,
- CFX_WideString& wsOutput);
+ WideString& wsOutput);
CXFA_Node* m_pUiChildNode;
XFA_Element m_eUIType;
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 4055c15..f9e4353 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -21,14 +21,13 @@
CXFA_XMLLocale::~CXFA_XMLLocale() {}
-CFX_WideString CXFA_XMLLocale::GetName() const {
- return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString();
+WideString CXFA_XMLLocale::GetName() const {
+ return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : WideString();
}
-CFX_WideString CXFA_XMLLocale::GetNumbericSymbol(
- FX_LOCALENUMSYMBOL eType) const {
- CFX_ByteString bsSymbols;
- CFX_WideString wsName;
+WideString CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const {
+ ByteString bsSymbols;
+ WideString wsName;
switch (eType) {
case FX_LOCALENUMSYMBOL_Decimal:
bsSymbols = "numberSymbols";
@@ -59,43 +58,43 @@
wsName = L"isoname";
break;
default:
- return CFX_WideString();
+ return WideString();
}
CXML_Element* pElement =
- m_pLocaleData->GetElement("", bsSymbols.AsStringC(), 0);
+ m_pLocaleData->GetElement("", bsSymbols.AsStringView(), 0);
if (!pElement)
- return CFX_WideString();
+ return WideString();
return GetPattern(
- pElement, CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
- wsName.AsStringC());
+ pElement, ByteStringView(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
+ wsName.AsStringView());
}
-CFX_WideString CXFA_XMLLocale::GetDateTimeSymbols() const {
+WideString CXFA_XMLLocale::GetDateTimeSymbols() const {
if (!m_pLocaleData)
- return CFX_WideString();
+ return WideString();
CXML_Element* pNumberSymbols =
m_pLocaleData->GetElement("", "dateTimeSymbols", 0);
if (!pNumberSymbols)
- return CFX_WideString();
+ return WideString();
CXML_Content* pContent = ToContent(pNumberSymbols->GetChild(0));
if (!pContent)
- return CFX_WideString();
+ return WideString();
return pContent->m_Content;
}
-CFX_WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
+WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
return GetCalendarSymbol("month", nMonth, bAbbr);
}
-CFX_WideString CXFA_XMLLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
+WideString CXFA_XMLLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
return GetCalendarSymbol("day", nWeek, bAbbr);
}
-CFX_WideString CXFA_XMLLocale::GetMeridiemName(bool bAM) const {
+WideString CXFA_XMLLocale::GetMeridiemName(bool bAM) const {
return GetCalendarSymbol("meridiem", bAM ? 0 : 1, false);
}
@@ -103,47 +102,47 @@
return CXFA_TimeZoneProvider().GetTimeZone();
}
-CFX_WideString CXFA_XMLLocale::GetEraName(bool bAD) const {
+WideString CXFA_XMLLocale::GetEraName(bool bAD) const {
return GetCalendarSymbol("era", bAD ? 1 : 0, false);
}
-CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
- int index,
- bool bAbbr) const {
+WideString CXFA_XMLLocale::GetCalendarSymbol(const ByteStringView& symbol,
+ int index,
+ bool bAbbr) const {
if (!m_pLocaleData)
- return CFX_WideString();
+ return WideString();
CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols", 0);
if (!pChild)
- return CFX_WideString();
+ return WideString();
- CFX_ByteString pstrSymbolNames = symbol + "Names";
+ ByteString pstrSymbolNames = symbol + "Names";
CXML_Element* pSymbolNames =
- pChild->GetElement("", pstrSymbolNames.AsStringC(), 0);
+ pChild->GetElement("", pstrSymbolNames.AsStringView(), 0);
if (!pSymbolNames)
- return CFX_WideString();
+ return WideString();
if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr)
- pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
+ pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringView(), 1);
if (!pSymbolNames || (!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr)
- return CFX_WideString();
+ return WideString();
CXML_Element* pSymbolName = pSymbolNames->GetElement("", symbol, index);
if (!pSymbolName)
- return CFX_WideString();
+ return WideString();
CXML_Content* pContent = ToContent(pSymbolName->GetChild(0));
- return pContent ? pContent->m_Content : CFX_WideString();
+ return pContent ? pContent->m_Content : WideString();
}
-CFX_WideString CXFA_XMLLocale::GetDatePattern(
+WideString CXFA_XMLLocale::GetDatePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const {
CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns", 0);
if (!pElement)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wsName;
+ WideString wsName;
switch (eType) {
case FX_LOCALEDATETIMESUBCATEGORY_Short:
wsName = L"short";
@@ -159,16 +158,16 @@
wsName = L"long";
break;
}
- return GetPattern(pElement, "datePattern", wsName.AsStringC());
+ return GetPattern(pElement, "datePattern", wsName.AsStringView());
}
-CFX_WideString CXFA_XMLLocale::GetTimePattern(
+WideString CXFA_XMLLocale::GetTimePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const {
CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns", 0);
if (!pElement)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wsName;
+ WideString wsName;
switch (eType) {
case FX_LOCALEDATETIMESUBCATEGORY_Short:
wsName = L"short";
@@ -184,26 +183,25 @@
wsName = L"long";
break;
}
- return GetPattern(pElement, "timePattern", wsName.AsStringC());
+ return GetPattern(pElement, "timePattern", wsName.AsStringView());
}
-CFX_WideString CXFA_XMLLocale::GetNumPattern(
- FX_LOCALENUMSUBCATEGORY eType) const {
+WideString CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const {
return m_pLocaleData->GetElement("", "numberPatterns", 0)
? XFA_PatternToString(eType)
- : CFX_WideString();
+ : WideString();
}
-CFX_WideString CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName) const {
+WideString CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
+ const ByteStringView& bsTag,
+ const WideStringView& wsName) const {
int32_t iCount = pElement->CountElements("", bsTag);
for (int32_t i = 0; i < iCount; i++) {
CXML_Element* pChild = pElement->GetElement("", bsTag, i);
if (pChild->GetAttrValue("name") == wsName) {
CXML_Content* pContent = ToContent(pChild->GetChild(0));
- return pContent ? pContent->m_Content : CFX_WideString();
+ return pContent ? pContent->m_Content : WideString();
}
}
- return CFX_WideString();
+ return WideString();
}
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h
index a583856..5050855 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.h
+++ b/xfa/fxfa/parser/cxfa_xmllocale.h
@@ -19,29 +19,27 @@
~CXFA_XMLLocale() override;
// IFX_Locale
- CFX_WideString GetName() const override;
- CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
+ WideString GetName() const override;
+ WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
- CFX_WideString GetDateTimeSymbols() const override;
- CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
- CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
- CFX_WideString GetMeridiemName(bool bAM) const override;
+ WideString GetDateTimeSymbols() const override;
+ WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
+ WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
+ WideString GetMeridiemName(bool bAM) const override;
FX_TIMEZONE GetTimeZone() const override;
- CFX_WideString GetEraName(bool bAD) const override;
+ WideString GetEraName(bool bAD) const override;
- CFX_WideString GetDatePattern(
- FX_LOCALEDATETIMESUBCATEGORY eType) const override;
- CFX_WideString GetTimePattern(
- FX_LOCALEDATETIMESUBCATEGORY eType) const override;
- CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
+ WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
private:
- CFX_WideString GetPattern(CXML_Element* pElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName) const;
- CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol,
- int index,
- bool bAbbr) const;
+ WideString GetPattern(CXML_Element* pElement,
+ const ByteStringView& bsTag,
+ const WideStringView& wsName) const;
+ WideString GetCalendarSymbol(const ByteStringView& symbol,
+ int index,
+ bool bAbbr) const;
std::unique_ptr<CXML_Element> m_pLocaleData;
};
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index d4cd058..373412e 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -73,7 +73,7 @@
}
bool FormValueNode_SetChildContent(CXFA_Node* pValueNode,
- const CFX_WideString& wsContent,
+ const WideString& wsContent,
XFA_Element iType = XFA_Element::Unknown) {
if (!pValueNode)
return false;
@@ -90,7 +90,7 @@
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (pChildNode->GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
+ WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType,
false);
if (wsContentType == L"text/html")
@@ -131,13 +131,13 @@
XFA_Element eUIType = pWidgetData->GetUIType();
CXFA_Value defValue(pFormNode->GetProperty(0, XFA_Element::Value));
if (!bDataToForm) {
- CFX_WideString wsValue;
- CFX_WideString wsFormattedValue;
+ WideString wsValue;
+ WideString wsFormattedValue;
switch (eUIType) {
case XFA_Element::ImageEdit: {
CXFA_Image image = defValue.GetImage();
- CFX_WideString wsContentType;
- CFX_WideString wsHref;
+ WideString wsContentType;
+ WideString wsHref;
if (image) {
image.GetContent(wsValue);
image.GetContentType(wsContentType);
@@ -157,7 +157,7 @@
case XFA_Element::ChoiceList:
defValue.GetChildValueContent(wsValue);
if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
- std::vector<CFX_WideString> wsSelTextArray =
+ std::vector<WideString> wsSelTextArray =
pWidgetData->GetSelectedItemsValue();
if (!wsSelTextArray.empty()) {
for (const auto& text : wsSelTextArray) {
@@ -211,7 +211,7 @@
if (!pText)
continue;
- CFX_WideString wsContent;
+ WideString wsContent;
if (pText->TryContent(wsContent) && (wsContent == wsValue)) {
pChecked = pChild;
wsFormattedValue = wsValue;
@@ -237,7 +237,7 @@
if (pText)
pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling);
- CFX_WideString wsContent;
+ WideString wsContent;
if (pText)
pText->TryContent(wsContent);
@@ -250,7 +250,7 @@
if (wsValue.IsEmpty())
break;
- CFX_WideString wsOutput;
+ WideString wsOutput;
pWidgetData->NormalizeNumStr(wsValue, wsOutput);
wsValue = wsOutput;
pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
@@ -271,9 +271,9 @@
return;
}
- CFX_WideString wsXMLValue;
+ WideString wsXMLValue;
pDataNode->TryContent(wsXMLValue);
- CFX_WideString wsNormalizeValue;
+ WideString wsNormalizeValue;
pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormalizeValue);
pDataNode->SetAttributeValue(wsNormalizeValue, wsXMLValue);
switch (eUIType) {
@@ -286,14 +286,14 @@
static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
- CFX_WideString wsContentType =
+ WideString wsContentType =
pXMLDataElement->GetString(L"xfa:contentType");
if (!wsContentType.IsEmpty()) {
pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
image.SetContentType(wsContentType);
}
- CFX_WideString wsHref = pXMLDataElement->GetString(L"href");
+ WideString wsHref = pXMLDataElement->GetString(L"href");
if (!wsHref.IsEmpty())
image.SetHref(wsHref);
}
@@ -305,7 +305,7 @@
if (!items.empty()) {
bool single = items.size() == 1;
wsNormalizeValue.clear();
- CFX_WideString wsItem;
+ WideString wsItem;
for (CXFA_Node* pNode : items) {
pNode->TryContent(wsItem);
wsItem = single ? wsItem : wsItem + L"\n";
@@ -327,8 +327,8 @@
XFA_Element::Text);
break;
case XFA_Element::ExclGroup: {
- pWidgetData->SetSelectedMemberByValue(wsNormalizeValue.AsStringC(), false,
- false, false);
+ pWidgetData->SetSelectedMemberByValue(wsNormalizeValue.AsStringView(),
+ false, false, false);
break;
}
case XFA_Element::DateTimeEdit:
@@ -336,10 +336,10 @@
XFA_Element::DateTime);
break;
case XFA_Element::NumericEdit: {
- CFX_WideString wsPicture;
+ WideString wsPicture;
pWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty()) {
- CFX_WideString wsOutput;
+ WideString wsOutput;
pWidgetData->NormalizeNumStr(wsNormalizeValue, wsOutput);
wsNormalizeValue = wsOutput;
}
@@ -407,7 +407,7 @@
}
CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
- CFX_WideStringC wsName,
+ WideStringView wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
@@ -425,7 +425,7 @@
}
CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
- CFX_WideStringC wsName,
+ WideStringView wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
@@ -452,7 +452,7 @@
}
CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
- CFX_WideStringC wsRef,
+ WideStringView wsRef,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType,
CXFA_Node* pTemplateNode,
@@ -496,10 +496,10 @@
CXFA_Node* pFormParent,
CXFA_Node* pTemplateNode,
std::vector<CXFA_Node*>* subforms) {
- CFX_WideStringC wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideString wsInstMgrNodeName = L"_" + wsSubformName;
+ WideStringView wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideString wsInstMgrNodeName = L"_" + wsSubformName;
uint32_t dwInstNameHash =
- FX_HashCode_GetW(wsInstMgrNodeName.AsStringC(), false);
+ FX_HashCode_GetW(wsInstMgrNodeName.AsStringView(), false);
CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance(
pDocument, XFA_Element::InstanceManager, dwInstNameHash, pFormParent);
if (pExistingNode) {
@@ -1000,7 +1000,7 @@
CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
CXFA_Node* pDataParent,
XFA_Element eNodeType,
- const CFX_WideString& wsName) {
+ const WideString& wsName) {
if (!pDataParent)
return nullptr;
@@ -1023,13 +1023,14 @@
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- CFX_WideString wsNamespace;
+ WideString wsNamespace;
if (!pDDGroupNode->TryNamespace(wsNamespace) ||
wsNamespace != L"http://ns.adobe.com/data-description/") {
continue;
}
}
- CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(wsName.AsStringC());
+ CXFA_Node* pDDNode =
+ pDDGroupNode->GetFirstChildByName(wsName.AsStringView());
if (!pDDNode)
continue;
if (pDDNode->GetElementType() != eNodeType)
@@ -1086,7 +1087,7 @@
: XFA_Element::DataValue;
pDataNode = MaybeCreateDataNode(
pDocument, pDataScope, eDataNodeType,
- CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name)));
+ WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name)));
if (pDataNode)
CreateDataBinding(pFormNode, pDataNode, false);
}
@@ -1118,7 +1119,7 @@
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record));
pDataNode = MaybeCreateDataNode(
pDocument, pRecordNode, eDataNodeType,
- CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name)));
+ WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name)));
if (pDataNode) {
CreateDataBinding(pFormNode, pDataNode, false);
RegisterGlobalBinding(pDocument, pFormNode->GetNameHash(),
@@ -1136,8 +1137,7 @@
bMatchRef = bDataRef;
bParentDataRef = true;
if (!pDataNode && bDataRef) {
- CFX_WideStringC wsRef =
- pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref);
+ WideStringView wsRef = pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref);
uint32_t dFlags =
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode;
XFA_RESOLVENODE_RS rs;
@@ -1197,7 +1197,7 @@
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- CFX_WideString wsNamespace;
+ WideString wsNamespace;
if (!pDDGroupNode->TryNamespace(wsNamespace) ||
wsNamespace != L"http://ns.adobe.com/data-description/") {
continue;
@@ -1363,7 +1363,7 @@
pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode);
}
CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr;
- CFX_WideString wsDatasetsURI;
+ WideString wsDatasetsURI;
pDatasetsRoot->TryNamespace(wsDatasetsURI);
for (CXFA_Node* pChildNode =
pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -1372,7 +1372,7 @@
if (pChildNode->GetElementType() != XFA_Element::DataGroup)
continue;
- CFX_WideString wsNamespaceURI;
+ WideString wsNamespaceURI;
if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) {
if (!pChildNode->TryNamespace(wsNamespaceURI))
continue;
@@ -1435,9 +1435,8 @@
this, pFormRoot, pTemplateChosen, false, nullptr);
ASSERT(pSubformSetNode);
if (!pDataTopLevel) {
- CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name);
- CFX_WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form"
- : wsFormName);
+ WideStringView wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name);
+ WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName);
CFX_XMLElement* pDataTopLevelXMLNode =
new CFX_XMLElement(wsDataTopLevelName);
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index fa75f18..e1ee29d 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -39,8 +39,8 @@
0.000000000000001,
0.0000000000000001};
-double WideStringToDouble(const CFX_WideString& wsStringVal) {
- CFX_WideString wsValue = wsStringVal;
+double WideStringToDouble(const WideString& wsStringVal) {
+ WideString wsValue = wsStringVal;
wsValue.TrimLeft();
wsValue.TrimRight();
int64_t nIntegral = 0;
@@ -172,15 +172,15 @@
pWidgetData->GetNode()->GetDocument()->GetLocalMgr());
}
void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode,
- CFX_WideString& wsPlainText) {
+ WideString& wsPlainText) {
if (!pXMLNode) {
return;
}
switch (pXMLNode->GetType()) {
case FX_XMLNODE_Element: {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
- CFX_WideString wsTag = pXMLElement->GetLocalTagName();
- uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true);
+ WideString wsTag = pXMLElement->GetLocalTagName();
+ uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringView(), true);
if (uTag == 0x0001f714) {
wsPlainText += L"\n";
} else if (uTag == 0x00000070) {
@@ -197,7 +197,7 @@
}
case FX_XMLNODE_Text:
case FX_XMLNODE_CharData: {
- CFX_WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText();
+ WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText();
wsPlainText += wsContent;
break;
}
@@ -228,8 +228,8 @@
return bRet;
}
-double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) {
- CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal);
+double XFA_ByteStringToDouble(const ByteStringView& szStringVal) {
+ WideString wsValue = WideString::FromUTF8(szStringVal);
return WideStringToDouble(wsValue);
}
@@ -241,7 +241,7 @@
const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
XFA_Element eElement,
- const CFX_WideStringC& wsAttributeName) {
+ const WideStringView& wsAttributeName) {
if (wsAttributeName.IsEmpty())
return nullptr;
@@ -376,7 +376,7 @@
: nullptr;
}
-XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) {
+XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName) {
if (wsName.IsEmpty())
return XFA_Element::Unknown;
@@ -428,7 +428,7 @@
return false;
}
-const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) {
+const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName) {
if (wsName.IsEmpty())
return nullptr;
@@ -449,7 +449,7 @@
}
const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
if (wsName.IsEmpty())
return nullptr;
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index bc05381..404586b 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -21,8 +21,8 @@
bool XFA_FDEExtension_ResolveNamespaceQualifier(
CFX_XMLElement* pNode,
- const CFX_WideStringC& wsQualifier,
- CFX_WideString* wsNamespaceURI);
+ const WideStringView& wsQualifier,
+ WideString* wsNamespaceURI);
template <class NodeType, class TraverseStrategy>
class CXFA_NodeIteratorTemplate {
@@ -144,12 +144,12 @@
};
CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
-double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
+double XFA_ByteStringToDouble(const ByteStringView& szStringVal);
int32_t XFA_MapRotation(int32_t nRotation);
bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode);
void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode,
- CFX_WideString& wsPlainText);
+ WideString& wsPlainText);
bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);
void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
@@ -166,7 +166,7 @@
const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
XFA_Element eElement,
- const CFX_WideStringC& wsAttributeName);
+ const WideStringView& wsAttributeName);
const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement,
XFA_Element eProperty,
@@ -175,7 +175,7 @@
int32_t& iCount);
const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount);
const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName);
-XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName);
+XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName);
CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
XFA_ATTRIBUTE eAttribute,
uint32_t dwPacket);
@@ -184,10 +184,10 @@
XFA_ATTRIBUTE eAttribute,
XFA_ATTRIBUTETYPE eType,
uint32_t dwPacket);
-const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName);
+const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName);
const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName);
const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(
- const CFX_WideStringC& wsName);
+ const WideStringView& wsName);
const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket);
const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket);