| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 CPDF_Array* GetArray() const; | 71 CPDF_Array* GetArray() const; |
| 72 | 72 |
| 73 void SetString(const CFX_ByteString& str); | 73 void SetString(const CFX_ByteString& str); |
| 74 | 74 |
| 75 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); | 75 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); |
| 76 | 76 |
| 77 int GetDirectType() const; | 77 int GetDirectType() const; |
| 78 | 78 |
| 79 FX_BOOL IsModified() const { return FALSE; } | 79 FX_BOOL IsModified() const { return FALSE; } |
| 80 | 80 |
| 81 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } |
| 81 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } | 82 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } |
| 82 | 83 |
| 84 CPDF_Boolean* AsBoolean(); |
| 85 const CPDF_Boolean* AsBoolean() const; |
| 86 |
| 83 CPDF_Dictionary* AsDictionary(); | 87 CPDF_Dictionary* AsDictionary(); |
| 84 const CPDF_Dictionary* AsDictionary() const; | 88 const CPDF_Dictionary* AsDictionary() const; |
| 85 | 89 |
| 86 protected: | 90 protected: |
| 87 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} | 91 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} |
| 88 ~CPDF_Object() {} | 92 ~CPDF_Object() {} |
| 89 void Destroy(); | 93 void Destroy(); |
| 90 | 94 |
| 91 static const int OBJECT_REF_MAX_DEPTH = 128; | 95 static const int OBJECT_REF_MAX_DEPTH = 128; |
| 92 static int s_nCurRefDepth; | 96 static int s_nCurRefDepth; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 110 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {} | 114 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {} |
| 111 | 115 |
| 112 FX_BOOL Identical(CPDF_Boolean* pOther) const { | 116 FX_BOOL Identical(CPDF_Boolean* pOther) const { |
| 113 return m_bValue == pOther->m_bValue; | 117 return m_bValue == pOther->m_bValue; |
| 114 } | 118 } |
| 115 | 119 |
| 116 protected: | 120 protected: |
| 117 FX_BOOL m_bValue; | 121 FX_BOOL m_bValue; |
| 118 friend class CPDF_Object; | 122 friend class CPDF_Object; |
| 119 }; | 123 }; |
| 124 inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) { |
| 125 return obj ? obj->AsBoolean() : nullptr; |
| 126 } |
| 127 inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) { |
| 128 return obj ? obj->AsBoolean() : nullptr; |
| 129 } |
| 130 |
| 120 class CPDF_Number : public CPDF_Object { | 131 class CPDF_Number : public CPDF_Object { |
| 121 public: | 132 public: |
| 122 static CPDF_Number* Create(int value) { return new CPDF_Number(value); } | 133 static CPDF_Number* Create(int value) { return new CPDF_Number(value); } |
| 123 | 134 |
| 124 static CPDF_Number* Create(FX_FLOAT value) { return new CPDF_Number(value); } | 135 static CPDF_Number* Create(FX_FLOAT value) { return new CPDF_Number(value); } |
| 125 | 136 |
| 126 static CPDF_Number* Create(const CFX_ByteStringC& str) { | 137 static CPDF_Number* Create(const CFX_ByteStringC& str) { |
| 127 return new CPDF_Number(str); | 138 return new CPDF_Number(str); |
| 128 } | 139 } |
| 129 | 140 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 581 |
| 571 protected: | 582 protected: |
| 572 CFX_MapPtrToPtr m_IndirectObjs; | 583 CFX_MapPtrToPtr m_IndirectObjs; |
| 573 | 584 |
| 574 CPDF_Parser* m_pParser; | 585 CPDF_Parser* m_pParser; |
| 575 | 586 |
| 576 FX_DWORD m_LastObjNum; | 587 FX_DWORD m_LastObjNum; |
| 577 }; | 588 }; |
| 578 | 589 |
| 579 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 590 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
| OLD | NEW |