Home | History | Annotate | Download | only in parser
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef _XFA_NODEHELPER_H_
      8 #define _XFA_NODEHELPER_H_
      9 class CXFA_ScriptContext;
     10 enum XFA_LOGIC_TYPE {
     11   XFA_LOGIC_NoTransparent,
     12   XFA_LOGIC_Transparent,
     13 };
     14 class CXFA_NodeHelper {
     15  public:
     16   CXFA_NodeHelper(void);
     17   ~CXFA_NodeHelper(void);
     18   CXFA_Node* XFA_ResolveNodes_GetOneChild(CXFA_Node* parent,
     19                                           const FX_WCHAR* pwsName,
     20                                           FX_BOOL bIsClassName = FALSE);
     21   CXFA_Node* XFA_ResolveNodes_GetParent(
     22       CXFA_Node* pNode,
     23       XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
     24 
     25   int32_t XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent,
     26                                        FX_DWORD dNameHash,
     27                                        CXFA_NodeArray* pSiblings,
     28                                        XFA_LOGIC_TYPE eLogicType,
     29                                        FX_BOOL bIsClassName = FALSE,
     30                                        FX_BOOL bIsFindProperty = TRUE);
     31   int32_t XFA_NodeAcc_TraverseAnySiblings(CXFA_Node* parent,
     32                                           FX_DWORD dNameHash,
     33                                           CXFA_NodeArray* pSiblings,
     34                                           FX_BOOL bIsClassName = FALSE);
     35   int32_t XFA_CountSiblings(CXFA_Node* pNode,
     36                             XFA_LOGIC_TYPE eLogicType,
     37                             CXFA_NodeArray* pSiblings,
     38                             FX_BOOL bIsClassName = FALSE);
     39   int32_t XFA_GetIndex(CXFA_Node* pNode,
     40                        XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent,
     41                        FX_BOOL bIsProperty = FALSE,
     42                        FX_BOOL bIsClassIndex = FALSE);
     43   void XFA_GetNameExpression(
     44       CXFA_Node* refNode,
     45       CFX_WideString& wsName,
     46       FX_BOOL bIsAllPath,
     47       XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
     48   FX_BOOL XFA_NodeIsTransparent(CXFA_Node* refNode);
     49   FX_BOOL XFA_ResolveNodes_CreateNode(CFX_WideString wsName,
     50                                       CFX_WideString wsCondition,
     51                                       FX_BOOL bLastNode,
     52                                       CXFA_ScriptContext* pScriptContext);
     53   FX_BOOL XFA_CreateNode_ForCondition(CFX_WideString& wsCondition);
     54   void XFA_SetCreateNodeType(CXFA_Node* refNode);
     55   FX_BOOL XFA_NodeIsProperty(CXFA_Node* refNode);
     56 
     57  public:
     58   XFA_ELEMENT m_eLastCreateType;
     59   CXFA_Node* m_pCreateParent;
     60   int32_t m_iCreateCount;
     61   XFA_RESOVENODE_RSTYPE m_iCreateFlag;
     62   int32_t m_iCurAllStart;
     63   CXFA_Node* m_pAllStartParent;
     64 };
     65 #endif
     66