OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FDE_CSS_FDE_CSSSYNTAX_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSSYNTAX_H_ |
8 #define XFA_FDE_CSS_FDE_CSSSYNTAX_H_ | 8 #define XFA_FDE_CSS_FDE_CSSSYNTAX_H_ |
9 | 9 |
10 #include "xfa/fde/css/fde_css.h" | 10 #include "xfa/fde/css/fde_css.h" |
11 #include "xfa/fgas/crt/fgas_memory.h" | 11 #include "xfa/fgas/crt/fgas_memory.h" |
12 #include "xfa/fgas/crt/fgas_stream.h" | 12 #include "xfa/fgas/crt/fgas_stream.h" |
13 | 13 |
14 class CFDE_CSSTextBuf : public CFX_Target { | 14 class CFDE_CSSTextBuf : public CFX_Target { |
15 public: | 15 public: |
16 CFDE_CSSTextBuf(); | 16 CFDE_CSSTextBuf(); |
17 ~CFDE_CSSTextBuf() override; | 17 ~CFDE_CSSTextBuf() override; |
18 | 18 |
19 FX_BOOL AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); | 19 FX_BOOL AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); |
20 FX_BOOL EstimateSize(int32_t iAllocSize); | 20 FX_BOOL EstimateSize(int32_t iAllocSize); |
21 int32_t LoadFromStream(IFX_Stream* pTxtStream, | 21 int32_t LoadFromStream(IFX_Stream* pTxtStream, |
22 int32_t iStreamOffset, | 22 int32_t iStreamOffset, |
23 int32_t iMaxChars, | 23 int32_t iMaxChars, |
24 FX_BOOL& bEOS); | 24 FX_BOOL& bEOS); |
25 FX_BOOL AppendChar(FX_WCHAR wch) { | 25 bool AppendChar(FX_WCHAR wch) { |
26 if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) { | 26 if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) |
27 return FALSE; | 27 return false; |
28 } | 28 m_pBuffer[m_iDatLen++] = wch; |
29 return (m_pBuffer[m_iDatLen++] = wch), TRUE; | 29 return true; |
30 } | 30 } |
31 void Clear() { m_iDatPos = m_iDatLen = 0; } | 31 void Clear() { m_iDatPos = m_iDatLen = 0; } |
32 void Reset(); | 32 void Reset(); |
33 int32_t TrimEnd() { | 33 int32_t TrimEnd() { |
34 while (m_iDatLen > 0 && m_pBuffer[m_iDatLen - 1] <= ' ') { | 34 while (m_iDatLen > 0 && m_pBuffer[m_iDatLen - 1] <= ' ') { |
35 --m_iDatLen; | 35 --m_iDatLen; |
36 } | 36 } |
37 AppendChar(0); | 37 AppendChar(0); |
38 return --m_iDatLen; | 38 return --m_iDatLen; |
39 } | 39 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 CFDE_CSSTextBuf m_TextData; | 112 CFDE_CSSTextBuf m_TextData; |
113 CFDE_CSSTextBuf m_TextPlane; | 113 CFDE_CSSTextBuf m_TextPlane; |
114 int32_t m_iTextDatLen; | 114 int32_t m_iTextDatLen; |
115 uint32_t m_dwCheck; | 115 uint32_t m_dwCheck; |
116 FDE_CSSSYNTAXMODE m_eMode; | 116 FDE_CSSSYNTAXMODE m_eMode; |
117 FDE_CSSSYNTAXSTATUS m_eStatus; | 117 FDE_CSSSYNTAXSTATUS m_eStatus; |
118 CFX_StackTemplate<FDE_CSSSYNTAXMODE> m_ModeStack; | 118 CFX_StackTemplate<FDE_CSSSYNTAXMODE> m_ModeStack; |
119 }; | 119 }; |
120 | 120 |
121 #endif // XFA_FDE_CSS_FDE_CSSSYNTAX_H_ | 121 #endif // XFA_FDE_CSS_FDE_CSSSYNTAX_H_ |
OLD | NEW |