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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 int GetDirectType() const; | 78 int GetDirectType() const; |
79 | 79 |
80 FX_BOOL IsModified() const { return FALSE; } | 80 FX_BOOL IsModified() const { return FALSE; } |
81 | 81 |
82 bool IsArray() const { return m_Type == PDFOBJ_ARRAY; } | 82 bool IsArray() const { return m_Type == PDFOBJ_ARRAY; } |
83 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } | 83 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } |
84 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } | 84 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } |
85 bool IsName() const { return m_Type == PDFOBJ_NAME; } | 85 bool IsName() const { return m_Type == PDFOBJ_NAME; } |
86 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } | 86 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } |
| 87 bool IsReference() const { return m_Type == PDFOBJ_REFERENCE; } |
87 bool IsStream() const { return m_Type == PDFOBJ_STREAM; } | 88 bool IsStream() const { return m_Type == PDFOBJ_STREAM; } |
88 bool IsString() const { return m_Type == PDFOBJ_STRING; } | 89 bool IsString() const { return m_Type == PDFOBJ_STRING; } |
89 | 90 |
90 CPDF_Array* AsArray(); | 91 CPDF_Array* AsArray(); |
91 const CPDF_Array* AsArray() const; | 92 const CPDF_Array* AsArray() const; |
92 | 93 |
93 CPDF_Boolean* AsBoolean(); | 94 CPDF_Boolean* AsBoolean(); |
94 const CPDF_Boolean* AsBoolean() const; | 95 const CPDF_Boolean* AsBoolean() const; |
95 | 96 |
96 CPDF_Dictionary* AsDictionary(); | 97 CPDF_Dictionary* AsDictionary(); |
97 const CPDF_Dictionary* AsDictionary() const; | 98 const CPDF_Dictionary* AsDictionary() const; |
98 | 99 |
99 CPDF_Name* AsName(); | 100 CPDF_Name* AsName(); |
100 const CPDF_Name* AsName() const; | 101 const CPDF_Name* AsName() const; |
101 | 102 |
102 CPDF_Number* AsNumber(); | 103 CPDF_Number* AsNumber(); |
103 const CPDF_Number* AsNumber() const; | 104 const CPDF_Number* AsNumber() const; |
104 | 105 |
| 106 CPDF_Reference* AsReference(); |
| 107 const CPDF_Reference* AsReference() const; |
| 108 |
105 CPDF_Stream* AsStream(); | 109 CPDF_Stream* AsStream(); |
106 const CPDF_Stream* AsStream() const; | 110 const CPDF_Stream* AsStream() const; |
107 | 111 |
108 CPDF_String* AsString(); | 112 CPDF_String* AsString(); |
109 const CPDF_String* AsString() const; | 113 const CPDF_String* AsString() const; |
110 | 114 |
111 protected: | 115 protected: |
112 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} | 116 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} |
113 ~CPDF_Object() {} | 117 ~CPDF_Object() {} |
114 void Destroy(); | 118 void Destroy(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 FX_BOOL Identical(CPDF_Reference* pOther) const { | 597 FX_BOOL Identical(CPDF_Reference* pOther) const { |
594 return m_RefObjNum == pOther->m_RefObjNum; | 598 return m_RefObjNum == pOther->m_RefObjNum; |
595 } | 599 } |
596 | 600 |
597 protected: | 601 protected: |
598 CPDF_IndirectObjects* m_pObjList; | 602 CPDF_IndirectObjects* m_pObjList; |
599 | 603 |
600 FX_DWORD m_RefObjNum; | 604 FX_DWORD m_RefObjNum; |
601 friend class CPDF_Object; | 605 friend class CPDF_Object; |
602 }; | 606 }; |
| 607 inline CPDF_Reference* ToReference(CPDF_Object* obj) { |
| 608 return obj ? obj->AsReference() : nullptr; |
| 609 } |
| 610 inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { |
| 611 return obj ? obj->AsReference() : nullptr; |
| 612 } |
| 613 |
603 class CPDF_IndirectObjects { | 614 class CPDF_IndirectObjects { |
604 public: | 615 public: |
605 CPDF_IndirectObjects(CPDF_Parser* pParser); | 616 CPDF_IndirectObjects(CPDF_Parser* pParser); |
606 | 617 |
607 ~CPDF_IndirectObjects(); | 618 ~CPDF_IndirectObjects(); |
608 | 619 |
609 CPDF_Object* GetIndirectObject(FX_DWORD objnum, | 620 CPDF_Object* GetIndirectObject(FX_DWORD objnum, |
610 struct PARSE_CONTEXT* pContext = NULL); | 621 struct PARSE_CONTEXT* pContext = NULL); |
611 | 622 |
612 int GetIndirectType(FX_DWORD objnum); | 623 int GetIndirectType(FX_DWORD objnum); |
(...skipping 18 matching lines...) Expand all Loading... |
631 | 642 |
632 protected: | 643 protected: |
633 CFX_MapPtrToPtr m_IndirectObjs; | 644 CFX_MapPtrToPtr m_IndirectObjs; |
634 | 645 |
635 CPDF_Parser* m_pParser; | 646 CPDF_Parser* m_pParser; |
636 | 647 |
637 FX_DWORD m_LastObjNum; | 648 FX_DWORD m_LastObjNum; |
638 }; | 649 }; |
639 | 650 |
640 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 651 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |