summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_csstextbuf.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_csstextbuf.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_csstextbuf.h')
-rw-r--r--xfa/fde/css/cfde_csstextbuf.h29
1 files changed, 5 insertions, 24 deletions
diff --git a/xfa/fde/css/cfde_csstextbuf.h b/xfa/fde/css/cfde_csstextbuf.h
index be6800fe3a..b2c17c95f8 100644
--- a/xfa/fde/css/cfde_csstextbuf.h
+++ b/xfa/fde/css/cfde_csstextbuf.h
@@ -7,9 +7,6 @@
#ifndef XFA_FDE_CSS_CFDE_CSSTEXTBUF_H_
#define XFA_FDE_CSS_CFDE_CSSTEXTBUF_H_
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_seekablestreamproxy.h"
-#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_system.h"
class CFDE_CSSTextBuf {
@@ -17,38 +14,22 @@ class CFDE_CSSTextBuf {
CFDE_CSSTextBuf();
~CFDE_CSSTextBuf();
- void AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen);
- bool EstimateSize(int32_t iAllocSize);
- bool AppendChar(wchar_t wch);
+ void InitWithSize(int32_t iAllocSize);
+ void AppendChar(wchar_t wch);
- void Clear() { m_iDatPos = m_iDatLen = 0; }
- void Reset();
+ void Clear() { m_iDatLen = 0; }
int32_t TrimEnd();
- void Subtract(int32_t iStart, int32_t iLength);
- bool IsEOF() const { return m_iDatPos >= m_iDatLen; }
-
- wchar_t GetAt(int32_t index) const { return GetBuffer()[index]; }
- wchar_t GetChar() const { return GetBuffer()[m_iDatPos]; }
- wchar_t GetNextChar() const {
- return (m_iDatPos + 1 >= m_iDatLen) ? 0 : GetBuffer()[m_iDatPos + 1];
- }
-
- void MoveNext() { m_iDatPos++; }
-
int32_t GetLength() const { return m_iDatLen; }
- const wchar_t* GetBuffer() const;
+ const wchar_t* GetBuffer() const { return m_pBuffer; }
protected:
- bool ExpandBuf(int32_t iDesiredSize);
+ void ExpandBuf(int32_t iDesiredSize);
- bool m_bExtBuf;
- const wchar_t* m_pExtBuffer;
wchar_t* m_pBuffer;
int32_t m_iBufLen;
int32_t m_iDatLen;
- int32_t m_iDatPos;
};
#endif // XFA_FDE_CSS_CFDE_CSSTEXTBUF_H_