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/fm2js/cxfa_fmsimpleexpression.cpp | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp') diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp index fc07609f85..73dfdd55bc 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp @@ -81,7 +81,7 @@ const XFA_FMSOMMethod gs_FMSomMethods[] = { } // namespace -CFX_WideStringC XFA_FM_EXPTypeToString( +WideStringView XFA_FM_EXPTypeToString( XFA_FM_SimpleExpressionType simpleExpType) { return gs_lpStrExpFuncName[simpleExpType]; } @@ -110,7 +110,7 @@ bool CXFA_FMNullExpression::ToJavaScript(CFX_WideTextBuf& javascript) { } CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line, - CFX_WideStringC wsNumber) + WideStringView wsNumber) : CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {} CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {} @@ -121,13 +121,13 @@ bool CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { } CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, - CFX_WideStringC wsString) + WideStringView wsString) : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} CXFA_FMStringExpression::~CXFA_FMStringExpression() {} bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { - CFX_WideString tempStr(m_wsString); + WideString tempStr(m_wsString); if (tempStr.GetLength() <= 2) { javascript << tempStr; return true; @@ -156,14 +156,14 @@ bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression( uint32_t line, - CFX_WideStringC wsIdentifier) + WideStringView wsIdentifier) : CXFA_FMSimpleExpression(line, TOKidentifier), m_wsIdentifier(wsIdentifier) {} CXFA_FMIdentifierExpression::~CXFA_FMIdentifierExpression() {} bool CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& javascript) { - CFX_WideString tempStr(m_wsIdentifier); + WideString tempStr(m_wsIdentifier); if (tempStr == L"$") { tempStr = L"this"; } else if (tempStr == L"!") { @@ -244,7 +244,7 @@ bool CXFA_FMAssignExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << tempExp2; javascript << L");\n}\n"; if (m_pExp1->GetOperatorToken() == TOKidentifier && - tempExp1.AsStringC() != L"this") { + tempExp1.AsStringView() != L"this") { javascript << L"else\n{\n"; javascript << tempExp1; javascript << L" = "; @@ -282,7 +282,7 @@ bool CXFA_FMAssignExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << tempExp2; javascript << L");\n}\n"; if (m_pExp1->GetOperatorToken() == TOKidentifier && - tempExp1.AsStringC() != L"this") { + tempExp1.AsStringView() != L"this") { javascript << L"else\n{\n"; javascript << RUNTIMEFUNCTIONRETURNVALUE; javascript << L" = "; @@ -522,10 +522,10 @@ bool CXFA_FMCallExpression::IsBuiltInFunc(CFX_WideTextBuf* funcName) { if (funcName->GetLength() > g_BuiltInFuncsMaxLen) return false; - auto cmpFunc = [](const wchar_t* iter, const CFX_WideString& val) -> bool { + auto cmpFunc = [](const wchar_t* iter, const WideString& val) -> bool { return val.CompareNoCase(iter) > 0; }; - CFX_WideString str = funcName->MakeString(); + WideString str = funcName->MakeString(); const wchar_t* const* pMatchResult = std::lower_bound( std::begin(g_BuiltInFuncs), std::end(g_BuiltInFuncs), str, cmpFunc); if (pMatchResult != std::end(g_BuiltInFuncs) && @@ -538,8 +538,8 @@ bool CXFA_FMCallExpression::IsBuiltInFunc(CFX_WideTextBuf* funcName) { } uint32_t CXFA_FMCallExpression::IsMethodWithObjParam( - const CFX_WideString& methodName) { - auto cmpFunc = [](const XFA_FMSOMMethod iter, const CFX_WideString& val) { + const WideString& methodName) { + auto cmpFunc = [](const XFA_FMSOMMethod iter, const WideString& val) { return val.Compare(iter.m_wsSomMethodName) > 0; }; const XFA_FMSOMMethod* result = @@ -599,12 +599,12 @@ bool CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { bool isEvalFunc = false; bool isExistsFunc = false; if (IsBuiltInFunc(&funcName)) { - if (funcName.AsStringC() == L"Eval") { + if (funcName.AsStringView() == L"Eval") { isEvalFunc = true; javascript << L"eval.call(this, "; javascript << gs_lpStrExpFuncName[CALL]; javascript << L"Translate"; - } else if (funcName.AsStringC() == L"Exists") { + } else if (funcName.AsStringView() == L"Exists") { isExistsFunc = true; javascript << gs_lpStrExpFuncName[CALL]; javascript << funcName; @@ -655,7 +655,7 @@ CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression( uint32_t line, std::unique_ptr pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr pIndexExp) : CXFA_FMBinExpression(line, op, @@ -745,7 +745,7 @@ CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression( uint32_t line, std::unique_ptr pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr pIndexExp) : CXFA_FMBinExpression(line, op, -- cgit v1.2.3