diff options
author | tsepez <tsepez@chromium.org> | 2016-12-08 10:55:57 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-08 10:55:57 -0800 |
commit | 51709bea3ce113df7d36a5fe6415036e26fc3236 (patch) | |
tree | ff2cc5da9de834bda8cbc5c92d45c9a5c00b21c3 /xfa/fxfa/parser/xfa_layout_itemlayout.cpp | |
parent | 447b1f3ffc7e0df233d15300bbf8a85ce2bc7278 (diff) | |
download | pdfium-51709bea3ce113df7d36a5fe6415036e26fc3236.tar.xz |
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
Diffstat (limited to 'xfa/fxfa/parser/xfa_layout_itemlayout.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 6926a99309..45dc327710 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -8,7 +8,9 @@ #include <algorithm> #include <memory> +#include <vector> +#include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" @@ -25,7 +27,7 @@ namespace { int32_t SeparateStringW(const FX_WCHAR* pStr, int32_t iStrLen, FX_WCHAR delimiter, - CFX_WideStringArray& pieces) { + std::vector<CFX_WideString>& pieces) { if (!pStr) return 0; if (iStrLen < 0) @@ -35,15 +37,14 @@ int32_t SeparateStringW(const FX_WCHAR* pStr, const FX_WCHAR* pEnd = pStr + iStrLen; while (true) { if (pStr >= pEnd || delimiter == *pStr) { - CFX_WideString sub(pToken, pStr - pToken); - pieces.Add(sub); + pieces.push_back(CFX_WideString(pToken, pStr - pToken)); pToken = pStr + 1; if (pStr >= pEnd) break; } pStr++; } - return pieces.GetSize(); + return pdfium::CollectionSize<int32_t>(pieces); } } // namespace @@ -1401,10 +1402,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { : fContainerWidth - fLeftInset - fRightInset; CFX_WideStringC wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { - CFX_WideStringArray widths; + std::vector<CFX_WideString> widths; if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), L' ', widths) > 0) { - int32_t iCols = widths.GetSize(); + int32_t iCols = pdfium::CollectionSize<int32_t>(widths); CFX_WideString wsWidth; for (int32_t i = 0; i < iCols; i++) { wsWidth = widths[i]; |