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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ | |
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ | |
9 | |
10 #include <set> | |
11 #include <vector> | |
12 | |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" | |
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" | |
15 #include "core/fxcrt/include/fx_basic.h" | |
16 #include "core/fxcrt/include/fx_coordinates.h" | |
17 | |
18 class CPDF_Array : public CPDF_Object { | |
19 public: | |
20 using iterator = std::vector<CPDF_Object*>::iterator; | |
21 using const_iterator = std::vector<CPDF_Object*>::const_iterator; | |
22 | |
23 CPDF_Array(); | |
24 | |
25 // CPDF_Object. | |
26 Type GetType() const override; | |
27 CPDF_Object* Clone() const override; | |
28 bool IsArray() const override; | |
29 CPDF_Array* AsArray() override; | |
30 const CPDF_Array* AsArray() const override; | |
31 | |
32 bool IsEmpty() const { return m_Objects.empty(); } | |
33 size_t GetCount() const { return m_Objects.size(); } | |
34 CPDF_Object* GetObjectAt(size_t index) const; | |
35 CPDF_Object* GetDirectObjectAt(size_t index) const; | |
36 CFX_ByteString GetStringAt(size_t index) const; | |
37 int GetIntegerAt(size_t index) const; | |
38 FX_FLOAT GetNumberAt(size_t index) const; | |
39 CPDF_Dictionary* GetDictAt(size_t index) const; | |
40 CPDF_Stream* GetStreamAt(size_t index) const; | |
41 CPDF_Array* GetArrayAt(size_t index) const; | |
42 FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); } | |
43 CFX_Matrix GetMatrix(); | |
44 CFX_FloatRect GetRect(); | |
45 | |
46 void SetAt(size_t index, CPDF_Object* pObj); | |
47 void InsertAt(size_t index, CPDF_Object* pObj); | |
48 void RemoveAt(size_t index, size_t nCount = 1); | |
49 | |
50 void Add(CPDF_Object* pObj); | |
51 void AddNumber(FX_FLOAT f); | |
52 void AddInteger(int i); | |
53 void AddString(const CFX_ByteString& str); | |
54 void AddName(const CFX_ByteString& str); | |
55 void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); | |
56 | |
57 iterator begin() { return m_Objects.begin(); } | |
58 iterator end() { return m_Objects.end(); } | |
59 const_iterator begin() const { return m_Objects.begin(); } | |
60 const_iterator end() const { return m_Objects.end(); } | |
61 | |
62 protected: | |
63 ~CPDF_Array() override; | |
64 | |
65 CPDF_Object* CloneNonCyclic( | |
66 bool bDirect, | |
67 std::set<const CPDF_Object*>* pVisited) const override; | |
68 | |
69 std::vector<CPDF_Object*> m_Objects; | |
70 }; | |
71 | |
72 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ | |
OLD | NEW |