OLD | NEW |
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 #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" | 7 #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "xfa/fxfa/parser/cxfa_document.h" | 10 #include "xfa/fxfa/parser/cxfa_document.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 int32_t CXFA_ResolveProcessor::ResolveAsterisk(CXFA_ResolveNodesData& rnd) { | 491 int32_t CXFA_ResolveProcessor::ResolveAsterisk(CXFA_ResolveNodesData& rnd) { |
492 CXFA_Node* curNode = ToNode(rnd.m_CurNode); | 492 CXFA_Node* curNode = ToNode(rnd.m_CurNode); |
493 CXFA_ObjArray& nodes = rnd.m_Nodes; | 493 CXFA_ObjArray& nodes = rnd.m_Nodes; |
494 CXFA_NodeArray array; | 494 CXFA_NodeArray array; |
495 curNode->GetNodeList(array, | 495 curNode->GetNodeList(array, |
496 XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties); | 496 XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties); |
497 nodes.Append((CXFA_ObjArray&)array); | 497 nodes.Append((CXFA_ObjArray&)array); |
498 return nodes.GetSize(); | 498 return nodes.GetSize(); |
499 } | 499 } |
500 int32_t CXFA_ResolveProcessor::ResolvePopStack(CFX_Int32Array& stack) { | 500 int32_t CXFA_ResolveProcessor::ResolvePopStack( |
| 501 CFX_ArrayTemplate<int32_t>& stack) { |
501 int32_t nType = -1; | 502 int32_t nType = -1; |
502 int32_t iSize = stack.GetSize() - 1; | 503 int32_t iSize = stack.GetSize() - 1; |
503 if (iSize > -1) { | 504 if (iSize > -1) { |
504 nType = stack[iSize]; | 505 nType = stack[iSize]; |
505 stack.RemoveAt(iSize, 1); | 506 stack.RemoveAt(iSize, 1); |
506 } | 507 } |
507 return nType; | 508 return nType; |
508 } | 509 } |
509 int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, | 510 int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, |
510 int32_t nStart, | 511 int32_t nStart, |
511 CXFA_ResolveNodesData& rnd) { | 512 CXFA_ResolveNodesData& rnd) { |
512 ASSERT(nStart > -1); | 513 ASSERT(nStart > -1); |
513 int32_t iLength = wsExpression.GetLength(); | 514 int32_t iLength = wsExpression.GetLength(); |
514 if (nStart >= iLength) { | 515 if (nStart >= iLength) { |
515 return 0; | 516 return 0; |
516 } | 517 } |
517 CFX_WideString& wsName = rnd.m_wsName; | 518 CFX_WideString& wsName = rnd.m_wsName; |
518 CFX_WideString& wsCondition = rnd.m_wsCondition; | 519 CFX_WideString& wsCondition = rnd.m_wsCondition; |
519 FX_WCHAR* pNameBuf = wsName.GetBuffer(iLength - nStart); | 520 FX_WCHAR* pNameBuf = wsName.GetBuffer(iLength - nStart); |
520 FX_WCHAR* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); | 521 FX_WCHAR* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); |
521 int32_t nNameCount = 0; | 522 int32_t nNameCount = 0; |
522 int32_t nConditionCount = 0; | 523 int32_t nConditionCount = 0; |
523 CFX_Int32Array stack; | 524 CFX_ArrayTemplate<int32_t> stack; |
524 int32_t nType = -1; | 525 int32_t nType = -1; |
525 const FX_WCHAR* pSrc = wsExpression.c_str(); | 526 const FX_WCHAR* pSrc = wsExpression.c_str(); |
526 FX_WCHAR wPrev = 0, wCur; | 527 FX_WCHAR wPrev = 0, wCur; |
527 bool bIsCondition = false; | 528 bool bIsCondition = false; |
528 while (nStart < iLength) { | 529 while (nStart < iLength) { |
529 wCur = pSrc[nStart++]; | 530 wCur = pSrc[nStart++]; |
530 if (wCur == '.') { | 531 if (wCur == '.') { |
531 if (wPrev == '\\') { | 532 if (wPrev == '\\') { |
532 pNameBuf[nNameCount - 1] = wPrev = '.'; | 533 pNameBuf[nNameCount - 1] = wPrev = '.'; |
533 continue; | 534 continue; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 m_wsCondition(), | 815 m_wsCondition(), |
815 m_nLevel(0), | 816 m_nLevel(0), |
816 m_Nodes(), | 817 m_Nodes(), |
817 m_dwStyles(XFA_RESOLVENODE_Children), | 818 m_dwStyles(XFA_RESOLVENODE_Children), |
818 m_pScriptAttribute(nullptr), | 819 m_pScriptAttribute(nullptr), |
819 m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} | 820 m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} |
820 | 821 |
821 CXFA_ResolveNodesData::~CXFA_ResolveNodesData() { | 822 CXFA_ResolveNodesData::~CXFA_ResolveNodesData() { |
822 m_Nodes.RemoveAll(); | 823 m_Nodes.RemoveAll(); |
823 } | 824 } |
OLD | NEW |