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