diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-19 18:07:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-19 18:07:11 -0700 |
commit | fc2cdf8657534467fd807e216d50650b0e959868 (patch) | |
tree | a0642ba14ee4e438e97957825772e8dd16e347a2 /xfa/fxfa/parser/xfa_layout_itemlayout.cpp | |
parent | 411f1185f44b7862a9b1c16e588407ae197752dd (diff) | |
download | pdfium-fc2cdf8657534467fd807e216d50650b0e959868.tar.xz |
fgas/ code cleanup.
This CL shuffles code around in the fgas/ headers, removes unused functions
and adds anonymous namepaces for static methods and data.
Review-Url: https://codereview.chromium.org/1992033002
Diffstat (limited to 'xfa/fxfa/parser/xfa_layout_itemlayout.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index ef2df840c9..8b85ba8075 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -9,7 +9,6 @@ #include <algorithm> #include <memory> -#include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/cxfa_occur.h" @@ -25,6 +24,34 @@ #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" +namespace { + +int32_t SeparateStringW(const FX_WCHAR* pStr, + int32_t iStrLen, + FX_WCHAR delimiter, + CFX_WideStringArray& pieces) { + if (!pStr) + return 0; + if (iStrLen < 0) + iStrLen = FXSYS_wcslen(pStr); + + const FX_WCHAR* pToken = pStr; + const FX_WCHAR* pEnd = pStr + iStrLen; + while (TRUE) { + if (pStr >= pEnd || delimiter == *pStr) { + CFX_WideString sub(pToken, pStr - pToken); + pieces.Add(sub); + pToken = pStr + 1; + if (pStr >= pEnd) + break; + } + pStr++; + } + return pieces.GetSize(); +} + +} // namespace + CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr) : m_bKeepBreakFinish(FALSE), @@ -1380,8 +1407,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { CFX_WideStringC wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { CFX_WideStringArray widths; - if (FX_SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), - L' ', widths) > 0) { + if (SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), + L' ', widths) > 0) { int32_t iCols = widths.GetSize(); CFX_WideString wsWidth; for (int32_t i = 0; i < iCols; i++) { |