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

Side by Side Diff: xfa/fxfa/parser/cxfa_validate.cpp

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/cxfa_validate.h ('k') | xfa/fxfa/parser/cxfa_value.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 #include "xfa/fxfa/parser/cxfa_validate.h" 7 #include "xfa/fxfa/parser/cxfa_validate.h"
8 8
9 #include "xfa/fxfa/parser/xfa_object.h" 9 #include "xfa/fxfa/parser/xfa_object.h"
10 10
11 CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {} 11 CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
12 12
13 int32_t CXFA_Validate::GetFormatTest() { 13 int32_t CXFA_Validate::GetFormatTest() {
14 return m_pNode->GetEnum(XFA_ATTRIBUTE_FormatTest); 14 return m_pNode->GetEnum(XFA_ATTRIBUTE_FormatTest);
15 } 15 }
16 16
17 FX_BOOL CXFA_Validate::SetTestValue(int32_t iType, 17 bool CXFA_Validate::SetTestValue(int32_t iType,
18 CFX_WideString& wsValue, 18 CFX_WideString& wsValue,
19 XFA_ATTRIBUTEENUM eName) { 19 XFA_ATTRIBUTEENUM eName) {
20 const XFA_ATTRIBUTEENUMINFO* pInfo = 20 const XFA_ATTRIBUTEENUMINFO* pInfo =
21 XFA_GetAttributeEnumByName(wsValue.AsStringC()); 21 XFA_GetAttributeEnumByName(wsValue.AsStringC());
22 if (pInfo) 22 if (pInfo)
23 eName = pInfo->eName; 23 eName = pInfo->eName;
24 24
25 m_pNode->SetEnum((XFA_ATTRIBUTE)iType, eName, FALSE); 25 m_pNode->SetEnum((XFA_ATTRIBUTE)iType, eName, false);
26 return TRUE; 26 return true;
27 } 27 }
28 28
29 FX_BOOL CXFA_Validate::SetNullTest(CFX_WideString wsValue) { 29 bool CXFA_Validate::SetNullTest(CFX_WideString wsValue) {
30 return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue, 30 return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue,
31 XFA_ATTRIBUTEENUM_Disabled); 31 XFA_ATTRIBUTEENUM_Disabled);
32 } 32 }
33 33
34 int32_t CXFA_Validate::GetNullTest() { 34 int32_t CXFA_Validate::GetNullTest() {
35 return m_pNode->GetEnum(XFA_ATTRIBUTE_NullTest); 35 return m_pNode->GetEnum(XFA_ATTRIBUTE_NullTest);
36 } 36 }
37 37
38 int32_t CXFA_Validate::GetScriptTest() { 38 int32_t CXFA_Validate::GetScriptTest() {
39 return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest); 39 return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest);
40 } 40 }
41 41
42 void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, 42 void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage,
43 const CFX_WideString& wsMessageType) { 43 const CFX_WideString& wsMessageType) {
44 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, FALSE); 44 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, false);
45 if (!pNode) 45 if (!pNode)
46 return; 46 return;
47 47
48 CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 48 CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
49 for (; pItemNode; 49 for (; pItemNode;
50 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 50 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
51 if (pItemNode->GetElementType() != XFA_Element::Text) 51 if (pItemNode->GetElementType() != XFA_Element::Text)
52 continue; 52 continue;
53 53
54 CFX_WideStringC wsName; 54 CFX_WideStringC wsName;
(...skipping 16 matching lines...) Expand all
71 void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) { 71 void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) {
72 SetMessageText(wsMessage, L"nullTest"); 72 SetMessageText(wsMessage, L"nullTest");
73 } 73 }
74 74
75 void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) { 75 void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) {
76 GetMessageText(wsMessage, L"nullTest"); 76 GetMessageText(wsMessage, L"nullTest");
77 } 77 }
78 78
79 void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, 79 void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage,
80 const CFX_WideString& wsMessageType) { 80 const CFX_WideString& wsMessageType) {
81 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, TRUE); 81 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, true);
82 if (!pNode) 82 if (!pNode)
83 return; 83 return;
84 84
85 CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 85 CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
86 for (; pItemNode; 86 for (; pItemNode;
87 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 87 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
88 if (pItemNode->GetElementType() != XFA_Element::Text) 88 if (pItemNode->GetElementType() != XFA_Element::Text)
89 continue; 89 continue;
90 90
91 CFX_WideStringC wsName; 91 CFX_WideStringC wsName;
92 pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName); 92 pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
93 if (wsName.IsEmpty() || wsName == wsMessageType) { 93 if (wsName.IsEmpty() || wsName == wsMessageType) {
94 pItemNode->SetContent(wsMessage, wsMessage, FALSE); 94 pItemNode->SetContent(wsMessage, wsMessage, false);
95 return; 95 return;
96 } 96 }
97 } 97 }
98 CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text); 98 CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text);
99 pNode->InsertChild(pTextNode); 99 pNode->InsertChild(pTextNode);
100 pTextNode->SetCData(XFA_ATTRIBUTE_Name, wsMessageType, FALSE); 100 pTextNode->SetCData(XFA_ATTRIBUTE_Name, wsMessageType, false);
101 pTextNode->SetContent(wsMessage, wsMessage, FALSE); 101 pTextNode->SetContent(wsMessage, wsMessage, false);
102 } 102 }
103 103
104 void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) { 104 void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) {
105 GetMessageText(wsMessage, L"scriptTest"); 105 GetMessageText(wsMessage, L"scriptTest");
106 } 106 }
107 107
108 void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) { 108 void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) {
109 SetMessageText(wsMessage, L"scriptTest"); 109 SetMessageText(wsMessage, L"scriptTest");
110 } 110 }
111 111
112 void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) { 112 void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) {
113 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture)) 113 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture))
114 pNode->TryContent(wsPicture); 114 pNode->TryContent(wsPicture);
115 } 115 }
116 116
117 CXFA_Script CXFA_Validate::GetScript() { 117 CXFA_Script CXFA_Validate::GetScript() {
118 return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script)); 118 return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script));
119 } 119 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_validate.h ('k') | xfa/fxfa/parser/cxfa_value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698