diff options
author | weili <weili@chromium.org> | 2016-06-16 08:00:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-16 08:00:06 -0700 |
commit | 47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6 (patch) | |
tree | 90675d8541871a71c6cd9c64723464878bd49a90 /xfa/fxfa/parser | |
parent | b63068f04681f7ade9c062a442977c660e3503d0 (diff) | |
download | pdfium-47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6.tar.xz |
Make code compile with clang_use_chrome_plugin (part V)chromium/2770
This change mainly contains files in xfa/fxfa directory.
This is part of the efforts to make PDFium code compilable
by Clang chromium style plugins.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups;
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2071683002
Diffstat (limited to 'xfa/fxfa/parser')
24 files changed, 308 insertions, 155 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index d2054cf145..26f397cb64 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -61,7 +61,6 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Validate GetValidate(FX_BOOL bModified = FALSE); CXFA_Bind GetBind(FX_BOOL bModified = FALSE); CXFA_Assist GetAssist(FX_BOOL bModified = FALSE); - uint32_t GetRelevantStatus(); FX_BOOL GetWidth(FX_FLOAT& fWidth); FX_BOOL GetHeight(FX_FLOAT& fHeight); FX_BOOL GetMinWidth(FX_FLOAT& fMinWidth); diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index f7c2606501..8367462b60 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -553,6 +553,9 @@ int32_t CXFA_WideTextRead::GetPosition() { FX_BOOL CXFA_WideTextRead::IsEOF() const { return m_iPosition >= m_wsBuffer.GetLength(); } +int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { + return 0; +} int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, @@ -566,9 +569,36 @@ int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, bEOS = IsEOF(); return iMaxLength; } +int32_t CXFA_WideTextRead::WriteData(const uint8_t* pBuffer, + int32_t iBufferSize) { + return 0; +} +int32_t CXFA_WideTextRead::WriteString(const FX_WCHAR* pStr, int32_t iLength) { + return 0; +} +FX_BOOL CXFA_WideTextRead::SetLength(int32_t iLength) { + return FALSE; +} +int32_t CXFA_WideTextRead::GetBOM(uint8_t bom[4]) const { + return 0; +} uint16_t CXFA_WideTextRead::GetCodePage() const { return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; } uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { return GetCodePage(); } + +IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, + int32_t iOffset, + int32_t iLength) { + return NULL; +} + +void CXFA_WideTextRead::Lock() {} + +void CXFA_WideTextRead::Unlock() {} + +CFX_WideString CXFA_WideTextRead::GetSrcText() const { + return m_wsBuffer; +} diff --git a/xfa/fxfa/parser/xfa_basic_imp.h b/xfa/fxfa/parser/xfa_basic_imp.h index 108b00d00f..fdb77a9d07 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.h +++ b/xfa/fxfa/parser/xfa_basic_imp.h @@ -24,43 +24,35 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( class CXFA_WideTextRead : public IFX_Stream { public: CXFA_WideTextRead(const CFX_WideString& wsBuffer); - virtual void Release(); - virtual IFX_Stream* Retain(); - virtual uint32_t GetAccessModes() const; - virtual int32_t GetLength() const; - virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset); - virtual int32_t GetPosition(); - virtual FX_BOOL IsEOF() const; - - virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return 0; } - virtual int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS, - int32_t const* pByteSize = NULL); - virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { - return 0; - } - virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) { - return 0; - } - virtual void Flush() {} - virtual FX_BOOL SetLength(int32_t iLength) { return FALSE; } - - virtual int32_t GetBOM(uint8_t bom[4]) const { return 0; } - virtual uint16_t GetCodePage() const; - virtual uint16_t SetCodePage(uint16_t wCodePage); - - virtual void Lock() {} - virtual void Unlock() {} - - virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess, - int32_t iOffset, - int32_t iLength) { - return NULL; - } - - CFX_WideString GetSrcText() const { return m_wsBuffer; } + // IFX_Stream + void Release() override; + IFX_Stream* Retain() override; + uint32_t GetAccessModes() const override; + int32_t GetLength() const override; + int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; + int32_t GetPosition() override; + FX_BOOL IsEOF() const override; + int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; + int32_t ReadString(FX_WCHAR* pStr, + int32_t iMaxLength, + FX_BOOL& bEOS, + int32_t const* pByteSize = NULL) override; + int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; + int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + void Flush() override {} + FX_BOOL SetLength(int32_t iLength) override; + int32_t GetBOM(uint8_t bom[4]) const override; + uint16_t GetCodePage() const override; + uint16_t SetCodePage(uint16_t wCodePage) override; + IFX_Stream* CreateSharedStream(uint32_t dwAccess, + int32_t iOffset, + int32_t iLength) override; + + virtual void Lock(); + virtual void Unlock(); + + CFX_WideString GetSrcText() const; protected: CFX_WideString m_wsBuffer; diff --git a/xfa/fxfa/parser/xfa_doclayout.h b/xfa/fxfa/parser/xfa_doclayout.h index a0b29e5ff8..cc0cf82417 100644 --- a/xfa/fxfa/parser/xfa_doclayout.h +++ b/xfa/fxfa/parser/xfa_doclayout.h @@ -66,7 +66,7 @@ class CXFA_ContainerLayoutItem : public CXFA_LayoutItem { class CXFA_ContentLayoutItem : public CXFA_LayoutItem { public: CXFA_ContentLayoutItem(CXFA_Node* pNode); - virtual ~CXFA_ContentLayoutItem(); + ~CXFA_ContentLayoutItem() override; CXFA_ContentLayoutItem* m_pPrev; CXFA_ContentLayoutItem* m_pNext; diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index 2890a6677c..39068c7076 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -57,10 +57,12 @@ class CScript_HostPseudoModel; class CScript_LogPseudoModel; class CScript_LayoutPseudoModel; class CScript_SignaturePseudoModel; + class CXFA_Document { public: CXFA_Document(CXFA_DocumentParser* pParser); ~CXFA_Document(); + CXFA_Node* GetRoot() const { return m_pRootNode; } CXFA_DocumentParser* GetParser() const { return m_pParser; } CXFA_FFNotify* GetNotify() const; diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.h b/xfa/fxfa/parser/xfa_layout_appadapter.h index 1bae22ee32..d41b90a9c7 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.h +++ b/xfa/fxfa/parser/xfa_layout_appadapter.h @@ -27,6 +27,7 @@ class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); } }; + class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { public: static inline CXFA_ContainerLayoutItem* GetFirstChild( @@ -56,6 +57,7 @@ class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); } }; + class CXFA_TraverseStrategy_ContentLayoutItem { public: static inline CXFA_ContentLayoutItem* GetFirstChild( diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 509bf630e9..f44435a40f 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -77,6 +77,9 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_pOldLayoutItem = (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); } + +CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} + CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( CXFA_Node* pFormNode) { if (!pFormNode) { diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h index f7376d250e..fc279893c8 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.h +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.h @@ -63,6 +63,7 @@ class CXFA_LayoutContext { class CXFA_ItemLayoutProcessor { public: CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); + ~CXFA_ItemLayoutProcessor(); XFA_ItemLayoutProcessorResult DoLayout( FX_BOOL bUseBreakControl, diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h index a82c152df9..b992a228dd 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h @@ -22,10 +22,12 @@ class CXFA_ContainerRecord { CXFA_ContainerLayoutItem* pCurPageArea; CXFA_ContainerLayoutItem* pCurContentArea; }; + class CXFA_LayoutPageMgr { public: CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor); ~CXFA_LayoutPageMgr(); + FX_BOOL InitLayoutPage(CXFA_Node* pFormNode); FX_BOOL PrepareFirstPage(CXFA_Node* pRootSubform); FX_FLOAT GetAvailHeight(); diff --git a/xfa/fxfa/parser/xfa_locale.h b/xfa/fxfa/parser/xfa_locale.h index 522df19a82..5a79e20a3f 100644 --- a/xfa/fxfa/parser/xfa_locale.h +++ b/xfa/fxfa/parser/xfa_locale.h @@ -13,32 +13,35 @@ class CXFA_XMLLocale : public IFX_Locale { public: CXFA_XMLLocale(CXML_Element* pLocaleData); - virtual void Release(); - virtual CFX_WideString GetName(); - virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const; - - virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const; - virtual void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM = TRUE) const; - virtual void GetTimeZone(FX_TIMEZONE& tz) const; - virtual void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const; - - virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const; + + // IFX_Locale + void Release() override; + CFX_WideString GetName() override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + FX_BOOL bAbbr = TRUE) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + FX_BOOL bAbbr = TRUE) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + FX_BOOL bAM = TRUE) const override; + void GetTimeZone(FX_TIMEZONE& tz) const override; + void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; protected: - ~CXFA_XMLLocale(); + ~CXFA_XMLLocale() override; + void GetPattern(CXML_Element* pElement, const CFX_ByteStringC& bsTag, const CFX_WideStringC& wsName, @@ -50,35 +53,39 @@ class CXFA_XMLLocale : public IFX_Locale { private: CXML_Element* m_pLocaleData; }; + class CXFA_NodeLocale : public IFX_Locale { public: CXFA_NodeLocale(CXFA_Node* pLocale); - virtual void Release(); - virtual CFX_WideString GetName(); - virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const; - - virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const; - virtual void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM = TRUE) const; - virtual void GetTimeZone(FX_TIMEZONE& tz) const; - virtual void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const; - - virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const; + + // IFX_Locale + void Release() override; + CFX_WideString GetName() override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + FX_BOOL bAbbr = TRUE) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + FX_BOOL bAbbr = TRUE) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + FX_BOOL bAM = TRUE) const override; + void GetTimeZone(FX_TIMEZONE& tz) const override; + void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; protected: - ~CXFA_NodeLocale(); + ~CXFA_NodeLocale() override; + CXFA_Node* GetNodeByName(CXFA_Node* pParent, const CFX_WideStringC& wsName) const; CFX_WideString GetSymbol(XFA_ELEMENT eElement, diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h index a3a1d4c2b9..7051fc9ac3 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -33,14 +33,15 @@ class IFX_Locale; class CXFA_LocaleMgr : public IFX_LocaleMgr { public: CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); + ~CXFA_LocaleMgr() override; + // IFX_LocaleMgr void Release() override; uint16_t GetDefLocaleID() override; IFX_Locale* GetDefLocale() override; IFX_Locale* GetLocale(uint16_t lcid) override; IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override; - ~CXFA_LocaleMgr(); void SetDefLocale(IFX_Locale* pLocale); CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 2cd09df15c..b5c31cfbb2 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -45,7 +45,7 @@ enum XFA_OBJECTTYPE { class CXFA_Object : public CFXJSE_HostObject { public: CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); - virtual ~CXFA_Object() {} + ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument; } uint32_t GetFlag() const { return m_uFlags; } @@ -127,6 +127,9 @@ struct XFA_MAPDATABLOCK { }; struct XFA_MAPMODULEDATA { + XFA_MAPMODULEDATA(); + ~XFA_MAPMODULEDATA(); + CFX_MapPtrToPtr m_ValueMap; CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; }; @@ -134,6 +137,7 @@ struct XFA_MAPMODULEDATA { #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') + class CXFA_Node : public CXFA_Object { public: XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } @@ -649,42 +653,39 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pAuxNode; XFA_MAPMODULEDATA* m_pMapModuleData; }; + class CXFA_OrdinaryObject : public CXFA_Object { public: - CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) - : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), - m_uScriptHash(0) { - m_eNodeClass = eElement; - } - XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } - uint32_t GetScriptObjHash() { return m_uScriptHash; } + CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement); + ~CXFA_OrdinaryObject() override; + + XFA_ELEMENT GetClassID() const; + uint32_t GetScriptObjHash() const; protected: XFA_ELEMENT m_eNodeClass; uint32_t m_uScriptHash; }; + class CXFA_ThisProxy : public CXFA_Object { public: - CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) - : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), - m_pThisNode(NULL), - m_pScriptNode(NULL) { - m_pThisNode = pThisNode; - m_pScriptNode = pScriptNode; - } - ~CXFA_ThisProxy() override {} - CXFA_Node* GetThisNode() { return m_pThisNode; } - CXFA_Node* GetScriptNode() { return m_pScriptNode; } + CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); + ~CXFA_ThisProxy() override; + + CXFA_Node* GetThisNode() const; + CXFA_Node* GetScriptNode() const; private: CXFA_Node* m_pThisNode; CXFA_Node* m_pScriptNode; }; + class CXFA_NodeList : public CXFA_Object { public: explicit CXFA_NodeList(CXFA_Document* pDocument); - virtual ~CXFA_NodeList() {} - XFA_ELEMENT GetClassID() const { return XFA_ELEMENT_NodeList; } + ~CXFA_NodeList() override; + + XFA_ELEMENT GetClassID() const; CXFA_Node* NamedItem(const CFX_WideStringC& wsName); virtual int32_t GetLength() = 0; virtual FX_BOOL Append(CXFA_Node* pNode) = 0; @@ -702,28 +703,35 @@ class CXFA_NodeList : public CXFA_Object { FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); }; + class CXFA_ArrayNodeList : public CXFA_NodeList { public: explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); + ~CXFA_ArrayNodeList() override; + + // From CXFA_NodeList. + int32_t GetLength() override; + FX_BOOL Append(CXFA_Node* pNode) override; + FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + FX_BOOL Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; + void SetArrayNodeList(const CXFA_NodeArray& srcArray); - virtual int32_t GetLength(); - virtual FX_BOOL Append(CXFA_Node* pNode); - virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); - virtual FX_BOOL Remove(CXFA_Node* pNode); - virtual CXFA_Node* Item(int32_t iIndex); protected: CXFA_NodeArray m_array; }; + class CXFA_AttachNodeList : public CXFA_NodeList { public: CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); - virtual int32_t GetLength(); - virtual FX_BOOL Append(CXFA_Node* pNode); - virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); - virtual FX_BOOL Remove(CXFA_Node* pNode); - virtual CXFA_Node* Item(int32_t iIndex); + // From CXFA_NodeList. + int32_t GetLength() override; + FX_BOOL Append(CXFA_Node* pNode) override; + FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + FX_BOOL Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; protected: CXFA_Node* m_pAttachNode; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 0f36d68aa6..02617f14b9 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -59,6 +59,8 @@ XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { CXFA_Object::CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags) : m_pDocument(pDocument), m_uFlags(uFlags) {} +CXFA_Object::~CXFA_Object() {} + void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { wsName = XFA_GetElementByID(GetClassID())->pName; } @@ -107,6 +109,10 @@ void CXFA_Object::ThrowException(int32_t iStringID, ...) { FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } +XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} + +XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} + CXFA_Node::CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_ELEMENT eElement) @@ -5084,11 +5090,50 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, } pSrcModule->MoveBufferMapData(pDstModule, pKey); } + +CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, + XFA_ELEMENT eElement) + : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), m_uScriptHash(0) { + m_eNodeClass = eElement; +} + +CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} + +XFA_ELEMENT CXFA_OrdinaryObject::GetClassID() const { + return m_eNodeClass; +} + +uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const { + return m_uScriptHash; +} + +CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) + : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), + m_pThisNode(NULL), + m_pScriptNode(NULL) { + m_pThisNode = pThisNode; + m_pScriptNode = pScriptNode; +} + +CXFA_ThisProxy::~CXFA_ThisProxy() {} + +CXFA_Node* CXFA_ThisProxy::GetThisNode() const { + return m_pThisNode; +} + +CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { + return m_pScriptNode; +} + CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr<CXFA_NodeList>(this)); } +CXFA_NodeList::~CXFA_NodeList() {} +XFA_ELEMENT CXFA_NodeList::GetClassID() const { + return XFA_ELEMENT_NodeList; +} CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); int32_t iCount = GetLength(); @@ -5180,6 +5225,9 @@ void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue, } CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument) : CXFA_NodeList(pDocument) {} + +CXFA_ArrayNodeList::~CXFA_ArrayNodeList() {} + void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) { if (srcArray.GetSize() > 0) { m_array.Copy(srcArray); diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 748cca5cad..9cc324ae9d 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -37,6 +37,9 @@ CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, CXFA_SimpleParser::~CXFA_SimpleParser() { CloseParser(); } +void CXFA_SimpleParser::Release() { + delete this; +} void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } @@ -191,6 +194,18 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } } +CXFA_Document* CXFA_SimpleParser::GetFactory() const { + return m_pFactory; +} + +CXFA_Node* CXFA_SimpleParser::GetRootNode() const { + return m_pRootNode; +} + +CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { + return m_pXMLDoc; +} + FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( CFDE_XMLElement* pNode, const CFX_WideStringC& wsQualifier, @@ -1347,6 +1362,10 @@ CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); } + +void CXFA_DocumentParser::Release() { + delete this; +} int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID) { CloseParser(); @@ -1388,6 +1407,26 @@ void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode, } } +CXFA_Document* CXFA_DocumentParser::GetFactory() const { + return m_nodeParser.GetFactory(); +} + +CXFA_Node* CXFA_DocumentParser::GetRootNode() const { + return m_nodeParser.GetRootNode(); +} + +CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { + return m_nodeParser.GetXMLDoc(); +} + +CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { + return m_pNotify; +} + +CXFA_Document* CXFA_DocumentParser::GetDocument() const { + return m_pDocument; +} + void CXFA_DocumentParser::CloseParser() { delete m_pDocument; m_pDocument = nullptr; @@ -1410,6 +1449,7 @@ CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream) m_pParser = new CFDE_XMLSyntaxParser; m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024); } + CXFA_XMLParser::~CXFA_XMLParser() { if (m_pParser) { m_pParser->Release(); @@ -1418,6 +1458,11 @@ CXFA_XMLParser::~CXFA_XMLParser() { m_ws1.clear(); m_ws2.clear(); } + +void CXFA_XMLParser::Release() { + delete this; +} + int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error) return -1; diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 1f117be64e..3a56cc0996 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -17,8 +17,8 @@ class CXFA_SimpleParser : public IXFA_Parser { CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); ~CXFA_SimpleParser() override; - void Release() override { delete this; } - + // IXFA_Parser + void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; int32_t DoParse(IFX_Pause* pPause = NULL) override; @@ -26,9 +26,9 @@ class CXFA_SimpleParser : public IXFA_Parser { CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override { return m_pFactory; } - CXFA_Node* GetRootNode() const override { return m_pRootNode; } - CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } + CXFA_Document* GetFactory() const override; + CXFA_Node* GetRootNode() const override; + CFDE_XMLDoc* GetXMLDoc() const override; void CloseParser() override; protected: @@ -87,7 +87,8 @@ class CXFA_DocumentParser : public IXFA_Parser { CXFA_DocumentParser(CXFA_FFNotify* pNotify); ~CXFA_DocumentParser() override; - void Release() override { delete this; } + // IXFA_Parser + void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; int32_t DoParse(IFX_Pause* pPause = NULL) override; @@ -95,13 +96,11 @@ class CXFA_DocumentParser : public IXFA_Parser { CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override { - return m_nodeParser.GetFactory(); - } - CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } - CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } - CXFA_FFNotify* GetNotify() const { return m_pNotify; } - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetFactory() const override; + CXFA_Node* GetRootNode() const override; + CFDE_XMLDoc* GetXMLDoc() const override; + CXFA_FFNotify* GetNotify() const; + CXFA_Document* GetDocument() const; void CloseParser() override; protected: @@ -113,10 +112,11 @@ class CXFA_DocumentParser : public IXFA_Parser { class CXFA_XMLParser : public CFDE_XMLParser { public: CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); - ~CXFA_XMLParser(); + ~CXFA_XMLParser() override; - virtual void Release() { delete this; } - virtual int32_t DoParser(IFX_Pause* pPause); + // CFDE_XMLParser + void Release() override; + int32_t DoParser(IFX_Pause* pPause) override; FX_FILESIZE m_nStart[2]; size_t m_nSize[2]; diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index 646193d2cf..faaaceec78 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -38,10 +38,8 @@ enum XFA_RESOVENODE_RSTYPE { }; struct XFA_RESOLVENODE_RS { - XFA_RESOLVENODE_RS() - : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} - - ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } + XFA_RESOLVENODE_RS(); + ~XFA_RESOLVENODE_RS(); int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { @@ -61,4 +59,10 @@ struct XFA_RESOLVENODE_RS { const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; }; +inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() + : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} + +inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() { + nodes.RemoveAll(); +} #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ diff --git a/xfa/fxfa/parser/xfa_script_datawindow.h b/xfa/fxfa/parser/xfa_script_datawindow.h index 7754f049c4..d896a71e70 100644 --- a/xfa/fxfa/parser/xfa_script_datawindow.h +++ b/xfa/fxfa/parser/xfa_script_datawindow.h @@ -13,7 +13,8 @@ class CScript_DataWindow : public CXFA_OrdinaryObject { public: CScript_DataWindow(CXFA_Document* pDocument); - virtual ~CScript_DataWindow(); + ~CScript_DataWindow() override; + void Script_DataWindow_MoveCurrentRecord(CFXJSE_Arguments* pArguments); void Script_DataWindow_Record(CFXJSE_Arguments* pArguments); void Script_DataWindow_GotoRecord(CFXJSE_Arguments* pArguments); diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h index 378f56f149..3a53b0b05d 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h @@ -33,7 +33,7 @@ enum class XFA_Event { class CScript_EventPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_EventPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_EventPseudoModel(); + ~CScript_EventPseudoModel() override; void Script_EventPseudoModel_Change(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h index 8a186fb6fd..0cbe04aadb 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h @@ -14,7 +14,7 @@ class CScript_HostPseudoModel : public CXFA_OrdinaryObject { public: CScript_HostPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_HostPseudoModel(); + ~CScript_HostPseudoModel() override; void Script_HostPseudoModel_AppType(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h index 2fb0dba303..02e25b42f5 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h @@ -21,7 +21,7 @@ enum XFA_LAYOUTMODEL_HWXY { class CScript_LayoutPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_LayoutPseudoModel(CXFA_Document* pDocument); - ~CScript_LayoutPseudoModel(); + ~CScript_LayoutPseudoModel() override; void Script_LayoutPseudoModel_Ready(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.h b/xfa/fxfa/parser/xfa_script_logpseudomodel.h index 1e13cd0371..9e30641264 100644 --- a/xfa/fxfa/parser/xfa_script_logpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.h @@ -13,7 +13,7 @@ class CScript_LogPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_LogPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_LogPseudoModel(); + ~CScript_LogPseudoModel() override; void Script_LogPseudoModel_Message(CFXJSE_Arguments* pArguments); void Script_LogPseudoModel_TraceEnabled(CFXJSE_Arguments* pArguments); diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index c2101f7719..2e61a06885 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -822,3 +822,19 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_SetIndexDataBind( iIndex = iCount - 1; } } + +CXFA_ResolveNodesData::CXFA_ResolveNodesData(CXFA_ScriptContext* pSC) + : m_pSC(pSC), + m_CurNode(NULL), + m_wsName(), + m_uHashName(XFA_HASHCODE_None), + m_wsCondition(), + m_nLevel(0), + m_Nodes(), + m_dwStyles(XFA_RESOLVENODE_Children), + m_pScriptAttribute(NULL), + m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} + +CXFA_ResolveNodesData::~CXFA_ResolveNodesData() { + m_Nodes.RemoveAll(); +} diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h index 9789ffd7b8..0d932ef815 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h @@ -15,18 +15,9 @@ class CXFA_ScriptContext; class CXFA_ResolveNodesData { public: - CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL) - : m_pSC(pSC), - m_CurNode(NULL), - m_wsName(), - m_uHashName(XFA_HASHCODE_None), - m_wsCondition(), - m_nLevel(0), - m_Nodes(), - m_dwStyles(XFA_RESOLVENODE_Children), - m_pScriptAttribute(NULL), - m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} - ~CXFA_ResolveNodesData() { m_Nodes.RemoveAll(); } + CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL); + ~CXFA_ResolveNodesData(); + CXFA_ScriptContext* m_pSC; CXFA_Object* m_CurNode; CFX_WideString m_wsName; diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h index bba0fd5827..3339ff0852 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h @@ -13,7 +13,8 @@ class CScript_SignaturePseudoModel : public CXFA_OrdinaryObject { public: CScript_SignaturePseudoModel(CXFA_Document* pDocument); - ~CScript_SignaturePseudoModel(); + ~CScript_SignaturePseudoModel() override; + void Script_SignaturePseudoModel_Verify(CFXJSE_Arguments* pArguments); void Script_SignaturePseudoModel_Sign(CFXJSE_Arguments* pArguments); void Script_SignaturePseudoModel_Enumerate(CFXJSE_Arguments* pArguments); |