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

Side by Side Diff: xfa/fxfa/parser/xfa_utils.h

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « xfa/fxfa/parser/xfa_resolvenode_rs.h ('k') | xfa/fxfa/parser/xfa_utils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_FXFA_PARSER_XFA_UTILS_H_ 7 #ifndef XFA_FXFA_PARSER_XFA_UTILS_H_
8 #define XFA_FXFA_PARSER_XFA_UTILS_H_ 8 #define XFA_FXFA_PARSER_XFA_UTILS_H_
9 9
10 #include "xfa/fde/xml/fde_xml.h" 10 #include "xfa/fde/xml/fde_xml.h"
11 #include "xfa/fgas/crt/fgas_stream.h" 11 #include "xfa/fgas/crt/fgas_stream.h"
12 #include "xfa/fgas/crt/fgas_utils.h" 12 #include "xfa/fgas/crt/fgas_utils.h"
13 #include "xfa/fxfa/fxfa_basic.h" 13 #include "xfa/fxfa/fxfa_basic.h"
14 14
15 class CFDE_XMLElement; 15 class CFDE_XMLElement;
16 class CFDE_XMLNode; 16 class CFDE_XMLNode;
17 class CXFA_LocaleValue; 17 class CXFA_LocaleValue;
18 class CXFA_Node; 18 class CXFA_Node;
19 class CXFA_WidgetData; 19 class CXFA_WidgetData;
20 20
21 FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( 21 bool XFA_FDEExtension_ResolveNamespaceQualifier(
22 CFDE_XMLElement* pNode, 22 CFDE_XMLElement* pNode,
23 const CFX_WideStringC& wsQualifier, 23 const CFX_WideStringC& wsQualifier,
24 CFX_WideString& wsNamespaceURI); 24 CFX_WideString& wsNamespaceURI);
25 25
26 template <class NodeType, class TraverseStrategy> 26 template <class NodeType, class TraverseStrategy>
27 class CXFA_NodeIteratorTemplate { 27 class CXFA_NodeIteratorTemplate {
28 public: 28 public:
29 CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr) 29 CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr)
30 : m_pRoot(pRootNode), m_NodeStack(100) { 30 : m_pRoot(pRootNode), m_NodeStack(100) {
31 if (pRootNode) { 31 if (pRootNode) {
32 m_NodeStack.Push(pRootNode); 32 m_NodeStack.Push(pRootNode);
33 } 33 }
34 } 34 }
35 FX_BOOL Init(NodeType* pRootNode) { 35 bool Init(NodeType* pRootNode) {
36 if (!pRootNode) { 36 if (!pRootNode) {
37 return FALSE; 37 return false;
38 } 38 }
39 m_pRoot = pRootNode; 39 m_pRoot = pRootNode;
40 m_NodeStack.RemoveAll(FALSE); 40 m_NodeStack.RemoveAll(false);
41 m_NodeStack.Push(pRootNode); 41 m_NodeStack.Push(pRootNode);
42 return TRUE; 42 return true;
43 } 43 }
44 void Clear() { m_NodeStack.RemoveAll(FALSE); } 44 void Clear() { m_NodeStack.RemoveAll(false); }
45 void Reset() { 45 void Reset() {
46 Clear(); 46 Clear();
47 if (m_pRoot) { 47 if (m_pRoot) {
48 m_NodeStack.Push(m_pRoot); 48 m_NodeStack.Push(m_pRoot);
49 } 49 }
50 } 50 }
51 FX_BOOL SetCurrent(NodeType* pCurNode) { 51 bool SetCurrent(NodeType* pCurNode) {
52 m_NodeStack.RemoveAll(FALSE); 52 m_NodeStack.RemoveAll(false);
53 if (pCurNode) { 53 if (pCurNode) {
54 CFX_StackTemplate<NodeType*> revStack(100); 54 CFX_StackTemplate<NodeType*> revStack(100);
55 NodeType* pNode; 55 NodeType* pNode;
56 for (pNode = pCurNode; pNode && pNode != m_pRoot; 56 for (pNode = pCurNode; pNode && pNode != m_pRoot;
57 pNode = TraverseStrategy::GetParent(pNode)) { 57 pNode = TraverseStrategy::GetParent(pNode)) {
58 revStack.Push(pNode); 58 revStack.Push(pNode);
59 } 59 }
60 if (!pNode) { 60 if (!pNode) {
61 return FALSE; 61 return false;
62 } 62 }
63 revStack.Push(m_pRoot); 63 revStack.Push(m_pRoot);
64 while (revStack.GetSize()) { 64 while (revStack.GetSize()) {
65 m_NodeStack.Push(*revStack.GetTopElement()); 65 m_NodeStack.Push(*revStack.GetTopElement());
66 revStack.Pop(); 66 revStack.Pop();
67 } 67 }
68 } 68 }
69 return TRUE; 69 return true;
70 } 70 }
71 NodeType* GetCurrent() const { 71 NodeType* GetCurrent() const {
72 return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : nullptr; 72 return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : nullptr;
73 } 73 }
74 NodeType* GetRoot() const { return m_pRoot; } 74 NodeType* GetRoot() const { return m_pRoot; }
75 NodeType* MoveToPrev() { 75 NodeType* MoveToPrev() {
76 int32_t nStackLength = m_NodeStack.GetSize(); 76 int32_t nStackLength = m_NodeStack.GetSize();
77 if (nStackLength == 1) { 77 if (nStackLength == 1) {
78 return nullptr; 78 return nullptr;
79 } else if (nStackLength > 1) { 79 } else if (nStackLength > 1) {
80 NodeType* pCurItem = *m_NodeStack.GetTopElement(); 80 NodeType* pCurItem = *m_NodeStack.GetTopElement();
81 m_NodeStack.Pop(); 81 m_NodeStack.Pop();
82 NodeType* pParentItem = *m_NodeStack.GetTopElement(); 82 NodeType* pParentItem = *m_NodeStack.GetTopElement();
83 NodeType* pParentFirstChildItem = 83 NodeType* pParentFirstChildItem =
84 TraverseStrategy::GetFirstChild(pParentItem); 84 TraverseStrategy::GetFirstChild(pParentItem);
85 if (pCurItem == pParentFirstChildItem) { 85 if (pCurItem == pParentFirstChildItem) {
86 return pParentItem; 86 return pParentItem;
87 } 87 }
88 NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = nullptr; 88 NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = nullptr;
89 for (; pPrevItem; pPrevItem = pPrevItemNext) { 89 for (; pPrevItem; pPrevItem = pPrevItemNext) {
90 pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem); 90 pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem);
91 if (!pPrevItemNext || pPrevItemNext == pCurItem) { 91 if (!pPrevItemNext || pPrevItemNext == pCurItem) {
92 break; 92 break;
93 } 93 }
94 } 94 }
95 m_NodeStack.Push(pPrevItem); 95 m_NodeStack.Push(pPrevItem);
96 } else { 96 } else {
97 m_NodeStack.RemoveAll(FALSE); 97 m_NodeStack.RemoveAll(false);
98 if (m_pRoot) { 98 if (m_pRoot) {
99 m_NodeStack.Push(m_pRoot); 99 m_NodeStack.Push(m_pRoot);
100 } 100 }
101 } 101 }
102 if (m_NodeStack.GetSize() > 0) { 102 if (m_NodeStack.GetSize() > 0) {
103 NodeType* pChildItem = *m_NodeStack.GetTopElement(); 103 NodeType* pChildItem = *m_NodeStack.GetTopElement();
104 while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) != 104 while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) !=
105 nullptr) { 105 nullptr) {
106 while (NodeType* pNextItem = 106 while (NodeType* pNextItem =
107 TraverseStrategy::GetNextSibling(pChildItem)) { 107 TraverseStrategy::GetNextSibling(pChildItem)) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 protected: 160 protected:
161 NodeType* m_pRoot; 161 NodeType* m_pRoot;
162 CFX_StackTemplate<NodeType*> m_NodeStack; 162 CFX_StackTemplate<NodeType*> m_NodeStack;
163 }; 163 };
164 164
165 CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData); 165 CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
166 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); 166 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
167 int32_t XFA_MapRotation(int32_t nRotation); 167 int32_t XFA_MapRotation(int32_t nRotation);
168 168
169 FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode); 169 bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode);
170 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, 170 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
171 CFX_WideString& wsPlainText); 171 CFX_WideString& wsPlainText);
172 FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); 172 bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);
173 173
174 void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); 174 void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
175 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, 175 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
176 IFX_Stream* pStream, 176 IFX_Stream* pStream,
177 const FX_CHAR* pChecksum = nullptr, 177 const FX_CHAR* pChecksum = nullptr,
178 FX_BOOL bSaveXML = FALSE); 178 bool bSaveXML = false);
179 179
180 const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( 180 const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(
181 XFA_Element eElement, 181 XFA_Element eElement,
182 XFA_ATTRIBUTE eAttribute, 182 XFA_ATTRIBUTE eAttribute,
183 XFA_ATTRIBUTETYPE eType = XFA_ATTRIBUTETYPE_NOTSURE); 183 XFA_ATTRIBUTETYPE eType = XFA_ATTRIBUTETYPE_NOTSURE);
184 184
185 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( 185 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
186 XFA_Element eElement, 186 XFA_Element eElement,
187 const CFX_WideStringC& wsAttributeName); 187 const CFX_WideStringC& wsAttributeName);
188 188
189 const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, 189 const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement,
190 XFA_Element eProperty, 190 XFA_Element eProperty,
191 uint32_t dwPacket); 191 uint32_t dwPacket);
192 const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, 192 const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement,
193 int32_t& iCount); 193 int32_t& iCount);
194 const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount); 194 const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount);
195 const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName); 195 const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName);
196 XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName); 196 XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName);
197 CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement, 197 CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
198 XFA_ATTRIBUTE eAttribute, 198 XFA_ATTRIBUTE eAttribute,
199 uint32_t dwPacket); 199 uint32_t dwPacket);
200 FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, 200 bool XFA_GetAttributeDefaultValue(void*& pValue,
201 XFA_Element eElement, 201 XFA_Element eElement,
202 XFA_ATTRIBUTE eAttribute, 202 XFA_ATTRIBUTE eAttribute,
203 XFA_ATTRIBUTETYPE eType, 203 XFA_ATTRIBUTETYPE eType,
204 uint32_t dwPacket); 204 uint32_t dwPacket);
205 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName); 205 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName);
206 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName); 206 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName);
207 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( 207 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(
208 const CFX_WideStringC& wsName); 208 const CFX_WideStringC& wsName);
209 const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket); 209 const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket);
210 const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket); 210 const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket);
211 211
212 #endif // XFA_FXFA_PARSER_XFA_UTILS_H_ 212 #endif // XFA_FXFA_PARSER_XFA_UTILS_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_resolvenode_rs.h ('k') | xfa/fxfa/parser/xfa_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698