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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 FX_BOOL Identical(CPDF_Reference* pOther) const { | 601 FX_BOOL Identical(CPDF_Reference* pOther) const { |
598 return m_RefObjNum == pOther->m_RefObjNum; | 602 return m_RefObjNum == pOther->m_RefObjNum; |
599 } | 603 } |
600 | 604 |
601 protected: | 605 protected: |
602 CPDF_IndirectObjects* m_pObjList; | 606 CPDF_IndirectObjects* m_pObjList; |
603 | 607 |
604 FX_DWORD m_RefObjNum; | 608 FX_DWORD m_RefObjNum; |
605 friend class CPDF_Object; | 609 friend class CPDF_Object; |
606 }; | 610 }; |
| 611 inline CPDF_Reference* ToReference(CPDF_Object* obj) { |
| 612 return obj ? obj->AsReference() : nullptr; |
| 613 } |
| 614 inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { |
| 615 return obj ? obj->AsReference() : nullptr; |
| 616 } |
| 617 |
607 class CPDF_IndirectObjects { | 618 class CPDF_IndirectObjects { |
608 public: | 619 public: |
609 CPDF_IndirectObjects(CPDF_Parser* pParser); | 620 CPDF_IndirectObjects(CPDF_Parser* pParser); |
610 | 621 |
611 ~CPDF_IndirectObjects(); | 622 ~CPDF_IndirectObjects(); |
612 | 623 |
613 CPDF_Object* GetIndirectObject(FX_DWORD objnum, | 624 CPDF_Object* GetIndirectObject(FX_DWORD objnum, |
614 struct PARSE_CONTEXT* pContext = NULL); | 625 struct PARSE_CONTEXT* pContext = NULL); |
615 | 626 |
616 int GetIndirectType(FX_DWORD objnum); | 627 int GetIndirectType(FX_DWORD objnum); |
(...skipping 18 matching lines...) Expand all Loading... |
635 | 646 |
636 protected: | 647 protected: |
637 CFX_MapPtrToPtr m_IndirectObjs; | 648 CFX_MapPtrToPtr m_IndirectObjs; |
638 | 649 |
639 CPDF_Parser* m_pParser; | 650 CPDF_Parser* m_pParser; |
640 | 651 |
641 FX_DWORD m_LastObjNum; | 652 FX_DWORD m_LastObjNum; |
642 }; | 653 }; |
643 | 654 |
644 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 655 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |