Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: xfa/fxfa/parser/xfa_object.h

Issue 2089443002: Convert XFA_ELEMENT to an enum class (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: More unknown checks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_localemgr.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FXFA_PARSER_XFA_OBJECT_H_ 7 #ifndef XFA_FXFA_PARSER_XFA_OBJECT_H_
8 #define XFA_FXFA_PARSER_XFA_OBJECT_H_ 8 #define XFA_FXFA_PARSER_XFA_OBJECT_H_
9 9
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 CXFA_Node* AsNode(); 85 CXFA_Node* AsNode();
86 CXFA_OrdinaryObject* AsOrdinaryObject(); 86 CXFA_OrdinaryObject* AsOrdinaryObject();
87 CXFA_NodeList* AsNodeList(); 87 CXFA_NodeList* AsNodeList();
88 88
89 const CXFA_Node* AsNode() const; 89 const CXFA_Node* AsNode() const;
90 const CXFA_OrdinaryObject* AsOrdinaryObject() const; 90 const CXFA_OrdinaryObject* AsOrdinaryObject() const;
91 const CXFA_NodeList* AsNodeList() const; 91 const CXFA_NodeList* AsNodeList() const;
92 92
93 XFA_ELEMENT GetClassID() const; 93 XFA_Element GetClassID() const;
94 void GetClassName(CFX_WideStringC& wsName) const; 94 void GetClassName(CFX_WideStringC& wsName) const;
95 uint32_t GetClassHashCode() const; 95 uint32_t GetClassHashCode() const;
96 void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, 96 void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
97 FX_BOOL bSetting, 97 FX_BOOL bSetting,
98 XFA_ATTRIBUTE eAttribute); 98 XFA_ATTRIBUTE eAttribute);
99 void ThrowException(int32_t iStringID, ...); 99 void ThrowException(int32_t iStringID, ...);
100 100
101 protected: 101 protected:
102 CXFA_Document* const m_pDocument; 102 CXFA_Document* const m_pDocument;
103 XFA_ObjectType m_objectType; 103 XFA_ObjectType m_objectType;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 CFX_MapPtrToPtr m_ValueMap; 143 CFX_MapPtrToPtr m_ValueMap;
144 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; 144 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap;
145 }; 145 };
146 146
147 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') 147 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
148 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') 148 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C')
149 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') 149 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M')
150 150
151 class CXFA_Node : public CXFA_Object { 151 class CXFA_Node : public CXFA_Object {
152 public: 152 public:
153 XFA_ELEMENT GetClassID() const { return m_eNodeClass; } 153 XFA_Element GetClassID() const { return m_eNodeClass; }
154 uint32_t GetPacketID() const { return m_ePacket; } 154 uint32_t GetPacketID() const { return m_ePacket; }
155 155
156 void SetFlag(uint32_t dwFlag, bool bNotify); 156 void SetFlag(uint32_t dwFlag, bool bNotify);
157 void ClearFlag(uint32_t dwFlag); 157 void ClearFlag(uint32_t dwFlag);
158 158
159 bool IsInitialized() const { return HasFlag(XFA_NodeFlag_Initialized); } 159 bool IsInitialized() const { return HasFlag(XFA_NodeFlag_Initialized); }
160 bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); } 160 bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); }
161 bool IsUserInteractive() const { 161 bool IsUserInteractive() const {
162 return HasFlag(XFA_NodeFlag_UserInteractive); 162 return HasFlag(XFA_NodeFlag_UserInteractive);
163 } 163 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 FX_BOOL SetUserData(void* pKey, 286 FX_BOOL SetUserData(void* pKey,
287 void* pData, 287 void* pData,
288 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); 288 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
289 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); 289 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE);
290 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { 290 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) {
291 void* pData; 291 void* pData;
292 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL; 292 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL;
293 } 293 }
294 CXFA_Node* GetProperty(int32_t index, 294 CXFA_Node* GetProperty(int32_t index,
295 XFA_ELEMENT eProperty, 295 XFA_Element eProperty,
296 FX_BOOL bCreateProperty = TRUE); 296 FX_BOOL bCreateProperty = TRUE);
297 int32_t CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE); 297 int32_t CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild = FALSE);
298 CXFA_Node* GetChild(int32_t index, 298 CXFA_Node* GetChild(int32_t index,
299 XFA_ELEMENT eElement, 299 XFA_Element eElement,
300 FX_BOOL bOnlyChild = FALSE); 300 FX_BOOL bOnlyChild = FALSE);
301 int32_t InsertChild(int32_t index, CXFA_Node* pNode); 301 int32_t InsertChild(int32_t index, CXFA_Node* pNode);
302 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); 302 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL);
303 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); 303 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true);
304 CXFA_Node* Clone(FX_BOOL bRecursive); 304 CXFA_Node* Clone(FX_BOOL bRecursive);
305 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; 305 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
306 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const; 306 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const;
307 int32_t GetNodeList(CXFA_NodeArray& nodes, 307 int32_t GetNodeList(CXFA_NodeArray& nodes,
308 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | 308 uint32_t dwTypeFilter = XFA_NODEFILTER_Children |
309 XFA_NODEFILTER_Properties, 309 XFA_NODEFILTER_Properties,
310 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, 310 XFA_Element eElementFilter = XFA_Element::Unknown,
311 int32_t iLevel = 1); 311 int32_t iLevel = 1);
312 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, 312 CXFA_Node* CreateSamePacketNode(XFA_Element eElement,
313 uint32_t dwFlags = XFA_NodeFlag_Initialized); 313 uint32_t dwFlags = XFA_NodeFlag_Initialized);
314 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive); 314 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive);
315 CXFA_Node* GetTemplateNode() const; 315 CXFA_Node* GetTemplateNode() const;
316 void SetTemplateNode(CXFA_Node* pTemplateNode); 316 void SetTemplateNode(CXFA_Node* pTemplateNode);
317 CXFA_Node* GetDataDescriptionNode(); 317 CXFA_Node* GetDataDescriptionNode();
318 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode); 318 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode);
319 CXFA_Node* GetBindData(); 319 CXFA_Node* GetBindData();
320 int32_t GetBindItems(CXFA_NodeArray& formItems); 320 int32_t GetBindItems(CXFA_NodeArray& formItems);
321 int32_t AddBindItem(CXFA_Node* pFormNode); 321 int32_t AddBindItem(CXFA_Node* pFormNode);
322 int32_t RemoveBindItem(CXFA_Node* pFormNode); 322 int32_t RemoveBindItem(CXFA_Node* pFormNode);
323 FX_BOOL HasBindItem(); 323 FX_BOOL HasBindItem();
324 CXFA_WidgetData* GetWidgetData(); 324 CXFA_WidgetData* GetWidgetData();
325 CXFA_WidgetData* GetContainerWidgetData(); 325 CXFA_WidgetData* GetContainerWidgetData();
326 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName); 326 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName);
327 XFA_ATTRIBUTEENUM GetIntact(); 327 XFA_ATTRIBUTEENUM GetIntact();
328 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; 328 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const;
329 CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const; 329 CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const;
330 CXFA_Node* GetFirstChildByClass(XFA_ELEMENT eNodeClass) const; 330 CXFA_Node* GetFirstChildByClass(XFA_Element eNodeClass) const;
331 CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const; 331 CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const;
332 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; 332 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const;
333 CXFA_Node* GetNextSameClassSibling(XFA_ELEMENT eNodeClass) const; 333 CXFA_Node* GetNextSameClassSibling(XFA_Element eNodeClass) const;
334 int32_t GetNodeSameNameIndex() const; 334 int32_t GetNodeSameNameIndex() const;
335 int32_t GetNodeSameClassIndex() const; 335 int32_t GetNodeSameClassIndex() const;
336 void GetSOMExpression(CFX_WideString& wsSOMExpression); 336 void GetSOMExpression(CFX_WideString& wsSOMExpression);
337 CXFA_Node* GetInstanceMgrOfSubform(); 337 CXFA_Node* GetInstanceMgrOfSubform();
338 338
339 CXFA_Node* GetOccurNode(); 339 CXFA_Node* GetOccurNode();
340 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); 340 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
341 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); 341 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
342 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, 342 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
343 CFX_WideString wsExpression, 343 CFX_WideString wsExpression,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 void Script_Encrypt_Format(CFXJSE_Value* pValue, 616 void Script_Encrypt_Format(CFXJSE_Value* pValue,
617 FX_BOOL bSetting, 617 FX_BOOL bSetting,
618 XFA_ATTRIBUTE eAttribute); 618 XFA_ATTRIBUTE eAttribute);
619 void Script_Script_Stateless(CFXJSE_Value* pValue, 619 void Script_Script_Stateless(CFXJSE_Value* pValue,
620 FX_BOOL bSetting, 620 FX_BOOL bSetting,
621 XFA_ATTRIBUTE eAttribute); 621 XFA_ATTRIBUTE eAttribute);
622 622
623 protected: 623 protected:
624 friend class CXFA_Document; 624 friend class CXFA_Document;
625 625
626 CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_ELEMENT eElement); 626 CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_Element eElement);
627 ~CXFA_Node() override; 627 ~CXFA_Node() override;
628 628
629 bool HasFlag(XFA_NodeFlag dwFlag) const; 629 bool HasFlag(XFA_NodeFlag dwFlag) const;
630 CXFA_Node* Deprecated_GetPrevSibling(); 630 CXFA_Node* Deprecated_GetPrevSibling();
631 FX_BOOL SetValue(XFA_ATTRIBUTE eAttr, 631 FX_BOOL SetValue(XFA_ATTRIBUTE eAttr,
632 XFA_ATTRIBUTETYPE eType, 632 XFA_ATTRIBUTETYPE eType,
633 void* pValue, 633 void* pValue,
634 bool bNotify); 634 bool bNotify);
635 FX_BOOL GetValue(XFA_ATTRIBUTE eAttr, 635 FX_BOOL GetValue(XFA_ATTRIBUTE eAttr,
636 XFA_ATTRIBUTETYPE eType, 636 XFA_ATTRIBUTETYPE eType,
637 FX_BOOL bUseDefault, 637 FX_BOOL bUseDefault,
638 void*& pValue); 638 void*& pValue);
639 void OnRemoved(bool bNotify); 639 void OnRemoved(bool bNotify);
640 void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify); 640 void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
641 void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, FX_BOOL bScriptModify); 641 void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, FX_BOOL bScriptModify);
642 int32_t execSingleEventByName(const CFX_WideStringC& wsEventName, 642 int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
643 XFA_ELEMENT eElementType); 643 XFA_Element eElementType);
644 FX_BOOL SetScriptContent(const CFX_WideString& wsContent, 644 FX_BOOL SetScriptContent(const CFX_WideString& wsContent,
645 const CFX_WideString& wsXMLValue, 645 const CFX_WideString& wsXMLValue,
646 bool bNotify = true, 646 bool bNotify = true,
647 FX_BOOL bScriptModify = FALSE, 647 FX_BOOL bScriptModify = FALSE,
648 FX_BOOL bSyncData = TRUE); 648 FX_BOOL bSyncData = TRUE);
649 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); 649 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE);
650 XFA_MAPMODULEDATA* CreateMapModuleData(); 650 XFA_MAPMODULEDATA* CreateMapModuleData();
651 XFA_MAPMODULEDATA* GetMapModuleData() const; 651 XFA_MAPMODULEDATA* GetMapModuleData() const;
652 void SetMapModuleValue(void* pKey, void* pValue); 652 void SetMapModuleValue(void* pKey, void* pValue);
653 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); 653 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue);
(...skipping 14 matching lines...) Expand all
668 void MoveBufferMapData(CXFA_Node* pSrcModule, 668 void MoveBufferMapData(CXFA_Node* pSrcModule,
669 CXFA_Node* pDstModule, 669 CXFA_Node* pDstModule,
670 void* pKey, 670 void* pKey,
671 FX_BOOL bRecursive = FALSE); 671 FX_BOOL bRecursive = FALSE);
672 672
673 CXFA_Node* m_pNext; 673 CXFA_Node* m_pNext;
674 CXFA_Node* m_pChild; 674 CXFA_Node* m_pChild;
675 CXFA_Node* m_pLastChild; 675 CXFA_Node* m_pLastChild;
676 CXFA_Node* m_pParent; 676 CXFA_Node* m_pParent;
677 CFDE_XMLNode* m_pXMLNode; 677 CFDE_XMLNode* m_pXMLNode;
678 XFA_ELEMENT m_eNodeClass; 678 XFA_Element m_eNodeClass;
679 uint16_t m_ePacket; 679 uint16_t m_ePacket;
680 uint16_t m_uNodeFlags; 680 uint16_t m_uNodeFlags;
681 uint32_t m_dwNameHash; 681 uint32_t m_dwNameHash;
682 CXFA_Node* m_pAuxNode; 682 CXFA_Node* m_pAuxNode;
683 XFA_MAPMODULEDATA* m_pMapModuleData; 683 XFA_MAPMODULEDATA* m_pMapModuleData;
684 }; 684 };
685 685
686 class CXFA_OrdinaryObject : public CXFA_Object { 686 class CXFA_OrdinaryObject : public CXFA_Object {
687 public: 687 public:
688 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement); 688 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_Element eElement);
689 ~CXFA_OrdinaryObject() override; 689 ~CXFA_OrdinaryObject() override;
690 690
691 XFA_ELEMENT GetClassID() const; 691 XFA_Element GetClassID() const;
692 uint32_t GetScriptObjHash() const; 692 uint32_t GetScriptObjHash() const;
693 693
694 protected: 694 protected:
695 XFA_ELEMENT m_eNodeClass; 695 XFA_Element m_eNodeClass;
696 uint32_t m_uScriptHash; 696 uint32_t m_uScriptHash;
697 }; 697 };
698 698
699 class CXFA_ThisProxy : public CXFA_Object { 699 class CXFA_ThisProxy : public CXFA_Object {
700 public: 700 public:
701 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); 701 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode);
702 ~CXFA_ThisProxy() override; 702 ~CXFA_ThisProxy() override;
703 703
704 CXFA_Node* GetThisNode() const; 704 CXFA_Node* GetThisNode() const;
705 CXFA_Node* GetScriptNode() const; 705 CXFA_Node* GetScriptNode() const;
706 706
707 private: 707 private:
708 CXFA_Node* m_pThisNode; 708 CXFA_Node* m_pThisNode;
709 CXFA_Node* m_pScriptNode; 709 CXFA_Node* m_pScriptNode;
710 }; 710 };
711 711
712 class CXFA_NodeList : public CXFA_Object { 712 class CXFA_NodeList : public CXFA_Object {
713 public: 713 public:
714 explicit CXFA_NodeList(CXFA_Document* pDocument); 714 explicit CXFA_NodeList(CXFA_Document* pDocument);
715 ~CXFA_NodeList() override; 715 ~CXFA_NodeList() override;
716 716
717 XFA_ELEMENT GetClassID() const; 717 XFA_Element GetClassID() const;
718 CXFA_Node* NamedItem(const CFX_WideStringC& wsName); 718 CXFA_Node* NamedItem(const CFX_WideStringC& wsName);
719 virtual int32_t GetLength() = 0; 719 virtual int32_t GetLength() = 0;
720 virtual FX_BOOL Append(CXFA_Node* pNode) = 0; 720 virtual FX_BOOL Append(CXFA_Node* pNode) = 0;
721 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; 721 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
722 virtual FX_BOOL Remove(CXFA_Node* pNode) = 0; 722 virtual FX_BOOL Remove(CXFA_Node* pNode) = 0;
723 virtual CXFA_Node* Item(int32_t iIndex) = 0; 723 virtual CXFA_Node* Item(int32_t iIndex) = 0;
724 724
725 void Script_ListClass_Append(CFXJSE_Arguments* pArguments); 725 void Script_ListClass_Append(CFXJSE_Arguments* pArguments);
726 void Script_ListClass_Insert(CFXJSE_Arguments* pArguments); 726 void Script_ListClass_Insert(CFXJSE_Arguments* pArguments);
727 void Script_ListClass_Remove(CFXJSE_Arguments* pArguments); 727 void Script_ListClass_Remove(CFXJSE_Arguments* pArguments);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 824
825 inline CXFA_Node* ToNode(CXFA_Object* pObj) { 825 inline CXFA_Node* ToNode(CXFA_Object* pObj) {
826 return pObj ? pObj->AsNode() : nullptr; 826 return pObj ? pObj->AsNode() : nullptr;
827 } 827 }
828 828
829 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { 829 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) {
830 return pObj ? pObj->AsNode() : nullptr; 830 return pObj ? pObj->AsNode() : nullptr;
831 } 831 }
832 832
833 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ 833 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_localemgr.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698