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