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_CSSDATATABLE_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSDATATABLE_H_ |
8 #define XFA_FDE_CSS_FDE_CSSDATATABLE_H_ | 8 #define XFA_FDE_CSS_FDE_CSSDATATABLE_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_system.h" | 10 #include "core/fxcrt/include/fx_system.h" |
11 #include "xfa/fde/css/fde_css.h" | 11 #include "xfa/fde/css/fde_css.h" |
12 #include "xfa/fgas/crt/fgas_memory.h" | 12 #include "xfa/fgas/crt/fgas_memory.h" |
13 | 13 |
14 class CFDE_CSSFunction : public CFX_Target { | 14 class CFDE_CSSFunction : public CFX_Target { |
15 public: | 15 public: |
16 CFDE_CSSFunction(const FX_WCHAR* pszFuncName, IFDE_CSSValueList* pArgList) | 16 CFDE_CSSFunction(const FX_WCHAR* pszFuncName, IFDE_CSSValueList* pArgList) |
17 : m_pArgList(pArgList), m_pszFuncName(pszFuncName) { | 17 : m_pArgList(pArgList), m_pszFuncName(pszFuncName) { |
18 ASSERT(pArgList != NULL); | 18 ASSERT(pArgList); |
19 } | 19 } |
20 int32_t CountArgs() const { return m_pArgList->CountValues(); } | 20 int32_t CountArgs() const { return m_pArgList->CountValues(); } |
21 IFDE_CSSValue* GetArgs(int32_t index) const { | 21 IFDE_CSSValue* GetArgs(int32_t index) const { |
22 return m_pArgList->GetValue(index); | 22 return m_pArgList->GetValue(index); |
23 } | 23 } |
24 const FX_WCHAR* GetFuncName() const { return m_pszFuncName; } | 24 const FX_WCHAR* GetFuncName() const { return m_pszFuncName; } |
25 | 25 |
26 protected: | 26 protected: |
27 IFDE_CSSValueList* m_pArgList; | 27 IFDE_CSSValueList* m_pArgList; |
28 const FX_WCHAR* m_pszFuncName; | 28 const FX_WCHAR* m_pszFuncName; |
29 }; | 29 }; |
30 class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, | 30 class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, |
31 public CFX_Target { | 31 public CFX_Target { |
32 public: | 32 public: |
33 CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src) { *this = src; } | 33 CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src) { *this = src; } |
34 CFDE_CSSPrimitiveValue(FX_ARGB color) | 34 CFDE_CSSPrimitiveValue(FX_ARGB color) |
35 : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {} | 35 : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {} |
36 CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue) | 36 CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue) |
37 : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {} | 37 : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {} |
38 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue) | 38 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue) |
39 : m_eType(eType), m_fNumber(fValue) {} | 39 : m_eType(eType), m_fNumber(fValue) {} |
40 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue) | 40 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue) |
41 : m_eType(eType), m_pString(pValue) { | 41 : m_eType(eType), m_pString(pValue) { |
42 ASSERT(m_pString != NULL); | 42 ASSERT(m_pString); |
43 } | 43 } |
44 CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) | 44 CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) |
45 : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {} | 45 : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {} |
46 | 46 |
47 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const { return m_eType; } | 47 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const { return m_eType; } |
48 | 48 |
49 virtual FX_ARGB GetRGBColor() const { | 49 virtual FX_ARGB GetRGBColor() const { |
50 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB); | 50 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB); |
51 return m_dwColor; | 51 return m_dwColor; |
52 } | 52 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 IFDE_CSSValue** m_ppList; | 102 IFDE_CSSValue** m_ppList; |
103 int32_t m_iCount; | 103 int32_t m_iCount; |
104 }; | 104 }; |
105 class CFDE_CSSValueListParser : public CFX_Target { | 105 class CFDE_CSSValueListParser : public CFX_Target { |
106 public: | 106 public: |
107 CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator) | 107 CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator) |
108 : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { | 108 : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { |
109 ASSERT(psz != NULL && iLen > 0); | 109 ASSERT(psz && iLen > 0); |
110 } | 110 } |
111 FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType, | 111 FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType, |
112 const FX_WCHAR*& pStart, | 112 const FX_WCHAR*& pStart, |
113 int32_t& iLength); | 113 int32_t& iLength); |
114 FX_WCHAR m_Separator; | 114 FX_WCHAR m_Separator; |
115 | 115 |
116 protected: | 116 protected: |
117 int32_t SkipTo(FX_WCHAR wch, | 117 int32_t SkipTo(FX_WCHAR wch, |
118 FX_BOOL bWSSeparator = FALSE, | 118 FX_BOOL bWSSeparator = FALSE, |
119 FX_BOOL bBrContinue = FALSE); | 119 FX_BOOL bBrContinue = FALSE); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 int32_t& iLength); | 191 int32_t& iLength); |
192 FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, | 192 FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, |
193 int32_t iValueLen, | 193 int32_t iValueLen, |
194 FX_ARGB& dwColor); | 194 FX_ARGB& dwColor); |
195 FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, | 195 FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, |
196 int32_t iValueLen, | 196 int32_t iValueLen, |
197 int32_t& iOffset, | 197 int32_t& iOffset, |
198 int32_t& iLength); | 198 int32_t& iLength); |
199 | 199 |
200 #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_ | 200 #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_ |
OLD | NEW |