From 2326e9cdf4467d0a65471a64d3e66268810f62d8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 2 Mar 2017 15:31:04 -0800 Subject: Remove CFX_StackTemplate Change-Id: I2dbea7665b5fc2ca239ad2f75c91d4a1e0d522c7 Reviewed-on: https://pdfium-review.googlesource.com/2911 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fde/fde_iterator.cpp | 32 ++++++++++++++------------------ xfa/fde/fde_iterator.h | 4 +++- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp index 9ca02da6a0..9c1adf6e80 100644 --- a/xfa/fde/fde_iterator.cpp +++ b/xfa/fde/fde_iterator.cpp @@ -8,17 +8,14 @@ #include "xfa/fgas/crt/fgas_utils.h" -CFDE_VisualSetIterator::CFDE_VisualSetIterator() - : m_dwFilter(0), m_CanvasStack(100) {} +CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} -CFDE_VisualSetIterator::~CFDE_VisualSetIterator() { - m_CanvasStack.RemoveAll(false); -} +CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {} bool CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { ASSERT(pCanvas); + m_CanvasStack = std::stack(); - m_CanvasStack.RemoveAll(false); FDE_CANVASITEM canvas; canvas.hCanvas = nullptr; canvas.pCanvas = pCanvas; @@ -26,19 +23,20 @@ bool CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { if (!canvas.hPos) return false; - return m_CanvasStack.Push(canvas) == 0; + m_CanvasStack.push(canvas); + return true; } bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { - if (m_CanvasStack.GetSize() == 0) + if (m_CanvasStack.empty()) return false; - while (m_CanvasStack.GetSize() > 1) - m_CanvasStack.Pop(); + while (m_CanvasStack.size() > 1) + m_CanvasStack.pop(); m_dwFilter = dwObjects; - FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); + FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); ASSERT(pCanvas && pCanvas->pCanvas); pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(); @@ -53,15 +51,13 @@ FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( IFDE_VisualSet*& pVisualSet, FDE_TEXTEDITPIECE** phCanvasObj, IFDE_CanvasSet** ppCanvasSet) { - while (m_CanvasStack.GetSize() > 0) { - FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); - ASSERT(pCanvas && pCanvas->pCanvas); - + while (!m_CanvasStack.empty()) { + FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); if (!pCanvas->hPos) { - if (m_CanvasStack.GetSize() == 1) + if (m_CanvasStack.size() == 1) break; - m_CanvasStack.Pop(); + m_CanvasStack.pop(); continue; } do { @@ -75,7 +71,7 @@ FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( canvas.hCanvas = pObj; canvas.pCanvas = static_cast(pVisualSet); canvas.hPos = canvas.pCanvas->GetFirstPosition(); - m_CanvasStack.Push(canvas); + m_CanvasStack.push(canvas); break; } uint32_t dwObj = (uint32_t)eType; diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h index 45659ce87c..a2cd931e39 100644 --- a/xfa/fde/fde_iterator.h +++ b/xfa/fde/fde_iterator.h @@ -7,6 +7,8 @@ #ifndef XFA_FDE_FDE_ITERATOR_H_ #define XFA_FDE_FDE_ITERATOR_H_ +#include + #include "xfa/fde/fde_visualset.h" #include "xfa/fgas/crt/fgas_utils.h" @@ -31,7 +33,7 @@ class CFDE_VisualSetIterator { protected: uint32_t m_dwFilter; - CFX_StackTemplate m_CanvasStack; + std::stack m_CanvasStack; }; #endif // XFA_FDE_FDE_ITERATOR_H_ -- cgit v1.2.3