From 51709bea3ce113df7d36a5fe6415036e26fc3236 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 8 Dec 2016 10:55:57 -0800 Subject: Replace CFX_WideStringArray with std::vector Minimalist changes with the tidying of the code to use better loop iterators as a follow-up. Review-Url: https://codereview.chromium.org/2556963004 --- xfa/fxfa/parser/xfa_localevalue.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/parser/xfa_localevalue.cpp') diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index c060fe8166..87961358e8 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -6,8 +6,11 @@ #include "xfa/fxfa/parser/xfa_localevalue.h" +#include + #include "core/fxcrt/fx_ext.h" #include "third_party/base/ptr_util.h" +#include "third_party/base/stl_util.h" #include "xfa/fgas/localization/fgas_localeimp.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" @@ -105,11 +108,11 @@ bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, m_pLocaleMgr->SetDefLocale(pLocale); auto pFormat = pdfium::MakeUnique(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, wsPatterns); bool bRet = false; - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(wsPatterns); int32_t i = 0; for (; i < iCount && !bRet; i++) { CFX_WideString wsFormat = wsPatterns[i]; @@ -464,10 +467,10 @@ bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const { auto pFormat = pdfium::MakeUnique(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsFormat, wsPatterns); wsResult.clear(); - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(wsPatterns); for (int32_t i = 0; i < iCount; i++) { if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType)) return true; @@ -793,10 +796,10 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, m_pLocaleMgr->SetDefLocale(pLocale); auto pFormat = pdfium::MakeUnique(m_pLocaleMgr, false); - CFX_WideStringArray wsPatterns; + std::vector wsPatterns; pFormat->SplitFormatString(wsPattern, wsPatterns); bool bRet = false; - int32_t iCount = wsPatterns.GetSize(); + int32_t iCount = pdfium::CollectionSize(wsPatterns); for (int32_t i = 0; i < iCount && !bRet; i++) { CFX_WideString wsFormat = wsPatterns[i]; FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); -- cgit v1.2.3