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

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

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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
« no previous file with comments | « xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_utils_imp.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"
(...skipping 14 matching lines...) Expand all
25 return c >= '0' && c <= '9'; 25 return c >= '0' && c <= '9';
26 } 26 }
27 27
28 FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( 28 FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier(
29 CFDE_XMLElement* pNode, 29 CFDE_XMLElement* pNode,
30 const CFX_WideStringC& wsQualifier, 30 const CFX_WideStringC& wsQualifier,
31 CFX_WideString& wsNamespaceURI); 31 CFX_WideString& wsNamespaceURI);
32 template <class NodeType, class TraverseStrategy> 32 template <class NodeType, class TraverseStrategy>
33 class CXFA_NodeIteratorTemplate { 33 class CXFA_NodeIteratorTemplate {
34 public: 34 public:
35 CXFA_NodeIteratorTemplate(NodeType* pRootNode = NULL) : m_pRoot(pRootNode) { 35 CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr)
36 : m_pRoot(pRootNode) {
36 if (pRootNode) { 37 if (pRootNode) {
37 m_NodeStack.Push(pRootNode); 38 m_NodeStack.Push(pRootNode);
38 } 39 }
39 } 40 }
40 FX_BOOL Init(NodeType* pRootNode) { 41 FX_BOOL Init(NodeType* pRootNode) {
41 if (!pRootNode) { 42 if (!pRootNode) {
42 return FALSE; 43 return FALSE;
43 } 44 }
44 m_pRoot = pRootNode; 45 m_pRoot = pRootNode;
45 m_NodeStack.RemoveAll(); 46 m_NodeStack.RemoveAll();
(...skipping 21 matching lines...) Expand all
67 } 68 }
68 revStack.Push(m_pRoot); 69 revStack.Push(m_pRoot);
69 while (revStack.GetSize()) { 70 while (revStack.GetSize()) {
70 m_NodeStack.Push(*revStack.GetTopElement()); 71 m_NodeStack.Push(*revStack.GetTopElement());
71 revStack.Pop(); 72 revStack.Pop();
72 } 73 }
73 } 74 }
74 return TRUE; 75 return TRUE;
75 } 76 }
76 NodeType* GetCurrent() const { 77 NodeType* GetCurrent() const {
77 return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : NULL; 78 return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : nullptr;
78 } 79 }
79 NodeType* GetRoot() const { return m_pRoot; } 80 NodeType* GetRoot() const { return m_pRoot; }
80 NodeType* MoveToPrev() { 81 NodeType* MoveToPrev() {
81 int32_t nStackLength = m_NodeStack.GetSize(); 82 int32_t nStackLength = m_NodeStack.GetSize();
82 if (nStackLength == 1) { 83 if (nStackLength == 1) {
83 return NULL; 84 return nullptr;
84 } else if (nStackLength > 1) { 85 } else if (nStackLength > 1) {
85 NodeType* pCurItem = *m_NodeStack.GetTopElement(); 86 NodeType* pCurItem = *m_NodeStack.GetTopElement();
86 m_NodeStack.Pop(); 87 m_NodeStack.Pop();
87 NodeType* pParentItem = *m_NodeStack.GetTopElement(); 88 NodeType* pParentItem = *m_NodeStack.GetTopElement();
88 NodeType* pParentFirstChildItem = 89 NodeType* pParentFirstChildItem =
89 TraverseStrategy::GetFirstChild(pParentItem); 90 TraverseStrategy::GetFirstChild(pParentItem);
90 if (pCurItem == pParentFirstChildItem) { 91 if (pCurItem == pParentFirstChildItem) {
91 return pParentItem; 92 return pParentItem;
92 } 93 }
93 NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = NULL; 94 NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = nullptr;
94 for (; pPrevItem; pPrevItem = pPrevItemNext) { 95 for (; pPrevItem; pPrevItem = pPrevItemNext) {
95 pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem); 96 pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem);
96 if (!pPrevItemNext || pPrevItemNext == pCurItem) { 97 if (!pPrevItemNext || pPrevItemNext == pCurItem) {
97 break; 98 break;
98 } 99 }
99 } 100 }
100 m_NodeStack.Push(pPrevItem); 101 m_NodeStack.Push(pPrevItem);
101 } else { 102 } else {
102 m_NodeStack.RemoveAll(); 103 m_NodeStack.RemoveAll();
103 if (m_pRoot) { 104 if (m_pRoot) {
104 m_NodeStack.Push(m_pRoot); 105 m_NodeStack.Push(m_pRoot);
105 } 106 }
106 } 107 }
107 if (m_NodeStack.GetSize() > 0) { 108 if (m_NodeStack.GetSize() > 0) {
108 NodeType* pChildItem = *m_NodeStack.GetTopElement(); 109 NodeType* pChildItem = *m_NodeStack.GetTopElement();
109 while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) != 110 while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) !=
110 NULL) { 111 nullptr) {
111 while (NodeType* pNextItem = 112 while (NodeType* pNextItem =
112 TraverseStrategy::GetNextSibling(pChildItem)) { 113 TraverseStrategy::GetNextSibling(pChildItem)) {
113 pChildItem = pNextItem; 114 pChildItem = pNextItem;
114 } 115 }
115 m_NodeStack.Push(pChildItem); 116 m_NodeStack.Push(pChildItem);
116 } 117 }
117 return *m_NodeStack.GetTopElement(); 118 return *m_NodeStack.GetTopElement();
118 } 119 }
119 return NULL; 120 return nullptr;
120 } 121 }
121 NodeType* MoveToNext() { 122 NodeType* MoveToNext() {
122 NodeType** ppNode = NULL; 123 NodeType** ppNode = nullptr;
123 NodeType* pCurrent = GetCurrent(); 124 NodeType* pCurrent = GetCurrent();
124 while (m_NodeStack.GetSize() > 0) { 125 while (m_NodeStack.GetSize() > 0) {
125 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { 126 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
126 if (pCurrent != *ppNode) { 127 if (pCurrent != *ppNode) {
127 return *ppNode; 128 return *ppNode;
128 } 129 }
129 NodeType* pChild = TraverseStrategy::GetFirstChild(*ppNode); 130 NodeType* pChild = TraverseStrategy::GetFirstChild(*ppNode);
130 if (pChild == NULL) { 131 if (!pChild) {
131 break; 132 break;
132 } 133 }
133 m_NodeStack.Push(pChild); 134 m_NodeStack.Push(pChild);
134 } 135 }
135 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { 136 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
136 NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); 137 NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode);
137 m_NodeStack.Pop(); 138 m_NodeStack.Pop();
138 if (m_NodeStack.GetSize() == 0) { 139 if (m_NodeStack.GetSize() == 0) {
139 break; 140 break;
140 } 141 }
141 if (pNext) { 142 if (pNext) {
142 m_NodeStack.Push(pNext); 143 m_NodeStack.Push(pNext);
143 break; 144 break;
144 } 145 }
145 } 146 }
146 } 147 }
147 return NULL; 148 return nullptr;
148 } 149 }
149 NodeType* SkipChildrenAndMoveToNext() { 150 NodeType* SkipChildrenAndMoveToNext() {
150 NodeType** ppNode = nullptr; 151 NodeType** ppNode = nullptr;
151 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { 152 while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
152 NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); 153 NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode);
153 m_NodeStack.Pop(); 154 m_NodeStack.Pop();
154 if (m_NodeStack.GetSize() == 0) { 155 if (m_NodeStack.GetSize() == 0) {
155 break; 156 break;
156 } 157 }
157 if (pNext) { 158 if (pNext) {
(...skipping 19 matching lines...) Expand all
177 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, 178 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
178 CFX_WideString& wsPlainText); 179 CFX_WideString& wsPlainText);
179 FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); 180 FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);
180 IFX_Stream* XFA_CreateWideTextRead(const CFX_WideString& wsBuffer); 181 IFX_Stream* XFA_CreateWideTextRead(const CFX_WideString& wsBuffer);
181 FX_BOOL XFA_IsLayoutElement(XFA_Element eElement, 182 FX_BOOL XFA_IsLayoutElement(XFA_Element eElement,
182 FX_BOOL bLayoutContainer = FALSE); 183 FX_BOOL bLayoutContainer = FALSE);
183 184
184 void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); 185 void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
185 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, 186 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
186 IFX_Stream* pStream, 187 IFX_Stream* pStream,
187 const FX_CHAR* pChecksum = NULL, 188 const FX_CHAR* pChecksum = nullptr,
188 FX_BOOL bSaveXML = FALSE); 189 FX_BOOL bSaveXML = FALSE);
189 190
190 #endif // XFA_FXFA_PARSER_XFA_UTILS_H_ 191 #endif // XFA_FXFA_PARSER_XFA_UTILS_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_utils_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698