From efcae5d85f829618749461617521a076881cc493 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 29 Mar 2017 14:47:46 -0400 Subject: Split xfa_object.h apart. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl splits the xfa_object.h into individual class header files and fixes the needed includes. Change-Id: Ia011ee9bc5deee5e44b8a956fa54bc2c3849cff0 Reviewed-on: https://pdfium-review.googlesource.com/3254 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_object.cpp | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_object.cpp') diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 4964265b4d..9bbee4ec75 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -4,12 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" #include "core/fxcrt/fx_ext.h" #include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_nodelist.h" CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, @@ -23,18 +25,6 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, CXFA_Object::~CXFA_Object() {} -CFX_WideStringC CXFA_Object::GetClassName() const { - return m_elementName; -} - -uint32_t CXFA_Object::GetClassHashCode() const { - return m_elementNameHash; -} - -XFA_Element CXFA_Object::GetElementType() const { - return m_elementType; -} - void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { @@ -71,3 +61,27 @@ void CXFA_Object::ThrowException(const wchar_t* str, ...) const { va_end(arg_ptr); FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); } + +CXFA_Node* CXFA_Object::AsNode() { + return IsNode() ? static_cast(this) : nullptr; +} + +CXFA_NodeList* CXFA_Object::AsNodeList() { + return IsNodeList() ? static_cast(this) : nullptr; +} + +const CXFA_Node* CXFA_Object::AsNode() const { + return IsNode() ? static_cast(this) : nullptr; +} + +const CXFA_NodeList* CXFA_Object::AsNodeList() const { + return IsNodeList() ? static_cast(this) : nullptr; +} + +CXFA_Node* ToNode(CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} + +const CXFA_Node* ToNode(const CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} -- cgit v1.2.3