diff options
Diffstat (limited to 'xfa/fxfa/parser/cxfa_simple_parser.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 997094351e..4599b1c4fc 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -19,7 +19,7 @@ namespace { CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc, - FX_BOOL bVerifyWellFormness = FALSE) { + bool bVerifyWellFormness = false) { if (!pXMLDoc) return nullptr; @@ -54,22 +54,22 @@ void GetElementTagNamespaceURI(CFDE_XMLElement* pElement, } } -FX_BOOL MatchNodeName(CFDE_XMLNode* pNode, - const CFX_WideStringC& wsLocalTagName, - const CFX_WideStringC& wsNamespaceURIPrefix, - uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { +bool MatchNodeName(CFDE_XMLNode* pNode, + const CFX_WideStringC& wsLocalTagName, + const CFX_WideStringC& wsNamespaceURIPrefix, + uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { if (!pNode || pNode->GetType() != FDE_XMLNODE_Element) - return FALSE; + return false; CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode); CFX_WideString wsNodeStr; pElement->GetLocalTagName(wsNodeStr); if (wsNodeStr != wsLocalTagName) - return FALSE; + return false; GetElementTagNamespaceURI(pElement, wsNodeStr); if (eMatchFlags & XFA_XDPPACKET_FLAGS_NOMATCH) - return TRUE; + return true; if (eMatchFlags & XFA_XDPPACKET_FLAGS_PREFIXMATCH) { return wsNodeStr.Left(wsNamespaceURIPrefix.GetLength()) == wsNamespaceURIPrefix; @@ -77,22 +77,22 @@ FX_BOOL MatchNodeName(CFDE_XMLNode* pNode, return wsNodeStr == wsNamespaceURIPrefix; } -FX_BOOL GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, - CFX_WideString& wsLocalAttrName) { +bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, + CFX_WideString& wsLocalAttrName) { CFX_WideString wsAttrName(wsAttributeName); FX_STRSIZE iFind = wsAttrName.Find(L':', 0); if (iFind < 0) { wsLocalAttrName = wsAttrName; - return FALSE; + return false; } wsLocalAttrName = wsAttrName.Right(wsAttrName.GetLength() - iFind - 1); - return TRUE; + return true; } -FX_BOOL ResolveAttribute(CFDE_XMLElement* pElement, - const CFX_WideStringC& wsAttributeName, - CFX_WideString& wsLocalAttrName, - CFX_WideString& wsNamespaceURI) { +bool ResolveAttribute(CFDE_XMLElement* pElement, + const CFX_WideStringC& wsAttributeName, + CFX_WideString& wsLocalAttrName, + CFX_WideString& wsNamespaceURI) { CFX_WideString wsAttrName(wsAttributeName); CFX_WideString wsNSPrefix; if (GetAttributeLocalName(wsAttributeName, wsLocalAttrName)) { @@ -101,23 +101,23 @@ FX_BOOL ResolveAttribute(CFDE_XMLElement* pElement, } if (wsLocalAttrName == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) { - return FALSE; + return false; } if (!XFA_FDEExtension_ResolveNamespaceQualifier( pElement, wsNSPrefix.AsStringC(), wsNamespaceURI)) { wsNamespaceURI.clear(); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL FindAttributeWithNS(CFDE_XMLElement* pElement, - const CFX_WideStringC& wsLocalAttributeName, - const CFX_WideStringC& wsNamespaceURIPrefix, - CFX_WideString& wsValue, - FX_BOOL bMatchNSAsPrefix = FALSE) { +bool FindAttributeWithNS(CFDE_XMLElement* pElement, + const CFX_WideStringC& wsLocalAttributeName, + const CFX_WideStringC& wsNamespaceURIPrefix, + CFX_WideString& wsValue, + bool bMatchNSAsPrefix = false) { if (!pElement) - return FALSE; + return false; CFX_WideString wsAttrName; CFX_WideString wsAttrValue; @@ -151,9 +151,9 @@ FX_BOOL FindAttributeWithNS(CFDE_XMLElement* pElement, continue; } wsValue = wsAttrValue; - return TRUE; + return true; } - return FALSE; + return false; } CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { @@ -184,7 +184,7 @@ CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { return nullptr; } -FX_BOOL IsStringAllWhitespace(CFX_WideString wsText) { +bool IsStringAllWhitespace(CFX_WideString wsText) { wsText.TrimRight(L"\x20\x9\xD\xA"); return wsText.IsEmpty(); } @@ -222,7 +222,7 @@ void ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode, break; } default: - ASSERT(FALSE); + ASSERT(false); break; } } @@ -250,14 +250,14 @@ const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) { } // namespace -FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) { +bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) { if (pRichTextXMLNode) { CFX_WideString wsNamespaceURI; GetElementTagNamespaceURI(pRichTextXMLNode, wsNamespaceURI); if (wsNamespaceURI == FX_WSTRC(L"http://www.w3.org/1999/xhtml")) - return TRUE; + return true; } - return FALSE; + return false; } CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, @@ -381,13 +381,13 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } m_pRootNode = pXFANode; } else { - m_pRootNode = DataLoader(pXFANode, pXMLNode, TRUE); + m_pRootNode = DataLoader(pXFANode, pXMLNode, true); } } else if (pXFANode->IsContentNode()) { ParseContentNode(pXFANode, pXMLNode, ePacketID); m_pRootNode = pXFANode; } else { - m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID, TRUE); + m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID, true); } } @@ -399,19 +399,19 @@ CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { return m_pXMLDoc.get(); } -FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( +bool XFA_FDEExtension_ResolveNamespaceQualifier( CFDE_XMLElement* pNode, const CFX_WideStringC& wsQualifier, CFX_WideString& wsNamespaceURI) { if (!pNode) - return FALSE; + return false; CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root); CFX_WideString wsNSAttribute; - FX_BOOL bRet = FALSE; + bool bRet = false; if (wsQualifier.IsEmpty()) { wsNSAttribute = FX_WSTRC(L"xmlns"); - bRet = TRUE; + bRet = true; } else { wsNSAttribute = FX_WSTRC(L"xmlns:") + wsQualifier; } @@ -422,7 +422,7 @@ FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( if (pNode->HasAttribute(wsNSAttribute.c_str())) { pNode->GetString(wsNSAttribute.c_str(), wsNamespaceURI); - return TRUE; + return true; } } wsNamespaceURI.clear(); @@ -606,7 +606,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); - if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) + if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, true)) return nullptr; pNode->SetXMLMappingNode(pXMLDocumentNode); @@ -639,7 +639,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI); } - if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) + if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, true)) return nullptr; } } else if (ePacketID == XFA_XDPPACKET_Form) { @@ -679,11 +679,11 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pTemplateRoot ? pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform) : nullptr; - FX_BOOL bUseAttribute = TRUE; + bool bUseAttribute = true; if (pTemplateChosen && pTemplateChosen->GetEnum(XFA_ATTRIBUTE_RestoreState) != XFA_ATTRIBUTEENUM_Auto) { - bUseAttribute = FALSE; + bUseAttribute = false; } if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) return nullptr; @@ -707,7 +707,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName); - if (!DataLoader(pNode, pDatasetsXMLNode, FALSE)) + if (!DataLoader(pNode, pDatasetsXMLNode, false)) return nullptr; pNode->SetXMLMappingNode(pDatasetsXMLNode); @@ -748,7 +748,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( CFX_WideString wsLocalName; static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); - if (!DataLoader(pNode, pDataXMLNode, TRUE)) + if (!DataLoader(pNode, pDataXMLNode, true)) return nullptr; pNode->SetXMLMappingNode(pDataXMLNode); @@ -775,7 +775,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); - if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) + if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, true)) return nullptr; } } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { @@ -790,7 +790,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); - if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) + if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, true)) return nullptr; } } else if (ePacketID == XFA_XDPPACKET_SourceSet) { @@ -805,7 +805,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); - if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) + if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, true)) return nullptr; } } @@ -859,7 +859,7 @@ CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode, CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc, - FX_BOOL bDoTransform) { + bool bDoTransform) { ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets); return pXFANode; } @@ -867,8 +867,8 @@ CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc, XFA_XDPPACKET ePacketID, - FX_BOOL bUseAttribute) { - FX_BOOL bOneOfPropertyFound = FALSE; + bool bUseAttribute) { + bool bOneOfPropertyFound = false; for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { @@ -889,7 +889,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, if (bOneOfPropertyFound) break; - bOneOfPropertyFound = TRUE; + bOneOfPropertyFound = true; } CXFA_Node* pXFAChild = m_pFactory->CreateNode(ePacketID, eType); if (!pXFAChild) @@ -897,7 +897,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, if (ePacketID == XFA_XDPPACKET_Config) pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringC()); - FX_BOOL IsNeedValue = TRUE; + bool IsNeedValue = true; for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count; i++) { CFX_WideString wsAttrQualifiedName; @@ -907,7 +907,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, GetAttributeLocalName(wsAttrQualifiedName.AsStringC(), wsAttrName); if (wsAttrName == FX_WSTRC(L"nil") && wsAttrValue == FX_WSTRC(L"true")) { - IsNeedValue = FALSE; + IsNeedValue = false; } const XFA_ATTRIBUTEINFO* lpAttrInfo = XFA_GetAttributeByName(wsAttrName.AsStringC()); @@ -1181,7 +1181,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, XFA_XDPPACKET ePacketID) { CFX_WideTextBuf wsValueTextBuf; CFX_WideTextBuf wsCurValueTextBuf; - FX_BOOL bMarkAsCompound = FALSE; + bool bMarkAsCompound = false; CFDE_XMLNode* pXMLCurValueNode = nullptr; for (CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); @@ -1213,7 +1213,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, wsCurValueTextBuf << wsText; } else { - bMarkAsCompound = TRUE; + bMarkAsCompound = true; if (pXMLCurValueNode) { CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); if (!wsCurValue.IsEmpty()) { @@ -1288,7 +1288,7 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, wsData.clear(); if (pXMLInstruction->GetData(1, wsData) && wsData == FX_WSTRC(L"v2.7-scripting:1")) { - pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_Scripting, TRUE); + pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_Scripting, true); } } } else if (wsTargetName == FX_WSTRC(L"acrobat")) { @@ -1297,7 +1297,7 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, wsData == FX_WSTRC(L"JavaScript")) { if (pXMLInstruction->GetData(1, wsData) && wsData == FX_WSTRC(L"strictScoping")) { - pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, TRUE); + pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true); } } } |