From 6fcea1f851880b452bbaaeeeefefa48b49cab331 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 13 Mar 2017 13:06:05 -0400 Subject: 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 Reviewed-by: Tom Sepez --- xfa/fgas/layout/fgas_textbreak.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'xfa/fgas/layout/fgas_textbreak.h') 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* m_pChars; }; -typedef CFX_BaseArrayTemplate 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(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 m_LineChars; - CFX_TxtPieceArray m_LinePieces; + std::vector m_LinePieces; int32_t m_iStart; int32_t m_iWidth; int32_t m_iArabicChars; -- cgit v1.2.3