Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: xfa/fxfa/fm2js/xfa_expression.cpp

Issue 2562833002: Replace CFX_WideStringCArray with std::vector. (Closed)
Patch Set: comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_expression.h ('k') | xfa/fxfa/fm2js/xfa_fmparse.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/fm2js/xfa_expression.cpp
diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp
index a668fc9089aa161c43cc65706bcc967ed0f9bb96..a4d119593320f86cc23ff6d1ec7ff13f961aa6dc 100644
--- a/xfa/fxfa/fm2js/xfa_expression.cpp
+++ b/xfa/fxfa/fm2js/xfa_expression.cpp
@@ -34,12 +34,12 @@ CXFA_FMFunctionDefinition::CXFA_FMFunctionDefinition(
uint32_t line,
bool isGlobal,
const CFX_WideStringC& wsName,
- std::unique_ptr<CFX_WideStringCArray> pArguments,
- std::vector<std::unique_ptr<CXFA_FMExpression>>&& pExpressions)
+ std::vector<CFX_WideStringC>&& arguments,
+ std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions)
: CXFA_FMExpression(line, XFA_FM_EXPTYPE_FUNC),
m_wsName(wsName),
- m_pArguments(std::move(pArguments)),
- m_pExpressions(std::move(pExpressions)),
+ m_pArguments(std::move(arguments)),
+ m_pExpressions(std::move(expressions)),
m_isGlobal(isGlobal) {}
CXFA_FMFunctionDefinition::~CXFA_FMFunctionDefinition() {}
@@ -60,21 +60,18 @@ void CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << m_wsName;
}
javascript << FX_WSTRC(L"(");
- if (m_pArguments != 0) {
- CFX_WideStringC identifier = 0;
- for (int i = 0; i < m_pArguments->GetSize(); ++i) {
- identifier = m_pArguments->GetAt(i);
- if (identifier.GetAt(0) == L'!') {
- CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1);
- javascript << tempIdentifier;
- } else {
- javascript << identifier;
- }
- if (i + 1 < m_pArguments->GetSize()) {
- javascript << FX_WSTRC(L", ");
- }
+ bool bNeedComma = false;
+ for (const auto& identifier : m_pArguments) {
+ if (bNeedComma)
+ javascript << FX_WSTRC(L", ");
+ if (identifier.GetAt(0) == L'!') {
+ CFX_WideString tempIdentifier =
+ EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1);
+ javascript << tempIdentifier;
+ } else {
+ javascript << identifier;
}
+ bNeedComma = true;
}
javascript << FX_WSTRC(L")\n{\n");
javascript << FX_WSTRC(L"var ");
« no previous file with comments | « xfa/fxfa/fm2js/xfa_expression.h ('k') | xfa/fxfa/fm2js/xfa_fmparse.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698