xref: /aosp_15_r20/external/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
8 #define XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
9 
10 #include <vector>
11 
12 #include "v8/include/cppgc/member.h"
13 #include "v8/include/cppgc/visitor.h"
14 #include "xfa/fxfa/parser/cxfa_treelist.h"
15 
16 class CXFA_Document;
17 class CXFA_Node;
18 
19 class CXFA_ArrayNodeList final : public CXFA_TreeList {
20  public:
21   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
22   ~CXFA_ArrayNodeList() override;
23 
24   void Trace(cppgc::Visitor* visitor) const override;
25 
26   // CXFA_TreeList:
27   size_t GetLength() override;
28   bool Append(CXFA_Node* pNode) override;
29   bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
30   void Remove(CXFA_Node* pNode) override;
31   CXFA_Node* Item(size_t iIndex) override;
32 
33   void SetArrayNodeList(const std::vector<CXFA_Node*>& srcArray);
34 
35  private:
36   explicit CXFA_ArrayNodeList(CXFA_Document* pDocument);
37 
38   std::vector<cppgc::Member<CXFA_Node>> m_array;
39 };
40 
41 #endif  // XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
42