From 28549c91b9fb7bdc637466218348b0759e251456 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 15 Aug 2017 11:29:16 -0400 Subject: Make GetChar & Clone const for IFX_CharIter BUG=pdfium:864 Change-Id: Iab03e1977c859f150452825650afed3520024cca Reviewed-on: https://pdfium-review.googlesource.com/11030 Reviewed-by: dsinclair Commit-Queue: Ryan Harrison --- core/fxcrt/cfx_chariter.cpp | 4 ++-- core/fxcrt/cfx_chariter.h | 4 ++-- core/fxcrt/ifx_chariter.h | 4 ++-- xfa/fde/cfde_txtedtbuf.cpp | 4 ++-- xfa/fde/cfde_txtedtbuf.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/fxcrt/cfx_chariter.cpp b/core/fxcrt/cfx_chariter.cpp index d26dd2df8f..db94fb09f4 100644 --- a/core/fxcrt/cfx_chariter.cpp +++ b/core/fxcrt/cfx_chariter.cpp @@ -28,7 +28,7 @@ bool CFX_CharIter::Next(bool bPrev) { return true; } -wchar_t CFX_CharIter::GetChar() { +wchar_t CFX_CharIter::GetChar() const { return m_wsText[m_nIndex]; } @@ -46,7 +46,7 @@ bool CFX_CharIter::IsEOF(bool bTail) const { return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0); } -std::unique_ptr CFX_CharIter::Clone() { +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 index 50fdde879f..523ea5a75b 100644 --- a/core/fxcrt/cfx_chariter.h +++ b/core/fxcrt/cfx_chariter.h @@ -19,11 +19,11 @@ class CFX_CharIter : public IFX_CharIter { ~CFX_CharIter() override; bool Next(bool bPrev = false) override; - wchar_t GetChar() 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() override; + std::unique_ptr Clone() const override; private: const CFX_WideString& m_wsText; diff --git a/core/fxcrt/ifx_chariter.h b/core/fxcrt/ifx_chariter.h index b8e240953a..e82cbbd040 100644 --- a/core/fxcrt/ifx_chariter.h +++ b/core/fxcrt/ifx_chariter.h @@ -16,11 +16,11 @@ class IFX_CharIter { virtual ~IFX_CharIter() {} virtual bool Next(bool bPrev = false) = 0; - virtual wchar_t GetChar() = 0; + virtual wchar_t GetChar() const = 0; virtual void SetAt(int32_t nIndex) = 0; virtual int32_t GetAt() const = 0; virtual bool IsEOF(bool bTail = true) const = 0; - virtual std::unique_ptr Clone() = 0; + virtual std::unique_ptr Clone() const = 0; }; #endif // CORE_FXCRT_IFX_CHARITER_H_ diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 101385b143..d0f41d8b9d 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -330,7 +330,7 @@ int32_t CFDE_TxtEdtBuf::Iterator::GetAt() const { return m_nIndex; } -wchar_t CFDE_TxtEdtBuf::Iterator::GetChar() { +wchar_t CFDE_TxtEdtBuf::Iterator::GetChar() const { ASSERT(m_nIndex >= 0 && m_nIndex < m_pBuf->m_nTotal); if (m_Alias == 0 || m_nIndex == (m_pBuf->m_nTotal - 1)) { wchar_t* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get(); @@ -343,7 +343,7 @@ bool CFDE_TxtEdtBuf::Iterator::IsEOF(bool bTail) const { return bTail ? m_nIndex == (m_pBuf->GetTextLength() - 2) : m_nIndex == 0; } -std::unique_ptr CFDE_TxtEdtBuf::Iterator::Clone() { +std::unique_ptr CFDE_TxtEdtBuf::Iterator::Clone() const { auto pIter = pdfium::MakeUnique(m_pBuf, 0); pIter->m_nCurChunk = m_nCurChunk; pIter->m_nCurIndex = m_nCurIndex; diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 3fbcd4b9d0..b500a9871e 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -23,13 +23,13 @@ class CFDE_TxtEdtBuf { ~Iterator() override; bool Next(bool bPrev = false) override; - wchar_t GetChar() 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() override; + std::unique_ptr Clone() const override; private: CFDE_TxtEdtBuf* m_pBuf; -- cgit v1.2.3