summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout/fgas_textbreak.h
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-03-13 12:08:31 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-13 16:28:00 +0000
commit8da79203b32d1a0df05a23da83044bdaf71c320d (patch)
tree8cbb0484f9e44a406c74e9b937c10b2afd248b76 /xfa/fgas/layout/fgas_textbreak.h
parent575898e6251c1dbb8de0d40a5b6ce90762aa2af2 (diff)
downloadpdfium-8da79203b32d1a0df05a23da83044bdaf71c320d.tar.xz
Simplify the CFX_TxtPiece class
This Cl removes unused methods and makes GetString return a CFX_WideString instead of taking an out parameter. Change-Id: I3d2fcbdf51e7619f4fa42e46a0c83fbfa1132a84 Reviewed-on: https://pdfium-review.googlesource.com/2950 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_textbreak.h')
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 1070a7bce4..513912d409 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -76,27 +76,18 @@ class CFX_TxtPiece {
return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
}
int32_t GetLength() const { return m_iChars; }
- int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
- CFX_TxtChar* GetCharPtr(int32_t index) const {
+
+ CFX_TxtChar& GetChar(int32_t index) const {
ASSERT(index > -1 && index < m_iChars && m_pChars);
- return &(*m_pChars)[m_iStartChar + index];
- }
- void GetString(FX_WCHAR* pText) const {
- ASSERT(pText);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pText++ = static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
+ return (*m_pChars)[m_iStartChar + index];
}
- void GetString(CFX_WideString& wsText) const {
- FX_WCHAR* pText = wsText.GetBuffer(m_iChars);
- GetString(pText);
- wsText.ReleaseBuffer(m_iChars);
- }
- void GetWidths(int32_t* pWidths) const {
- ASSERT(pWidths);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pWidths++ = (*m_pChars)[i].m_iCharWidth;
+
+ CFX_WideString GetString() const {
+ CFX_WideString ret;
+ ret.Reserve(m_iChars);
+ for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
+ ret += static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
+ return ret;
}
CFX_BreakType m_dwStatus;