diff options
Diffstat (limited to 'xfa/fxfa/parser/cxfa_object.h')
-rw-r--r-- | xfa/fxfa/parser/cxfa_object.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 023516a05e..173bf23f25 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -24,12 +24,14 @@ enum class XFA_ObjectType { TreeList, ContainerNode, ContentNode, - VariablesThis + ThisProxy, }; class CJX_Object; class CXFA_Document; +class CXFA_List; class CXFA_Node; +class CXFA_ThisProxy; class CXFA_TreeList; class CXFA_Object : public CFXJSE_HostObject { @@ -42,6 +44,10 @@ class CXFA_Object : public CFXJSE_HostObject { CXFA_Document* GetDocument() const { return m_pDocument.Get(); } XFA_ObjectType GetObjectType() const { return m_objectType; } + bool IsList() const { + return m_objectType == XFA_ObjectType::List || + m_objectType == XFA_ObjectType::TreeList; + } bool IsNode() const { return m_objectType == XFA_ObjectType::Node || m_objectType == XFA_ObjectType::NodeC || @@ -50,7 +56,7 @@ class CXFA_Object : public CFXJSE_HostObject { m_objectType == XFA_ObjectType::TextNode || m_objectType == XFA_ObjectType::ContainerNode || m_objectType == XFA_ObjectType::ContentNode || - m_objectType == XFA_ObjectType::VariablesThis; + m_objectType == XFA_ObjectType::ThisProxy; } bool IsTreeList() const { return m_objectType == XFA_ObjectType::TreeList; } bool IsContentNode() const { @@ -61,15 +67,12 @@ class CXFA_Object : public CFXJSE_HostObject { } bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; } bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; } - bool IsVariablesThis() const { - return m_objectType == XFA_ObjectType::VariablesThis; - } + bool IsThisProxy() const { return m_objectType == XFA_ObjectType::ThisProxy; } + CXFA_List* AsList(); CXFA_Node* AsNode(); CXFA_TreeList* AsTreeList(); - - const CXFA_Node* AsNode() const; - const CXFA_TreeList* AsTreeList() const; + CXFA_ThisProxy* AsThisProxy(); CJX_Object* JSObject() { return m_pJSObject.get(); } const CJX_Object* JSObject() const { return m_pJSObject.get(); } @@ -99,11 +102,13 @@ class CXFA_Object : public CFXJSE_HostObject { const XFA_Element m_elementType; const uint32_t m_elementNameHash; const WideStringView m_elementName; - std::unique_ptr<CJX_Object> m_pJSObject; }; +// Helper functions that permit nullptr arguments. +CXFA_List* ToList(CXFA_Object* pObj); CXFA_Node* ToNode(CXFA_Object* pObj); -const CXFA_Node* ToNode(const CXFA_Object* pObj); +CXFA_TreeList* ToTreeList(CXFA_Object* pObj); +CXFA_ThisProxy* ToThisProxy(CXFA_Object* pObj); #endif // XFA_FXFA_PARSER_CXFA_OBJECT_H_ |