From 0e3a4ffcd73dab2a7d5534b7b97cb5e0a0a2edf9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 5 Sep 2017 11:59:28 -0400 Subject: Remove unused CFX_CharIter class The CFX_CharIter class was only used in a single Attach call of CFX_WordBreak which is never called. Removed. Change-Id: I8262cbb25d341b976ab85095250357fecba48fbc Reviewed-on: https://pdfium-review.googlesource.com/13091 Reviewed-by: Ryan Harrison Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- BUILD.gn | 2 -- core/fxcrt/cfx_chariter.cpp | 54 -------------------------------------------- core/fxcrt/cfx_chariter.h | 33 --------------------------- core/fxcrt/cfx_wordbreak.cpp | 6 +---- core/fxcrt/cfx_wordbreak.h | 1 - 5 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 core/fxcrt/cfx_chariter.cpp delete mode 100644 core/fxcrt/cfx_chariter.h diff --git a/BUILD.gn b/BUILD.gn index 2d226da0d5..3d3917fe70 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -889,8 +889,6 @@ static_library("fxcrt") { "core/fxcrt/cfx_blockbuffer.h", "core/fxcrt/cfx_char.cpp", "core/fxcrt/cfx_char.h", - "core/fxcrt/cfx_chariter.cpp", - "core/fxcrt/cfx_chariter.h", "core/fxcrt/cfx_checksumcontext.cpp", "core/fxcrt/cfx_checksumcontext.h", "core/fxcrt/cfx_crtfileaccess.cpp", diff --git a/core/fxcrt/cfx_chariter.cpp b/core/fxcrt/cfx_chariter.cpp deleted file mode 100644 index 827e86967d..0000000000 --- a/core/fxcrt/cfx_chariter.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxcrt/cfx_chariter.h" - -#include "third_party/base/ptr_util.h" - -CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText) - : m_wsText(wsText), m_nIndex(0) { - ASSERT(!wsText.IsEmpty()); -} - -CFX_CharIter::~CFX_CharIter() {} - -bool CFX_CharIter::Next(bool bPrev) { - if (bPrev) { - if (m_nIndex <= 0) - return false; - m_nIndex--; - } else { - if (static_cast(m_nIndex + 1) >= m_wsText.GetLength()) - return false; - m_nIndex++; - } - return true; -} - -wchar_t CFX_CharIter::GetChar() const { - return m_wsText[m_nIndex]; -} - -void CFX_CharIter::SetAt(int32_t nIndex) { - if (nIndex < 0 || static_cast(nIndex) >= m_wsText.GetLength()) - return; - m_nIndex = nIndex; -} - -int32_t CFX_CharIter::GetAt() const { - return m_nIndex; -} - -bool CFX_CharIter::IsEOF(bool bTail) const { - return bTail ? (static_cast(m_nIndex + 1) == m_wsText.GetLength()) - : (m_nIndex == 0); -} - -std::unique_ptr CFX_CharIter::Clone() const { - auto pIter = pdfium::MakeUnique(m_wsText); - pIter->m_nIndex = m_nIndex; - return pIter; -} diff --git a/core/fxcrt/cfx_chariter.h b/core/fxcrt/cfx_chariter.h deleted file mode 100644 index 523ea5a75b..0000000000 --- a/core/fxcrt/cfx_chariter.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXCRT_CFX_CHARITER_H_ -#define CORE_FXCRT_CFX_CHARITER_H_ - -#include - -#include "core/fxcrt/fx_string.h" -#include "core/fxcrt/fx_system.h" -#include "core/fxcrt/ifx_chariter.h" - -class CFX_CharIter : public IFX_CharIter { - public: - explicit CFX_CharIter(const CFX_WideString& wsText); - ~CFX_CharIter() override; - - bool Next(bool bPrev = false) override; - wchar_t GetChar() const override; - void SetAt(int32_t nIndex) override; - int32_t GetAt() const override; - bool IsEOF(bool bTail = true) const override; - std::unique_ptr Clone() const override; - - private: - const CFX_WideString& m_wsText; - int32_t m_nIndex; -}; - -#endif // CORE_FXCRT_CFX_CHARITER_H_ diff --git a/core/fxcrt/cfx_wordbreak.cpp b/core/fxcrt/cfx_wordbreak.cpp index 2a31181403..975dd113c1 100644 --- a/core/fxcrt/cfx_wordbreak.cpp +++ b/core/fxcrt/cfx_wordbreak.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/cfx_chariter.h" +#include "core/fxcrt/ifx_chariter.h" #include "third_party/base/ptr_util.h" namespace { @@ -2788,10 +2788,6 @@ void CFX_WordBreak::Attach(IFX_CharIter* pIter) { m_pCurIter.reset(pIter); } -void CFX_WordBreak::Attach(const CFX_WideString& wsText) { - m_pCurIter = pdfium::MakeUnique(wsText); -} - bool CFX_WordBreak::Next(bool bPrev) { std::unique_ptr pIter = (bPrev ? m_pPreIter : m_pCurIter)->Clone(); diff --git a/core/fxcrt/cfx_wordbreak.h b/core/fxcrt/cfx_wordbreak.h index 4a7d925ec6..4550fcac7c 100644 --- a/core/fxcrt/cfx_wordbreak.h +++ b/core/fxcrt/cfx_wordbreak.h @@ -20,7 +20,6 @@ class CFX_WordBreak { ~CFX_WordBreak(); void Attach(IFX_CharIter* pIter); - void Attach(const CFX_WideString& wsText); bool Next(bool bPrev); void SetAt(int32_t nIndex); int32_t GetWordPos() const; -- cgit v1.2.3