summaryrefslogtreecommitdiff
path: root/xfa/fde/cfx_chariter.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-18 11:09:47 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-18 11:09:47 -0700
commit653951828cf934afb48b57989089a99b38620d02 (patch)
tree8a91b6f3ffac3d992e47e5d6fd4da31245597ff9 /xfa/fde/cfx_chariter.cpp
parent3b093630d55ad97807bcc710227b03819944605b (diff)
downloadpdfium-653951828cf934afb48b57989089a99b38620d02.tar.xz
Split xfa/fee files into individual class files.
This CL splits the xfa/fee files into individual class files and moves them into the xfa/fde directory where they belong. Review-Url: https://codereview.chromium.org/1994693002
Diffstat (limited to 'xfa/fde/cfx_chariter.cpp')
-rw-r--r--xfa/fde/cfx_chariter.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/xfa/fde/cfx_chariter.cpp b/xfa/fde/cfx_chariter.cpp
new file mode 100644
index 0000000000..d51fb0868f
--- /dev/null
+++ b/xfa/fde/cfx_chariter.cpp
@@ -0,0 +1,51 @@
+// 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 "xfa/fde/cfx_chariter.h"
+
+CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText)
+ : m_wsText(wsText), m_nIndex(0) {
+ ASSERT(!wsText.IsEmpty());
+}
+
+CFX_CharIter::~CFX_CharIter() {}
+
+FX_BOOL CFX_CharIter::Next(FX_BOOL bPrev) {
+ if (bPrev) {
+ if (m_nIndex <= 0)
+ return FALSE;
+ m_nIndex--;
+ } else {
+ if (m_nIndex + 1 >= m_wsText.GetLength())
+ return FALSE;
+ m_nIndex++;
+ }
+ return TRUE;
+}
+
+FX_WCHAR CFX_CharIter::GetChar() {
+ return m_wsText.GetAt(m_nIndex);
+}
+
+void CFX_CharIter::SetAt(int32_t nIndex) {
+ if (nIndex < 0 || nIndex >= m_wsText.GetLength())
+ return;
+ m_nIndex = nIndex;
+}
+
+int32_t CFX_CharIter::GetAt() const {
+ return m_nIndex;
+}
+
+FX_BOOL CFX_CharIter::IsEOF(FX_BOOL bTail) const {
+ return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0);
+}
+
+IFX_CharIter* CFX_CharIter::Clone() {
+ CFX_CharIter* pIter = new CFX_CharIter(m_wsText);
+ pIter->m_nIndex = m_nIndex;
+ return pIter;
+}