summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_object.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-25 16:59:38 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-25 16:59:38 +0000
commit1f7db295b1deeecb562d6213b3ea17b9168405eb (patch)
tree9e8ab0575b9acd207e8bcf8a7273aa2a4d0948bb /xfa/fxfa/parser/cxfa_object.h
parent84d3394d88c42b798eedc938e6295ad1bf28ac66 (diff)
downloadpdfium-1f7db295b1deeecb562d6213b3ea17b9168405eb.tar.xz
Move CXFA_ThisProxy helper to CXFA_Object.
Because the other helpers are declared here. Rename VariablesThis to ThisProxy in a few places; VariablesThis is a slightly different concept (see GetVariablesThis()). Then introduce helper for CXFA_List subclass as well. Remove unused const version of some helpers. Change-Id: Ia328d8cd170a8b97015e98c1c770fa8a44810455 Reviewed-on: https://pdfium-review.googlesource.com/38670 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_object.h')
-rw-r--r--xfa/fxfa/parser/cxfa_object.h25
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_