OLD | NEW |
| (Empty) |
1 // Copyright 2016 PDFium Authors. All rights reserved. | |
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 CORE_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ | |
8 #define CORE_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ | |
9 | |
10 #include "core/include/fpdfapi/cpdf_indirect_object_holder.h" | |
11 #include "core/include/fpdfapi/cpdf_object.h" | |
12 #include "core/include/fxcrt/fx_basic.h" | |
13 #include "core/include/fxcrt/fx_coordinates.h" | |
14 | |
15 class CPDF_Array : public CPDF_Object { | |
16 public: | |
17 CPDF_Array(); | |
18 | |
19 // CPDF_Object. | |
20 Type GetType() const override; | |
21 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; | |
22 CPDF_Array* GetArray() const override; | |
23 bool IsArray() const override; | |
24 CPDF_Array* AsArray() override; | |
25 const CPDF_Array* AsArray() const override; | |
26 | |
27 FX_DWORD GetCount() const { return m_Objects.GetSize(); } | |
28 CPDF_Object* GetElement(FX_DWORD index) const; | |
29 CPDF_Object* GetElementValue(FX_DWORD index) const; | |
30 CFX_Matrix GetMatrix(); | |
31 CFX_FloatRect GetRect(); | |
32 CFX_ByteString GetStringAt(FX_DWORD index) const; | |
33 CFX_ByteStringC GetConstStringAt(FX_DWORD index) const; | |
34 int GetIntegerAt(FX_DWORD index) const; | |
35 FX_FLOAT GetNumberAt(FX_DWORD index) const; | |
36 CPDF_Dictionary* GetDictAt(FX_DWORD index) const; | |
37 CPDF_Stream* GetStreamAt(FX_DWORD index) const; | |
38 CPDF_Array* GetArrayAt(FX_DWORD index) const; | |
39 FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); } | |
40 | |
41 void SetAt(FX_DWORD index, | |
42 CPDF_Object* pObj, | |
43 CPDF_IndirectObjectHolder* pObjs = nullptr); | |
44 void InsertAt(FX_DWORD index, | |
45 CPDF_Object* pObj, | |
46 CPDF_IndirectObjectHolder* pObjs = nullptr); | |
47 void RemoveAt(FX_DWORD index, int nCount = 1); | |
48 | |
49 void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); | |
50 void AddNumber(FX_FLOAT f); | |
51 void AddInteger(int i); | |
52 void AddString(const CFX_ByteString& str); | |
53 void AddName(const CFX_ByteString& str); | |
54 void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); | |
55 void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) { | |
56 AddReference(pDoc, obj->GetObjNum()); | |
57 } | |
58 | |
59 protected: | |
60 ~CPDF_Array() override; | |
61 | |
62 CFX_ArrayTemplate<CPDF_Object*> m_Objects; | |
63 }; | |
64 | |
65 #endif // CORE_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ | |
OLD | NEW |