diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-03-13 13:06:05 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-13 17:26:01 +0000 |
commit | 6fcea1f851880b452bbaaeeeefefa48b49cab331 (patch) | |
tree | 88d4ad675466c98b5086efc8be69d981a02c5136 /xfa/fgas/layout/fgas_textbreak.h | |
parent | 8f03b422ed85180ac24fc76ba0fcf7de3556679f (diff) | |
download | pdfium-6fcea1f851880b452bbaaeeeefefa48b49cab331.tar.xz |
Convert TxtBreak line pieces to a vector.
This Cl converts the m_LinePieces array to a vector. This is the last
usage of the CFX_BaseArrayTemplate so remove it and supporting code.
Change-Id: I3f81e4fd1210f8d0347364a2e4e5bb42cd83cb30
Reviewed-on: https://pdfium-review.googlesource.com/2952
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_textbreak.h')
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 6d2582f4e1..aebb25ffa6 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -71,6 +71,8 @@ struct FX_TXTRUN { class CFX_TxtPiece { public: CFX_TxtPiece(); + CFX_TxtPiece(const CFX_TxtPiece& other); + ~CFX_TxtPiece(); int32_t GetEndPos() const { return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth; @@ -103,8 +105,6 @@ class CFX_TxtPiece { std::vector<CFX_TxtChar>* m_pChars; }; -typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray; - class CFX_TxtLine { public: CFX_TxtLine(); @@ -124,10 +124,13 @@ class CFX_TxtLine { return &m_LineChars[index]; } - int32_t CountPieces() const { return m_LinePieces.GetSize(); } - CFX_TxtPiece* GetPiecePtr(int32_t index) const { - ASSERT(index > -1 && index < m_LinePieces.GetSize()); - return m_LinePieces.GetPtrAt(index); + int32_t CountPieces() const { + return pdfium::CollectionSize<int32_t>(m_LinePieces); + } + + const CFX_TxtPiece* GetPiecePtr(int32_t index) const { + ASSERT(index >= 0 && index < CountPieces()); + return &m_LinePieces[index]; } void GetString(CFX_WideString& wsStr) const { @@ -138,15 +141,15 @@ class CFX_TxtLine { wsStr.ReleaseBuffer(iCount); } - void RemoveAll(bool bLeaveMemory = false) { + void Clear() { m_LineChars.clear(); - m_LinePieces.RemoveAll(bLeaveMemory); + m_LinePieces.clear(); m_iWidth = 0; m_iArabicChars = 0; } std::vector<CFX_TxtChar> m_LineChars; - CFX_TxtPieceArray m_LinePieces; + std::vector<CFX_TxtPiece> m_LinePieces; int32_t m_iStart; int32_t m_iWidth; int32_t m_iArabicChars; |