OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
9 | 9 |
10 #include "../fxcrt/fx_coordinates.h" | 10 #include "../fxcrt/fx_coordinates.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 CPDF_Array* GetArray() const; | 73 CPDF_Array* GetArray() const; |
74 | 74 |
75 void SetString(const CFX_ByteString& str); | 75 void SetString(const CFX_ByteString& str); |
76 | 76 |
77 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); | 77 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); |
78 | 78 |
79 int GetDirectType() const; | 79 int GetDirectType() const; |
80 | 80 |
81 FX_BOOL IsModified() const { return FALSE; } | 81 FX_BOOL IsModified() const { return FALSE; } |
82 | 82 |
| 83 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } |
| 84 |
| 85 CPDF_Dictionary* AsDictionary(); |
| 86 const CPDF_Dictionary* AsDictionary() const; |
| 87 |
83 protected: | 88 protected: |
84 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} | 89 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} |
85 ~CPDF_Object() {} | 90 ~CPDF_Object() {} |
86 void Destroy(); | 91 void Destroy(); |
87 | 92 |
88 static const int OBJECT_REF_MAX_DEPTH = 128; | 93 static const int OBJECT_REF_MAX_DEPTH = 128; |
89 static int s_nCurRefDepth; | 94 static int s_nCurRefDepth; |
90 FX_DWORD m_Type; | 95 FX_DWORD m_Type; |
91 FX_DWORD m_ObjNum; | 96 FX_DWORD m_ObjNum; |
92 FX_DWORD m_GenNum; | 97 FX_DWORD m_GenNum; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 402 |
398 void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); | 403 void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); |
399 | 404 |
400 protected: | 405 protected: |
401 ~CPDF_Dictionary(); | 406 ~CPDF_Dictionary(); |
402 | 407 |
403 CFX_CMapByteStringToPtr m_Map; | 408 CFX_CMapByteStringToPtr m_Map; |
404 | 409 |
405 friend class CPDF_Object; | 410 friend class CPDF_Object; |
406 }; | 411 }; |
| 412 inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { |
| 413 return obj ? obj->AsDictionary() : nullptr; |
| 414 } |
| 415 inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { |
| 416 return obj ? obj->AsDictionary() : nullptr; |
| 417 } |
| 418 |
407 class CPDF_Stream : public CPDF_Object { | 419 class CPDF_Stream : public CPDF_Object { |
408 public: | 420 public: |
409 static CPDF_Stream* Create(uint8_t* pData, | 421 static CPDF_Stream* Create(uint8_t* pData, |
410 FX_DWORD size, | 422 FX_DWORD size, |
411 CPDF_Dictionary* pDict) { | 423 CPDF_Dictionary* pDict) { |
412 return new CPDF_Stream(pData, size, pDict); | 424 return new CPDF_Stream(pData, size, pDict); |
413 } | 425 } |
414 | 426 |
415 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); | 427 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
416 | 428 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 614 |
603 protected: | 615 protected: |
604 CFX_MapPtrToPtr m_IndirectObjs; | 616 CFX_MapPtrToPtr m_IndirectObjs; |
605 | 617 |
606 CPDF_Parser* m_pParser; | 618 CPDF_Parser* m_pParser; |
607 | 619 |
608 FX_DWORD m_LastObjNum; | 620 FX_DWORD m_LastObjNum; |
609 }; | 621 }; |
610 | 622 |
611 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 623 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |