From 275e260a6cd4a8e506ba974feb85ebcd926c1739 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 18 Sep 2017 14:23:18 -0400 Subject: 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 Commit-Queue: Ryan Harrison --- xfa/fxfa/parser/cscript_datawindow.cpp | 2 +- xfa/fxfa/parser/cscript_eventpseudomodel.cpp | 8 +- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 78 ++-- xfa/fxfa/parser/cscript_hostpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 20 +- xfa/fxfa/parser/cscript_layoutpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_logpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 2 +- xfa/fxfa/parser/cxfa_bind.cpp | 2 +- xfa/fxfa/parser/cxfa_bind.h | 2 +- xfa/fxfa/parser/cxfa_binditems.cpp | 8 +- xfa/fxfa/parser/cxfa_binditems.h | 8 +- xfa/fxfa/parser/cxfa_calculate.cpp | 2 +- xfa/fxfa/parser/cxfa_calculate.h | 2 +- xfa/fxfa/parser/cxfa_data.cpp | 2 +- xfa/fxfa/parser/cxfa_data.h | 2 +- xfa/fxfa/parser/cxfa_dataexporter.cpp | 72 ++-- xfa/fxfa/parser/cxfa_document.cpp | 42 +- xfa/fxfa/parser/cxfa_document.h | 4 +- xfa/fxfa/parser/cxfa_event.cpp | 6 +- xfa/fxfa/parser/cxfa_event.h | 4 +- xfa/fxfa/parser/cxfa_exdata.cpp | 2 +- xfa/fxfa/parser/cxfa_exdata.h | 2 +- xfa/fxfa/parser/cxfa_fill.cpp | 12 +- xfa/fxfa/parser/cxfa_font.cpp | 8 +- xfa/fxfa/parser/cxfa_font.h | 2 +- xfa/fxfa/parser/cxfa_image.cpp | 12 +- xfa/fxfa/parser/cxfa_image.h | 10 +- xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 14 +- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 42 +- xfa/fxfa/parser/cxfa_localemgr.cpp | 11 +- xfa/fxfa/parser/cxfa_localemgr.h | 8 +- xfa/fxfa/parser/cxfa_localevalue.cpp | 80 ++-- xfa/fxfa/parser/cxfa_localevalue.h | 43 +- xfa/fxfa/parser/cxfa_measurement.cpp | 8 +- xfa/fxfa/parser/cxfa_measurement.h | 8 +- xfa/fxfa/parser/cxfa_node.cpp | 490 +++++++++++------------ xfa/fxfa/parser/cxfa_node.h | 70 ++-- xfa/fxfa/parser/cxfa_nodehelper.cpp | 20 +- xfa/fxfa/parser/cxfa_nodehelper.h | 8 +- xfa/fxfa/parser/cxfa_nodelist.cpp | 8 +- xfa/fxfa/parser/cxfa_nodelist.h | 2 +- xfa/fxfa/parser/cxfa_nodelocale.cpp | 61 ++- xfa/fxfa/parser/cxfa_nodelocale.h | 36 +- xfa/fxfa/parser/cxfa_object.cpp | 10 +- xfa/fxfa/parser/cxfa_object.h | 8 +- xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 64 +-- xfa/fxfa/parser/cxfa_resolveprocessor.h | 18 +- xfa/fxfa/parser/cxfa_script.cpp | 4 +- xfa/fxfa/parser/cxfa_script.h | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 89 ++-- xfa/fxfa/parser/cxfa_scriptcontext.h | 26 +- xfa/fxfa/parser/cxfa_simple_parser.cpp | 137 ++++--- xfa/fxfa/parser/cxfa_simple_parser.h | 2 +- xfa/fxfa/parser/cxfa_stroke.cpp | 4 +- xfa/fxfa/parser/cxfa_submit.cpp | 4 +- xfa/fxfa/parser/cxfa_submit.h | 4 +- xfa/fxfa/parser/cxfa_text.cpp | 2 +- xfa/fxfa/parser/cxfa_text.h | 2 +- xfa/fxfa/parser/cxfa_thisproxy.cpp | 2 +- xfa/fxfa/parser/cxfa_tooltip.cpp | 2 +- xfa/fxfa/parser/cxfa_tooltip.h | 2 +- xfa/fxfa/parser/cxfa_validate.cpp | 32 +- xfa/fxfa/parser/cxfa_validate.h | 24 +- xfa/fxfa/parser/cxfa_value.cpp | 2 +- xfa/fxfa/parser/cxfa_value.h | 2 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 209 +++++----- xfa/fxfa/parser/cxfa_widgetdata.h | 62 ++- xfa/fxfa/parser/cxfa_xmllocale.cpp | 92 +++-- xfa/fxfa/parser/cxfa_xmllocale.h | 34 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 75 ++-- xfa/fxfa/parser/xfa_utils.cpp | 24 +- xfa/fxfa/parser/xfa_utils.h | 16 +- 73 files changed, 1077 insertions(+), 1106 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index e2d9f043d1..c5b09d155b 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -15,7 +15,7 @@ CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument) : 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 45f1171321..ecf2a98915 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 @@ CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) : 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 2db6677877..f1eaff8c93 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -30,7 +30,7 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::HostPseudoModel, - CFX_WideStringC(L"hostPseudoModel")) {} + WideStringView(L"hostPseudoModel")) {} CScript_HostPseudoModel::~CScript_HostPseudoModel() {} @@ -89,7 +89,7 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, @@ -118,7 +118,7 @@ void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, @@ -136,9 +136,9 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, 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 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { @@ -217,10 +217,10 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { } 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 @@ void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { 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 @@ void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { 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 821f88d137..4ec92dd73a 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -54,7 +54,7 @@ class CScript_HostPseudoModel : public CXFA_Object { 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 46db2ca78c..e35a3b8aa0 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -28,7 +28,7 @@ CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::LayoutPseudoModel, - CFX_WideStringC(L"layoutPseudoModel")) {} + WideStringView(L"layoutPseudoModel")) {} CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} @@ -73,11 +73,11 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, 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 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, 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 @@ void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { std::vector 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 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { 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 6f98997b0d..539fcce4ca 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h @@ -53,7 +53,7 @@ class CScript_LayoutPseudoModel : public CXFA_Object { private: std::vector 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 d9563ac93e..f0747f4a12 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -15,7 +15,7 @@ CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument) : 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 c746a4e76f..a1136b1ddf 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -18,7 +18,7 @@ CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( : 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 aac2c18321..72373ae571 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 40a2a1a482..b24e6f8769 100644 --- a/xfa/fxfa/parser/cxfa_bind.h +++ b/xfa/fxfa/parser/cxfa_bind.h @@ -16,7 +16,7 @@ class CXFA_Bind : public CXFA_Data { 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 c3c5cabe4e..c6dbdb3b02 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 191941a3fb..58e50da8ee 100644 --- a/xfa/fxfa/parser/cxfa_binditems.h +++ b/xfa/fxfa/parser/cxfa_binditems.h @@ -16,10 +16,10 @@ class CXFA_BindItems : public CXFA_Data { 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 bc89d81777..3b0f038f6a 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -21,7 +21,7 @@ CXFA_Script CXFA_Calculate::GetScript() { 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 1012224069..b3a6ef2eaa 100644 --- a/xfa/fxfa/parser/cxfa_calculate.h +++ b/xfa/fxfa/parser/cxfa_calculate.h @@ -19,7 +19,7 @@ class CXFA_Calculate : public CXFA_Data { 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 7bf18a5d3e..5a82ce36cb 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 90b689020b..4a073abcb7 100644 --- a/xfa/fxfa/parser/cxfa_data.h +++ b/xfa/fxfa/parser/cxfa_data.h @@ -15,7 +15,7 @@ class CXFA_Node; 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 0af9bd47f1..edc7b23b6b 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 @@ bool IsXMLValidChar(wchar_t ch) { (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 @@ CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { 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 AttributeSaveInDataModel(CXFA_Node* pNode, XFA_ATTRIBUTE eAttribute) { } bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { - CFX_WideString wsContent; + WideString wsContent; if (!pContentNode->TryContent(wsContent, false, false)) return false; @@ -144,12 +144,12 @@ bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { } 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 RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, (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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 wsSelTextArray; + std::vector wsSelTextArray; FX_STRSIZE iStart = 0; auto iEnd = wsRawValue.Find(L'\n', iStart); iEnd = !iEnd.has_value() ? wsRawValue.GetLength() : iEnd; @@ -241,7 +241,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, for (int32_t i = 0; i < pdfium::CollectionSize(wsSelTextArray); i++) { buf << L""; - buf << ExportEncodeContent(wsSelTextArray[i].AsStringC()); + buf << ExportEncodeContent(wsSelTextArray[i].AsStringView()); buf << L""; } buf << L""; - 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, 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 @@ void RegenerateFormFile_Container( 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 @@ void RegenerateFormFile_Container( 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 @@ void XFA_DataExporter_RegenerateFormFile( if (pNode->IsModelNode()) { pStream->WriteString(L"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 @@ void XFA_DataExporter_RegenerateFormFile( 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 85d2758467..3a46e26cb7 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -151,11 +151,11 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { 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 @@ bool CXFA_Document::IsInteractive() { 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 @@ CXFA_ScriptContext* CXFA_Document::GetScriptContext() { } 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 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( } 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 @@ void CXFA_Document::DoProtoMerge() { 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 @@ void CXFA_Document::DoProtoMerge() { } 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 8491febdbf..69154b21e8 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -70,7 +70,7 @@ class CXFA_Document { 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& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); CXFA_LayoutProcessor* GetDocLayout(); @@ -87,7 +87,7 @@ class CXFA_Document { 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 d7534289b3..d541ea0f14 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -26,7 +26,7 @@ XFA_Element CXFA_Event::GetEventType() const { 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 @@ CXFA_Submit CXFA_Event::GetSubmit() const { 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 fc0bcf34cc..3835454c28 100644 --- a/xfa/fxfa/parser/cxfa_event.h +++ b/xfa/fxfa/parser/cxfa_event.h @@ -24,8 +24,8 @@ class CXFA_Event : public CXFA_Data { 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 ac82b3043c..8ba9d0218b 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 c92bacd3f2..03913a2165 100644 --- a/xfa/fxfa/parser/cxfa_exdata.h +++ b/xfa/fxfa/parser/cxfa_exdata.h @@ -16,7 +16,7 @@ class CXFA_ExData : public CXFA_Data { 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 8a7969d5e4..6b39134126 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -18,7 +18,7 @@ int32_t CXFA_Fill::GetPresence() { 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 @@ void CXFA_Fill::SetColor(FX_ARGB color) { 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 @@ XFA_Element CXFA_Fill::GetFillType() { 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 CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { 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 @@ int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { 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 @@ int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { 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 56e04b75f7..71aa61700f 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -18,21 +18,21 @@ float CXFA_Font::GetBaselineShift() { } 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 @@ float CXFA_Font::GetFontSize() { 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 2a5fef1122..af0c348aa7 100644 --- a/xfa/fxfa/parser/cxfa_font.h +++ b/xfa/fxfa/parser/cxfa_font.h @@ -24,7 +24,7 @@ class CXFA_Font : public CXFA_Data { 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 8d14d62960..b6d78d9eda 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_image.cpp @@ -15,11 +15,11 @@ int32_t CXFA_Image::GetAspect() { 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 @@ int32_t CXFA_Image::GetTransferEncoding() { 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 204441ab6b..cc08bc3380 100644 --- a/xfa/fxfa/parser/cxfa_image.h +++ b/xfa/fxfa/parser/cxfa_image.h @@ -18,12 +18,12 @@ class CXFA_Image : public CXFA_Data { 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 f7a019d2d8..7d9a2188c8 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -29,10 +29,10 @@ namespace { -std::vector SeparateStringW(const wchar_t* pStr, - int32_t iStrLen, - wchar_t delimiter) { - std::vector ret; +std::vector SeparateStringW(const wchar_t* pStr, + int32_t iStrLen, + wchar_t delimiter) { + std::vector ret; if (!pStr) return ret; if (iStrLen < 0) @@ -42,7 +42,7 @@ std::vector SeparateStringW(const wchar_t* pStr, 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 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { 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 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { 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 b80100a5f0..d8fdbb4ba1 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -65,7 +65,7 @@ class PageSetContainerLayoutItem { 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 @@ void RemoveLayoutItem(CXFA_ContainerLayoutItem* pLayoutItem) { 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 iSplitNextIndex = 0; if (!bTargetAllFind) { iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex); @@ -165,17 +165,17 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, 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 @@ float CXFA_LayoutPageMgr::GetAvailHeight() { } bool XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { - CFX_WideString wsExpression; + WideString wsExpression; pTestScript->TryContent(wsExpression); if (wsExpression.IsEmpty()) return true; @@ -801,7 +801,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( 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 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( 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 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( } 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 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, ->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 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, 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 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( 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 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) { 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 833f72c33f..5d74c9bf47 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -1078,7 +1078,7 @@ static std::unique_ptr XFA_GetLocaleFromBuffer(const uint8_t* pBuf, : 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 @@ static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { 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 @@ std::unique_ptr CXFA_LocaleMgr::GetLocale(uint16_t lcid) { } } -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 @@ void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) { 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 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { } 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 f730304c10..d77a94a519 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.h +++ b/xfa/fxfa/parser/cxfa_localemgr.h @@ -19,15 +19,15 @@ class IFX_Locale; 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 GetLocale(uint16_t lcid); @@ -35,7 +35,7 @@ class CXFA_LocaleMgr { std::vector> m_LocaleArray; std::vector> 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 dd56e6d7a1..109254fe2c 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.cpp +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -41,9 +41,9 @@ FX_LOCALECATEGORY ValueCategory(FX_LOCALECATEGORY eCategory, 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 @@ CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr) 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 @@ CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, 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::operator=(const CXFA_LocaleValue& value) { 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(m_pLocaleMgr); - std::vector wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, &wsPatterns); bool bRet = false; int32_t iCount = pdfium::CollectionSize(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 @@ bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, 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 @@ CFX_DateTime CXFA_LocaleValue::GetTime() const { 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 @@ bool CXFA_LocaleValue::SetTime(const CFX_DateTime& t) { 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 @@ bool CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) { 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(m_pLocaleMgr); - std::vector wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsFormat, &wsPatterns); wsResult.clear(); int32_t iCount = pdfium::CollectionSize(wsPatterns); @@ -337,8 +337,8 @@ bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, 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 @@ bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, 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 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { 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(m_pLocaleMgr); - std::vector wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, &wsPatterns); bool bRet = false; int32_t iCount = pdfium::CollectionSize(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 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, 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 @@ void CXFA_LocaleValue::GetNumericFormat(CFX_WideString& wsFormat, 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 @@ bool CXFA_LocaleValue::ValidateNumericTemp(const CFX_WideString& wsNumeric, ++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 caf4b0c0f1..d49376332d 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.h +++ b/xfa/fxfa/parser/cxfa_localevalue.h @@ -31,34 +31,32 @@ class CXFA_LocaleValue { 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 @@ class CXFA_LocaleValue { 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 1c427209f9..24b5ba2f59 100644 --- a/xfa/fxfa/parser/cxfa_measurement.cpp +++ b/xfa/fxfa/parser/cxfa_measurement.cpp @@ -18,7 +18,7 @@ constexpr float kPtToPc = 12; } // namespace -CXFA_Measurement::CXFA_Measurement(const CFX_WideStringC& wsMeasure) { +CXFA_Measurement::CXFA_Measurement(const WideStringView& wsMeasure) { SetString(wsMeasure); } @@ -30,7 +30,7 @@ CXFA_Measurement::CXFA_Measurement(float fValue, XFA_UNIT eUnit) { 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 @@ void CXFA_Measurement::SetString(const CFX_WideStringC& wsMeasure) { 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 @@ bool CXFA_Measurement::ToUnitInternal(XFA_UNIT eUnit, float* fValue) const { } // 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 2c03ec0dc6..0212ea1729 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 @@ class CXFA_Measurement { 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 2f741c59e6..1dc20485ab 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(pData); + delete static_cast(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 @@ int32_t GetCount(CXFA_Node* pInstMgrNode) { 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 @@ CXFA_Node* GetItem(CXFA_Node* pInstMgrNode, int32_t iIndex) { 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 @@ static const XFA_ExecEventParaInfo gs_eventParaInfos[] = { }; 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 @@ const XFA_ExecEventParaInfo* GetEventParaInfoByName( 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 @@ enum XFA_KEYTYPE { 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 @@ CXFA_Node::CXFA_Node(CXFA_Document* pDoc, 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 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { if (IsNeedSavingXMLNode()) { std::unique_ptr pCloneXML; if (IsAttributeInXML()) { - CFX_WideString wsName; + WideString wsName; GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); auto pCloneXMLElement = pdfium::MakeUnique(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 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { XFA_ATTRIBUTEENUM_MultiSelect) { return nullptr; } else { - CFX_WideString wsPicture; + WideString wsPicture; if (pFieldWidgetData) { pFieldWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); @@ -846,7 +843,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { : 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 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { 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_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { } 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 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, } 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 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( 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 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 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 pFakeXMLRoot(pFakeRoot->GetXMLMappingNode()); @@ -1304,7 +1299,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { } if (!pFakeXMLRoot) { pFakeXMLRoot = - pdfium::MakeUnique(CFX_WideString(GetClassName())); + pdfium::MakeUnique(WideString(GetClassName())); } if (bIgnoreRoot) { @@ -1391,7 +1386,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { } bPrettyMode = true; } - CFX_WideString bsXMLHeader = L"\n"; + WideString bsXMLHeader = L"\n"; if (GetPacketID() == XFA_XDPPACKET_Form || GetPacketID() == XFA_XDPPACKET_Datasets) { CFX_XMLNode* pElement = nullptr; @@ -1399,7 +1394,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { auto pStream = pdfium::MakeRetain(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 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { // 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 @@ void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { return; } CXFA_Node* pNode = nullptr; - CFX_WideString wsName; + WideString wsName; pNode = static_cast(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 @@ void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, pValue->SetBoolean(false); return; } - CFX_WideString strValue; + WideString strValue; pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); } @@ -1538,12 +1534,12 @@ void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, } } } else { - CFX_WideString wsValue; + WideString wsValue; GetAttribute(eAttribute, wsValue); - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -1825,9 +1821,9 @@ void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, pNotify->AddCalcValidate(this); } } else { - CFX_WideString wsMessage; + WideString wsMessage; switch (iMessageType) { case XFA_SOM_ValidationMessage: validate.GetScriptMessageText(wsMessage); @@ -1905,7 +1901,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, default: break; } - pValue->SetString(wsMessage.UTF8Encode().AsStringC()); + pValue->SetString(wsMessage.UTF8Encode().AsStringView()); } } @@ -1948,14 +1944,14 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, } 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 @@ void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_BorderColor(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, } 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 @@ void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, } 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 @@ void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_FormattedValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { 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 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { 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 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { 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 @@ void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue, 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 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { 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(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 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { 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(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 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { 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(pXMLNode); @@ -3420,13 +3416,13 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, 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(pXMLNode); wsTextData = pXMLElement->GetTextData(); } - pValue->SetString(wsTextData.UTF8Encode().AsStringC()); + pValue->SetString(wsTextData.UTF8Encode().AsStringView()); } } @@ -3548,7 +3544,7 @@ void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue, 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::HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit) { } 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 @@ bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, 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::SetAttribute(XFA_ATTRIBUTE eAttr, } 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 @@ bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, 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::GetAttribute(XFA_ATTRIBUTE eAttr, } } -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 @@ bool CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, 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 @@ CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { } 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 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, case FX_XMLNODE_Element: if (IsAttributeInXML()) { static_cast(m_pXMLNode) - ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), + ->SetString(WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), wsValue); } else { bool bDeleteChildren = true; @@ -3820,7 +3816,7 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, 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 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, 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 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, case FX_XMLNODE_Element: if (IsAttributeInXML()) { static_cast(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::SetAttributeValue(const CFX_WideString& wsValue, } 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, } 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 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, 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 @@ bool CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, ->SetString(pInfo->pName, pValue ? L"1" : L"0"); break; case XFA_ATTRIBUTETYPE_Integer: { - CFX_WideString wsValue; + WideString wsValue; wsValue.Format( L"%d", static_cast(reinterpret_cast(pValue))); static_cast(m_pXMLNode) @@ -4017,8 +4013,8 @@ bool CXFA_Node::TryUserData(void* pKey, void*& pData, bool bProtoAlso) { 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 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, bScriptModify, false); CXFA_Node* pBind = GetBindData(); if (bSyncData && pBind) { - std::vector wsSaveTextArray; + std::vector wsSaveTextArray; size_t iSize = 0; if (!wsContent.IsEmpty()) { FX_STRSIZE iStart = 0; @@ -4132,12 +4128,12 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, 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 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, 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 @@ bool CXFA_Node::SetContent(const CFX_WideString& wsContent, 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 @@ bool CXFA_Node::TryContent(CFX_WideString& wsContent, 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 @@ CXFA_Node* CXFA_Node::GetModelNode() { } } -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 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast(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 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { 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(uint32_t dwNameHash) const { } 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 @@ int32_t CXFA_Node::GetNodeSameClassIndex() const { return pScriptContext->GetIndexByClassName(const_cast(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 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { 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 @@ void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, } } -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 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, 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 @@ void CXFA_Node::UpdateNameHash() { 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 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { 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 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { } } 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 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, 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 db4b2ce553..7faed0e38f 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -105,29 +105,29 @@ class CXFA_Node : public CXFA_Object { 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 @@ class CXFA_Node : public CXFA_Object { 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 @@ class CXFA_Node : public CXFA_Object { 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 @@ class CXFA_Node : public CXFA_Object { 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 @@ class CXFA_Node : public CXFA_Object { 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 @@ class CXFA_Node : public CXFA_Object { 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 4f1ed04fe3..bc91c66f77 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -31,7 +31,7 @@ CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetOneChild(CXFA_Node* parent, return nullptr; std::vector 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 @@ int32_t CXFA_NodeHelper::GetIndex(CXFA_Node* pNode, } 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 @@ void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, return; } - CFX_WideString ws; + WideString ws; bool bIsProperty = NodeIsProperty(refNode); if (refNode->IsUnnamed() || (bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) { @@ -275,9 +275,9 @@ bool CXFA_NodeHelper::NodeIsTransparent(CXFA_Node* refNode) { 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::CreateNode_ForCondition(CFX_WideString& wsCondition) { } 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 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode( 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 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode( 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 cf6c2f17a0..4c7d7ae10c 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -49,15 +49,15 @@ class CXFA_NodeHelper { 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 f47a1b1752..cea1f127a6 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -17,14 +17,14 @@ CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList, - CFX_WideStringC(L"nodeList")) { + WideStringView(L"nodeList")) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr(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 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( 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 6fffb7bb67..2fccd5d7a5 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.h +++ b/xfa/fxfa/parser/cxfa_nodelist.h @@ -19,7 +19,7 @@ class CXFA_NodeList : public CXFA_Object { 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 78b0cef278..d0d1fd34e4 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -24,7 +24,7 @@ const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; } // 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 @@ CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) { 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 @@ CFX_WideString CXFA_NodeLocale::GetNumbericSymbol( 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 @@ FX_TIMEZONE CXFA_NodeLocale::GetTimeZone() const { 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 @@ CFX_WideString CXFA_NodeLocale::GetDatePattern( 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 @@ CFX_WideString CXFA_NodeLocale::GetTimePattern( 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 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, 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 e051bb6ac3..5ad0d4c626 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 @@ class CXFA_NodeLocale : public IFX_Locale { ~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 const m_pLocale; }; diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 8ebedf9fed..c23420446a 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 @@ void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, 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::ThrowIndexOutOfBoundsException() const { } 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::ThrowArgumentMismatchException() const { } 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 4f1850f14c..49442d254d 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -35,7 +35,7 @@ class CXFA_Object : public CFXJSE_HostObject { 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 @@ class CXFA_Object : public CFXJSE_HostObject { 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 @@ class CXFA_Object : public CFXJSE_HostObject { 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 @@ class CXFA_Object : public CFXJSE_HostObject { 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 15c3f14b23..4d0ec516b2 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -34,7 +34,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { 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 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { 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::Resolve(CXFA_ResolveNodesData& rnd) { } 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::ResolveAnyChild(CXFA_ResolveNodesData& rnd) { } 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 @@ int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) { return -1; } XFA_HashCode dwNameHash = static_cast(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 @@ int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) { rndFind.m_CurObject = datasets; rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); rndFind.m_uHashName = static_cast( - 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::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) { } 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 @@ int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes; rndFind.m_wsName = wsName; rndFind.m_uHashName = static_cast( - 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::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } } 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { 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 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } 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 @@ int32_t CXFA_ResolveProcessor::ResolvePopStack(std::vector* stack) { 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 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, 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 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, wsCondition.TrimLeft(); wsCondition.TrimRight(); rnd.m_uHashName = - static_cast(FX_HashCode_GetW(wsName.AsStringC(), false)); + static_cast(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 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, 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::ConditionArray(int32_t iCurIndex, } void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, - CFX_WideString wsCondition, + WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd) { ASSERT(iFoundCount == pdfium::CollectionSize(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 @@ void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3); for (int32_t i = iFoundCount - 1; i >= 0; i--) { auto pRetValue = pdfium::MakeUnique(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::DoPredicateFilter(int32_t iCurIndex, } void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd, - CFX_WideString wsCondition) { + WideString wsCondition) { int32_t iCurrIndex = 0; const std::vector* pArray = rnd.m_pSC->GetUpObjectArray(); if (!pArray->empty()) { @@ -753,7 +753,7 @@ void CXFA_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles, 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 @@ int32_t CXFA_ResolveProcessor::SetResultCreateNode( return pdfium::CollectionSize(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 f4eafea023..b48ee36476 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.h +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h @@ -22,9 +22,9 @@ class CXFA_ResolveNodesData { 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 m_Objects; // Not owned. uint32_t m_dwStyles; @@ -38,12 +38,12 @@ class CXFA_ResolveProcessor { ~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 @@ class CXFA_ResolveProcessor { 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 @@ class CXFA_ResolveProcessor { 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 m_pNodeHelper; diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp index ccd1997c47..6b6f6ba1c8 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 @@ int32_t CXFA_Script::GetRunAt() { 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 d89062487d..bb98f58abc 100644 --- a/xfa/fxfa/parser/cxfa_script.h +++ b/xfa/fxfa/parser/cxfa_script.h @@ -26,7 +26,7 @@ class CXFA_Script : public CXFA_Data { 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 98b5da057f..38d503962d 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -81,7 +81,7 @@ CXFA_ThisProxy* ToThisProxy(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { } const XFA_METHODINFO* GetMethodByName(XFA_Element eElement, - const CFX_WideStringC& wsMethodName) { + const WideStringView& wsMethodName) { if (wsMethodName.IsEmpty()) return nullptr; @@ -146,10 +146,10 @@ void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { } 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 typeRestorer(&m_eScriptType); m_eScriptType = eScriptType; if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { @@ -162,7 +162,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, hRetValue->SetUndefined(); return false; } - btScript = FX_UTF8Encode(wsJavaScript.AsStringC()); + btScript = FX_UTF8Encode(wsJavaScript.AsStringView()); } else { btScript = FX_UTF8Encode(wsScript); } @@ -173,21 +173,21 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, } 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 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, 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 @@ bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, 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( - 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 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, 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 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, 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 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, 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 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, (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::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, } } 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 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, 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 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } 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 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } 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 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( 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 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( 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 @@ void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, 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 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { 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(m_pIsolate); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); CFXJSE_Context* pVariablesContext = @@ -503,7 +504,7 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { } 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::DefineJsClass() { } 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 pObject = pContext->GetGlobalObject(); auto hProp = pdfium::MakeUnique(m_pIsolate); for (int i = 0; i < 2; ++i) { @@ -557,7 +558,7 @@ CFXJSE_Class* CXFA_ScriptContext::GetJseNormalClass() { } 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 @@ int32_t CXFA_ScriptContext::GetIndexByClassName(CXFA_Node* refNode) { 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 45e6897a4c..d3632e2859 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -30,12 +30,12 @@ class CXFA_ScriptContext { 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 @@ class CXFA_ScriptContext { 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* pArray); void AddNodesOfRunScript(const std::vector& nodes); @@ -56,36 +56,36 @@ class CXFA_ScriptContext { 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 dd72f40d56..5b58761712 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -57,25 +57,25 @@ CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc, 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(pNode); - CFX_WideString wsNodeStr = pElement->GetLocalTagName(); + WideString wsNodeStr = pElement->GetLocalTagName(); if (wsNodeStr != wsLocalTagName) return false; @@ -90,9 +90,9 @@ bool MatchNodeName(CFX_XMLNode* pNode, 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 GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, } 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 @@ bool ResolveAttribute(CFX_XMLElement* pElement, return false; } if (!XFA_FDEExtension_ResolveNamespaceQualifier( - pElement, wsNSPrefix.AsStringC(), &wsNamespaceURI)) { + pElement, wsNSPrefix.AsStringView(), &wsNamespaceURI)) { wsNamespaceURI.clear(); return false; } @@ -125,17 +125,17 @@ bool ResolveAttribute(CFX_XMLElement* pElement, } 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 @@ bool FindAttributeWithNS(CFX_XMLElement* pElement, } if (!XFA_FDEExtension_ResolveNamespaceQualifier( - pElement, wsNSPrefix.AsStringC(), &wsAttrNS)) { + pElement, wsNSPrefix.AsStringView(), &wsAttrNS)) { continue; } if (bMatchNSAsPrefix) { @@ -194,20 +194,19 @@ CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) { 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(pXMLChild)->GetTextData(); wsTextData += L"\n"; wsOutput += wsTextData; @@ -215,7 +214,7 @@ void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, } case FX_XMLNODE_Text: case FX_XMLNODE_CharData: { - CFX_WideString wsText = static_cast(pXMLChild)->GetText(); + WideString wsText = static_cast(pXMLChild)->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -229,7 +228,7 @@ void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, } } -const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) { +const XFA_PACKETINFO* GetPacketByName(const WideStringView& wsName) { if (wsName.IsEmpty()) return nullptr; @@ -315,7 +314,7 @@ int32_t CXFA_SimpleParser::DoParse() { 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(); @@ -353,9 +352,9 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, return; CFX_XMLElement* child = static_cast(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 @@ CFX_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { 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 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( continue; CFX_XMLElement* pElement = reinterpret_cast(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 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( if (m_bDocumentParser) { CFX_XMLElement* pXMLDocumentElement = static_cast(pXMLDocumentNode); - CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI(); + WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI(); if (wsNamespaceURI.IsEmpty()) wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa"); @@ -628,7 +627,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { CFX_XMLElement* pXMLDocumentElement = static_cast(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 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( 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 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( 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 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( delete pDataXMLNode; return nullptr; } - CFX_WideString wsLocalName = + WideString wsLocalName = static_cast(pDataXMLNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); if (!DataLoader(pNode, pDataXMLNode, true)) @@ -821,7 +820,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( if (!pNode) return nullptr; - CFX_WideString wsName = + WideString wsName = static_cast(pXMLDocumentNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); if (!UserPacketLoader(pNode, pXMLDocumentNode)) @@ -854,8 +853,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, switch (pXMLChild->GetType()) { case FX_XMLNODE_Element: { CFX_XMLElement* pXMLElement = static_cast(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 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, 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 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, case FX_XMLNODE_Element: { CFX_XMLElement* pXMLElement = static_cast(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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, 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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } 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 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, case FX_XMLNODE_CharData: case FX_XMLNODE_Text: { CFX_XMLText* pXMLText = static_cast(pXMLChild); - CFX_WideString wsText = pXMLText->GetText(); + WideString wsText = pXMLText->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -1131,7 +1129,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (eNodeType == FX_XMLNODE_Instruction) continue; - CFX_WideString wsText; + WideString wsText; if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) { wsText = static_cast(pXMLChild)->GetText(); if (!pXMLCurValueNode) @@ -1148,7 +1146,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } 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 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (!pXFAChild) return; - CFX_WideString wsNodeStr = + WideString wsNodeStr = static_cast(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 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } pXMLCurValueNode = nullptr; } - CFX_WideString wsNodeValue = wsValueTextBuf.MakeString(); + WideString wsNodeValue = wsValueTextBuf.MakeString(); pXFANode->SetCData(XFA_ATTRIBUTE_Value, wsNodeValue); } @@ -1211,9 +1209,8 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, if (!m_bDocumentParser) return; - CFX_WideString wsTargetName = pXMLInstruction->GetName(); - const std::vector& target_data = - pXMLInstruction->GetTargetData(); + WideString wsTargetName = pXMLInstruction->GetName(); + const std::vector& 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 705b6bde5c..91bfb054b5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -28,7 +28,7 @@ class CXFA_SimpleParser { int32_t StartParse(const CFX_RetainPtr& 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 e81c0ce591..f1319340a0 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -52,7 +52,7 @@ FX_ARGB CXFA_Stroke::GetColor() const { if (!pNode) return 0xFF000000; - CFX_WideStringC wsColor; + WideStringView wsColor; pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor); return CXFA_Data::ToColor(wsColor); } @@ -62,7 +62,7 @@ void CXFA_Stroke::SetColor(FX_ARGB argb) { 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 e390e6314b..7fb04a3c64 100644 --- a/xfa/fxfa/parser/cxfa_submit.cpp +++ b/xfa/fxfa/parser/cxfa_submit.cpp @@ -18,10 +18,10 @@ int32_t CXFA_Submit::GetSubmitFormat() { 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 f10435e1f5..9d4d7fe281 100644 --- a/xfa/fxfa/parser/cxfa_submit.h +++ b/xfa/fxfa/parser/cxfa_submit.h @@ -19,8 +19,8 @@ class CXFA_Submit : public CXFA_Data { 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 192a4deac4..cab11a6892 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 ca41c0dbb4..18b5628482 100644 --- a/xfa/fxfa/parser/cxfa_text.h +++ b/xfa/fxfa/parser/cxfa_text.h @@ -16,7 +16,7 @@ class CXFA_Text : public CXFA_Data { 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 2938c1fb3f..55e676ecdc 100644 --- a/xfa/fxfa/parser/cxfa_thisproxy.cpp +++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp @@ -12,7 +12,7 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) : 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 f3de7aa591..9561ef2ac5 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 433885d89c..cc4bc31841 100644 --- a/xfa/fxfa/parser/cxfa_tooltip.h +++ b/xfa/fxfa/parser/cxfa_tooltip.h @@ -16,7 +16,7 @@ class CXFA_ToolTip : public CXFA_Data { 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 712d0f2829..fc472741a9 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -16,10 +16,10 @@ int32_t CXFA_Validate::GetFormatTest() { } 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 @@ bool CXFA_Validate::SetTestValue(int32_t iType, 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 @@ int32_t CXFA_Validate::GetScriptTest() { 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 @@ void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, 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::GetMessageText(CFX_WideString& wsMessage, } } -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 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, 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 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, 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 470cefe773..ce4ba647cc 100644 --- a/xfa/fxfa/parser/cxfa_validate.h +++ b/xfa/fxfa/parser/cxfa_validate.h @@ -20,24 +20,22 @@ class CXFA_Validate : public CXFA_Data { 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 4f166d5d42..abf55da260 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -16,7 +16,7 @@ XFA_Element CXFA_Value::GetChildValueClassID() { 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 225e1879da..52df169ee4 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -23,7 +23,7 @@ class CXFA_Value : public CXFA_Data { 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 80981d97d6..1879377ae4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -34,9 +34,9 @@ float GetEdgeThickness(const std::vector& strokes, 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 @@ XFA_ATTRIBUTEENUM GetAttributeDefaultValue_Enum(XFA_Element eElement, 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 @@ XFA_Element CXFA_WidgetData::GetUIType() { return m_eUIType; } -CFX_WideString CXFA_WidgetData::GetRawValue() { +WideString CXFA_WidgetData::GetRawValue() { return m_pNode->GetContent(); } @@ -309,13 +309,13 @@ std::vector CXFA_WidgetData::GetEventByActivity(int32_t iActivity, 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 @@ int32_t CXFA_WidgetData::GetButtonHighlight() { 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 @@ bool CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, 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 @@ bool CXFA_WidgetData::IsAllowNeutral() { } XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { - CFX_WideString wsValue = GetRawValue(); + WideString wsValue = GetRawValue(); if (wsValue.IsEmpty()) return XFA_CHECKSTATE_Off; @@ -513,7 +513,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { 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 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { 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 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { 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 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { 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::GetExclGroupNode() { 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 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() { 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 @@ CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, 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 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, 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 @@ int32_t CXFA_WidgetData::CountChoiceListItems(bool bSaveValue) { 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 @@ bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, return false; } -std::vector CXFA_WidgetData::GetChoiceListItems( - bool bSaveValue) { +std::vector CXFA_WidgetData::GetChoiceListItems(bool bSaveValue) { std::vector items; for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode && items.size() < 2; @@ -786,7 +785,7 @@ std::vector CXFA_WidgetData::GetChoiceListItems( items.push_back(pNode); } if (items.empty()) - return std::vector(); + return std::vector(); CXFA_Node* pItem = items.front(); if (items.size() > 1) { @@ -796,7 +795,7 @@ std::vector CXFA_WidgetData::GetChoiceListItems( pItem = items[1]; } - std::vector wsTextArray; + std::vector wsTextArray; for (CXFA_Node* pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { wsTextArray.emplace_back(); @@ -806,12 +805,12 @@ std::vector CXFA_WidgetData::GetChoiceListItems( } int32_t CXFA_WidgetData::CountSelectedItems() { - std::vector wsValueArray = GetSelectedItemsValue(); + std::vector wsValueArray = GetSelectedItemsValue(); if (IsListBox() || !IsChoiceListAllowTextEntry()) return pdfium::CollectionSize(wsValueArray); int32_t iSelected = 0; - std::vector wsSaveTextArray = GetChoiceListItems(true); + std::vector wsSaveTextArray = GetChoiceListItems(true); for (const auto& value : wsValueArray) { if (pdfium::ContainsValue(wsSaveTextArray, value)) iSelected++; @@ -820,11 +819,11 @@ int32_t CXFA_WidgetData::CountSelectedItems() { } int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) { - std::vector wsValueArray = GetSelectedItemsValue(); + std::vector wsValueArray = GetSelectedItemsValue(); if (!pdfium::IndexInBounds(wsValueArray, nIndex)) return -1; - std::vector wsSaveTextArray = GetChoiceListItems(true); + std::vector 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 @@ int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) { std::vector CXFA_WidgetData::GetSelectedItems() { std::vector iSelArray; - std::vector wsValueArray = GetSelectedItemsValue(); - std::vector wsSaveTextArray = GetChoiceListItems(true); + std::vector wsValueArray = GetSelectedItemsValue(); + std::vector 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 @@ std::vector CXFA_WidgetData::GetSelectedItems() { return iSelArray; } -std::vector CXFA_WidgetData::GetSelectedItemsValue() { - std::vector wsSelTextArray; - CFX_WideString wsValue = GetRawValue(); +std::vector CXFA_WidgetData::GetSelectedItemsValue() { + std::vector wsSelTextArray; + WideString wsValue = GetRawValue(); if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { if (!wsValue.IsEmpty()) { FX_STRSIZE iStart = 0; @@ -868,7 +867,7 @@ std::vector CXFA_WidgetData::GetSelectedItemsValue() { } bool CXFA_WidgetData::GetItemState(int32_t nIndex) { - std::vector wsSaveTextArray = GetChoiceListItems(true); + std::vector wsSaveTextArray = GetChoiceListItems(true); return pdfium::IndexInBounds(wsSaveTextArray, nIndex) && pdfium::ContainsValue(GetSelectedItemsValue(), wsSaveTextArray[nIndex]); @@ -879,12 +878,12 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, bool bNotify, bool bScriptModify, bool bSyncData) { - std::vector wsSaveTextArray = GetChoiceListItems(true); + std::vector wsSaveTextArray = GetChoiceListItems(true); if (!pdfium::IndexInBounds(wsSaveTextArray, nIndex)) return; int32_t iSel = -1; - std::vector wsValueArray = GetSelectedItemsValue(); + std::vector wsValueArray = GetSelectedItemsValue(); auto it = std::find(wsValueArray.begin(), wsValueArray.end(), wsSaveTextArray[nIndex]); if (it != wsValueArray.end()) @@ -893,7 +892,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, 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 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, } 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 @@ void CXFA_WidgetData::SetSelectedItems(const std::vector& iSelArray, bool bNotify, bool bScriptModify, bool bSyncData) { - CFX_WideString wsValue; + WideString wsValue; int32_t iSize = pdfium::CollectionSize(iSelArray); if (iSize >= 1) { - std::vector wsSaveTextArray = GetChoiceListItems(true); - CFX_WideString wsItemValue; + std::vector 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::SetSelectedItems(const std::vector& iSelArray, 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 @@ void CXFA_WidgetData::ClearAllSelections() { 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 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, 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 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, 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 listitems; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1040,7 +1039,7 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, } 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::GetItemLabel(const CFX_WideStringC& wsValue, } } -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 listitems; for (CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1085,7 +1084,7 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, } 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 @@ int32_t CXFA_WidgetData::GetNumberOfCells() { 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_Checksum(bool* val) { 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_DataLength(int32_t* val) { 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(wsStartEndChar[0]); @@ -1224,7 +1223,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { 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(wsStartEndChar[0]); @@ -1236,7 +1235,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { 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_Truncate(bool* val) { 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 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { 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 @@ bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { 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 @@ bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, } 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 @@ bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, 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 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { 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 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { 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 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetNormalizeDataValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, 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 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, 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 @@ void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, 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::FormatNumStr(const CFX_WideString& wsValue, } } -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::SyncValue(const CFX_WideString& wsValue, bool bNotify) { } 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 @@ CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, 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 f53d926655..69f8d0d5a2 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -45,7 +45,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Node* GetUIChild(); XFA_Element GetUIType(); - CFX_WideString GetRawValue(); + WideString GetRawValue(); int32_t GetAccess(); int32_t GetRotate(); @@ -73,8 +73,8 @@ class CXFA_WidgetData : public CXFA_Data { 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 @@ class CXFA_WidgetData : public CXFA_Data { 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 @@ class CXFA_WidgetData : public CXFA_Data { int32_t GetChoiceListOpen(); bool IsListBox(); int32_t CountChoiceListItems(bool bSaveValue); - bool GetChoiceListItem(CFX_WideString& wsText, - int32_t nIndex, - bool bSaveValue); - std::vector GetChoiceListItems(bool bSaveValue); + bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue); + std::vector GetChoiceListItems(bool bSaveValue); int32_t CountSelectedItems(); int32_t GetSelectedItem(int32_t nIndex); std::vector GetSelectedItems(); - std::vector GetSelectedItemsValue(); + std::vector GetSelectedItemsValue(); bool GetItemState(int32_t nIndex); void SetItemState(int32_t nIndex, bool bSelected, @@ -115,25 +113,25 @@ class CXFA_WidgetData : public CXFA_Data { 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); - - CFX_WideString GetBarcodeType(); + 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); + + WideString GetBarcodeType(); bool GetBarcodeAttribute_CharEncoding(int32_t* val); bool GetBarcodeAttribute_Checksum(bool* val); bool GetBarcodeAttribute_DataLength(int32_t* val); @@ -146,7 +144,7 @@ class CXFA_WidgetData : public CXFA_Data { 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 @@ class CXFA_WidgetData : public CXFA_Data { 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 4055c155dd..f9e4353dca 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.cpp +++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp @@ -21,14 +21,13 @@ CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr pLocaleData) 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 @@ CFX_WideString CXFA_XMLLocale::GetNumbericSymbol( 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 @@ FX_TIMEZONE CXFA_XMLLocale::GetTimeZone() const { 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 @@ CFX_WideString CXFA_XMLLocale::GetDatePattern( 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 @@ CFX_WideString CXFA_XMLLocale::GetTimePattern( 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 a58385601c..5050855ca6 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.h +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -19,29 +19,27 @@ class CXFA_XMLLocale : public IFX_Locale { ~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 m_pLocaleData; }; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index d4cd058b44..373412ebf9 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -73,7 +73,7 @@ void FormValueNode_MatchNoneCreateChild(CXFA_Node* pFormNode) { } 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 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, 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 @@ void CreateDataBinding(CXFA_Node* pFormNode, 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 @@ void CreateDataBinding(CXFA_Node* pFormNode, case XFA_Element::ChoiceList: defValue.GetChildValueContent(wsValue); if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { - std::vector wsSelTextArray = + std::vector wsSelTextArray = pWidgetData->GetSelectedItemsValue(); if (!wsSelTextArray.empty()) { for (const auto& text : wsSelTextArray) { @@ -211,7 +211,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!pText) continue; - CFX_WideString wsContent; + WideString wsContent; if (pText->TryContent(wsContent) && (wsContent == wsValue)) { pChecked = pChild; wsFormattedValue = wsValue; @@ -237,7 +237,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pText) pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); - CFX_WideString wsContent; + WideString wsContent; if (pText) pText->TryContent(wsContent); @@ -250,7 +250,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) break; - CFX_WideString wsOutput; + WideString wsOutput; pWidgetData->NormalizeNumStr(wsValue, wsOutput); wsValue = wsOutput; pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue); @@ -271,9 +271,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, 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 @@ void CreateDataBinding(CXFA_Node* pFormNode, static_cast(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 @@ void CreateDataBinding(CXFA_Node* pFormNode, 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 @@ void CreateDataBinding(CXFA_Node* pFormNode, 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 @@ void CreateDataBinding(CXFA_Node* pFormNode, 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* ScopeMatchGlobalBinding(CXFA_Node* pDataScope, } 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* FindGlobalDataNode(CXFA_Document* pDocument, } 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* FindOnceDataNode(CXFA_Document* pDocument, } 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* CloneOrMergeInstanceManager(CXFA_Document* pDocument, CXFA_Node* pFormParent, CXFA_Node* pTemplateNode, std::vector* 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* CopyContainer_Field(CXFA_Document* pDocument, 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 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, 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 @@ void UpdateBindingRelations(CXFA_Document* pDocument, : 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 @@ void UpdateBindingRelations(CXFA_Document* pDocument, 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 @@ void UpdateBindingRelations(CXFA_Document* pDocument, 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 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) { 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 @@ void CXFA_Document::DoDataMerge() { 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 @@ void CXFA_Document::DoDataMerge() { 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 @@ void CXFA_Document::DoDataMerge() { 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 fa75f18015..e1ee29d2b7 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -39,8 +39,8 @@ const double fraction_scales[] = {0.1, 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 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { 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(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 @@ void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, } case FX_XMLNODE_Text: case FX_XMLNODE_CharData: { - CFX_WideString wsContent = static_cast(pXMLNode)->GetText(); + WideString wsContent = static_cast(pXMLNode)->GetText(); wsPlainText += wsContent; break; } @@ -228,8 +228,8 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { 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 @@ int32_t XFA_MapRotation(int32_t nRotation) { const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_Element eElement, - const CFX_WideStringC& wsAttributeName) { + const WideStringView& wsAttributeName) { if (wsAttributeName.IsEmpty()) return nullptr; @@ -376,7 +376,7 @@ const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName) { : 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 @@ bool XFA_GetAttributeDefaultValue(void*& pValue, 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_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { } 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 bc05381fc3..404586bd56 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -21,8 +21,8 @@ int XFA_GetMaxFractionalScale(); bool XFA_FDEExtension_ResolveNamespaceQualifier( CFX_XMLElement* pNode, - const CFX_WideStringC& wsQualifier, - CFX_WideString* wsNamespaceURI); + const WideStringView& wsQualifier, + WideString* wsNamespaceURI); template class CXFA_NodeIteratorTemplate { @@ -144,12 +144,12 @@ class CXFA_NodeIteratorTemplate { }; 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_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( 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 @@ const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, 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 @@ bool XFA_GetAttributeDefaultValue(void*& pValue, 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); -- cgit v1.2.3