summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssexttextbuf.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-06-26 15:28:15 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-30 18:51:27 +0000
commitf3024c3b1fbbfe442f93da3459ea79e817d5b8fe (patch)
tree86652e7b9fc74c60bb966883d02ea14ca0d2995b /xfa/fde/css/cfde_cssexttextbuf.h
parentd24236a926deeb8b9589c330c27dbd300b7f8c9d (diff)
downloadpdfium-f3024c3b1fbbfe442f93da3459ea79e817d5b8fe.tar.xz
Split CFDE_CSSTextBuf in two.
For the external buffer use case, use a CFDE_CSSExtTextBuf instead. With the split, both text buffer implementations are simpler now. As a result, it becomes obvious where it never fails. Adjust callers accordingly. Change-Id: I7b53d36593172487b8c939e6a55af2437ea4ee5a Reviewed-on: https://pdfium-review.googlesource.com/6932 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssexttextbuf.h')
-rw-r--r--xfa/fde/css/cfde_cssexttextbuf.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/xfa/fde/css/cfde_cssexttextbuf.h b/xfa/fde/css/cfde_cssexttextbuf.h
new file mode 100644
index 0000000000..0760182f25
--- /dev/null
+++ b/xfa/fde/css/cfde_cssexttextbuf.h
@@ -0,0 +1,34 @@
+// Copyright 2017 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 XFA_FDE_CSS_CFDE_CSSEXTTEXTBUF_H_
+#define XFA_FDE_CSS_CFDE_CSSEXTTEXTBUF_H_
+
+#include "core/fxcrt/fx_system.h"
+
+class CFDE_CSSExtTextBuf {
+ public:
+ CFDE_CSSExtTextBuf();
+ ~CFDE_CSSExtTextBuf();
+
+ void AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen);
+
+ bool IsEOF() const { return m_iDatPos >= m_iDatLen; }
+
+ wchar_t GetChar() const { return m_pExtBuffer[m_iDatPos]; }
+ wchar_t GetNextChar() const {
+ return (m_iDatPos + 1 >= m_iDatLen) ? 0 : m_pExtBuffer[m_iDatPos + 1];
+ }
+
+ void MoveNext() { m_iDatPos++; }
+
+ protected:
+ const wchar_t* m_pExtBuffer;
+ int32_t m_iDatLen;
+ int32_t m_iDatPos;
+};
+
+#endif // XFA_FDE_CSS_CFDE_CSSEXTTEXTBUF_H_