Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: xfa/fde/css/fde_cssdatatable.h

Issue 2072803002: Make code compile with clang_use_chrome_plugin (final) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: tidy Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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); 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
30 class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, 31 class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue,
31 public CFX_Target { 32 public CFX_Target {
32 public: 33 public:
33 CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src) { *this = src; } 34 explicit CFDE_CSSPrimitiveValue(FX_ARGB color);
34 CFDE_CSSPrimitiveValue(FX_ARGB color) 35 explicit CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue);
35 : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {} 36 explicit CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction);
36 CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue) 37 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue);
37 : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {} 38 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue);
38 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue) 39 CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src);
39 : m_eType(eType), m_fNumber(fValue) {}
40 CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue)
41 : m_eType(eType), m_pString(pValue) {
42 ASSERT(m_pString);
43 }
44 CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction)
45 : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {}
46 40
47 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const { return m_eType; } 41 // IFDE_CSSPrimitiveValue
42 FDE_CSSPRIMITIVETYPE GetPrimitiveType() const override;
48 43
49 virtual FX_ARGB GetRGBColor() const { 44 FX_ARGB GetRGBColor() const override;
50 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB); 45 FX_FLOAT GetFloat() const override;
51 return m_dwColor; 46 const FX_WCHAR* GetString(int32_t& iLength) const override;
52 } 47 FDE_CSSPROPERTYVALUE GetEnum() const override;
53 virtual FX_FLOAT GetFloat() const { 48 const FX_WCHAR* GetFuncName() const override;
54 ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_Number && 49 int32_t CountArgs() const override;
55 m_eType <= FDE_CSSPRIMITIVETYPE_PC); 50 IFDE_CSSValue* GetArgs(int32_t index) const override;
56 return m_fNumber;
57 }
58 virtual const FX_WCHAR* GetString(int32_t& iLength) const {
59 ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_String &&
60 m_eType <= FDE_CSSPRIMITIVETYPE_URI);
61 iLength = FXSYS_wcslen(m_pString);
62 return m_pString;
63 }
64 virtual FDE_CSSPROPERTYVALUE GetEnum() const {
65 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Enum);
66 return m_eEnum;
67 }
68 virtual const FX_WCHAR* GetFuncName() const {
69 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
70 return m_pFunction->GetFuncName();
71 }
72 virtual int32_t CountArgs() const {
73 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
74 return m_pFunction->CountArgs();
75 }
76 virtual IFDE_CSSValue* GetArgs(int32_t index) const {
77 ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function);
78 return m_pFunction->GetArgs(index);
79 }
80 51
81 FDE_CSSPRIMITIVETYPE m_eType; 52 FDE_CSSPRIMITIVETYPE m_eType;
82 union { 53 union {
83 FX_ARGB m_dwColor; 54 FX_ARGB m_dwColor;
84 FX_FLOAT m_fNumber; 55 FX_FLOAT m_fNumber;
85 const FX_WCHAR* m_pString; 56 const FX_WCHAR* m_pString;
86 FDE_CSSPROPERTYVALUE m_eEnum; 57 FDE_CSSPROPERTYVALUE m_eEnum;
87 CFDE_CSSFunction* m_pFunction; 58 CFDE_CSSFunction* m_pFunction;
88 }; 59 };
89 }; 60 };
61
90 typedef CFX_ArrayTemplate<IFDE_CSSPrimitiveValue*> CFDE_CSSPrimitiveArray; 62 typedef CFX_ArrayTemplate<IFDE_CSSPrimitiveValue*> CFDE_CSSPrimitiveArray;
91 typedef CFX_ArrayTemplate<IFDE_CSSValue*> CFDE_CSSValueArray; 63 typedef CFX_ArrayTemplate<IFDE_CSSValue*> CFDE_CSSValueArray;
64
92 class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target { 65 class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target {
93 public: 66 public:
94 CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, 67 CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore,
95 const CFDE_CSSValueArray& list); 68 const CFDE_CSSValueArray& list);
96 virtual int32_t CountValues() const { return m_iCount; } 69
97 virtual IFDE_CSSValue* GetValue(int32_t index) const { 70 // IFDE_CSSValueList
98 return m_ppList[index]; 71 int32_t CountValues() const override;
99 } 72 IFDE_CSSValue* GetValue(int32_t index) const override;
100 73
101 protected: 74 protected:
102 IFDE_CSSValue** m_ppList; 75 IFDE_CSSValue** m_ppList;
103 int32_t m_iCount; 76 int32_t m_iCount;
104 }; 77 };
78
105 class CFDE_CSSValueListParser : public CFX_Target { 79 class CFDE_CSSValueListParser : public CFX_Target {
106 public: 80 public:
107 CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator) 81 CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator)
108 : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { 82 : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) {
109 ASSERT(psz && iLen > 0); 83 ASSERT(psz && iLen > 0);
110 } 84 }
111 FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType, 85 FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType,
112 const FX_WCHAR*& pStart, 86 const FX_WCHAR*& pStart,
113 int32_t& iLength); 87 int32_t& iLength);
114 FX_WCHAR m_Separator; 88 FX_WCHAR m_Separator;
115 89
116 protected: 90 protected:
117 int32_t SkipTo(FX_WCHAR wch, 91 int32_t SkipTo(FX_WCHAR wch,
118 FX_BOOL bWSSeparator = FALSE, 92 FX_BOOL bWSSeparator = FALSE,
119 FX_BOOL bBrContinue = FALSE); 93 FX_BOOL bBrContinue = FALSE);
94
120 const FX_WCHAR* m_pCur; 95 const FX_WCHAR* m_pCur;
121 const FX_WCHAR* m_pEnd; 96 const FX_WCHAR* m_pEnd;
122 }; 97 };
123 98
124 #define FDE_CSSVALUETYPE_MaybeNumber 0x0100 99 #define FDE_CSSVALUETYPE_MaybeNumber 0x0100
125 #define FDE_CSSVALUETYPE_MaybeEnum 0x0200 100 #define FDE_CSSVALUETYPE_MaybeEnum 0x0200
126 #define FDE_CSSVALUETYPE_MaybeURI 0x0400 101 #define FDE_CSSVALUETYPE_MaybeURI 0x0400
127 #define FDE_CSSVALUETYPE_MaybeString 0x0800 102 #define FDE_CSSVALUETYPE_MaybeString 0x0800
128 #define FDE_CSSVALUETYPE_MaybeColor 0x1000 103 #define FDE_CSSVALUETYPE_MaybeColor 0x1000
129 #define FDE_CSSVALUETYPE_MaybeFunction 0x2000 104 #define FDE_CSSVALUETYPE_MaybeFunction 0x2000
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 int32_t& iLength); 166 int32_t& iLength);
192 FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, 167 FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue,
193 int32_t iValueLen, 168 int32_t iValueLen,
194 FX_ARGB& dwColor); 169 FX_ARGB& dwColor);
195 FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, 170 FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue,
196 int32_t iValueLen, 171 int32_t iValueLen,
197 int32_t& iOffset, 172 int32_t& iOffset,
198 int32_t& iLength); 173 int32_t& iLength);
199 174
200 #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_ 175 #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698