Chromium Code Reviews| 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 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 IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } |
| 82 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } | 82 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } |
| 83 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } | |
|
Lei Zhang
2015/10/21 14:45:50
Do we want to do alphabetical order, or PDFOBJ_FOO
dsinclair
2015/10/21 15:00:11
I'm doing alphabetical order as I think it makes t
| |
| 83 | 84 |
| 84 CPDF_Boolean* AsBoolean(); | 85 CPDF_Boolean* AsBoolean(); |
| 85 const CPDF_Boolean* AsBoolean() const; | 86 const CPDF_Boolean* AsBoolean() const; |
| 86 | 87 |
| 87 CPDF_Dictionary* AsDictionary(); | 88 CPDF_Dictionary* AsDictionary(); |
| 88 const CPDF_Dictionary* AsDictionary() const; | 89 const CPDF_Dictionary* AsDictionary() const; |
| 89 | 90 |
| 91 CPDF_Number* AsNumber(); | |
| 92 const CPDF_Number* AsNumber() const; | |
| 93 | |
| 90 protected: | 94 protected: |
| 91 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} | 95 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} |
| 92 ~CPDF_Object() {} | 96 ~CPDF_Object() {} |
| 93 void Destroy(); | 97 void Destroy(); |
| 94 | 98 |
| 95 static const int OBJECT_REF_MAX_DEPTH = 128; | 99 static const int OBJECT_REF_MAX_DEPTH = 128; |
| 96 static int s_nCurRefDepth; | 100 static int s_nCurRefDepth; |
| 97 FX_DWORD m_Type; | 101 FX_DWORD m_Type; |
| 98 FX_DWORD m_ObjNum; | 102 FX_DWORD m_ObjNum; |
| 99 FX_DWORD m_GenNum; | 103 FX_DWORD m_GenNum; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 protected: | 175 protected: |
| 172 FX_BOOL m_bInteger; | 176 FX_BOOL m_bInteger; |
| 173 | 177 |
| 174 union { | 178 union { |
| 175 int m_Integer; | 179 int m_Integer; |
| 176 | 180 |
| 177 FX_FLOAT m_Float; | 181 FX_FLOAT m_Float; |
| 178 }; | 182 }; |
| 179 friend class CPDF_Object; | 183 friend class CPDF_Object; |
| 180 }; | 184 }; |
| 185 inline CPDF_Number* ToNumber(CPDF_Object* obj) { | |
| 186 return obj ? obj->AsNumber() : nullptr; | |
| 187 } | |
| 188 inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { | |
| 189 return obj ? obj->AsNumber() : nullptr; | |
| 190 } | |
| 191 | |
| 181 class CPDF_String : public CPDF_Object { | 192 class CPDF_String : public CPDF_Object { |
| 182 public: | 193 public: |
| 183 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) { | 194 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) { |
| 184 return new CPDF_String(str, bHex); | 195 return new CPDF_String(str, bHex); |
| 185 } | 196 } |
| 186 | 197 |
| 187 static CPDF_String* Create(const CFX_WideString& str) { | 198 static CPDF_String* Create(const CFX_WideString& str) { |
| 188 return new CPDF_String(str); | 199 return new CPDF_String(str); |
| 189 } | 200 } |
| 190 | 201 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 | 586 |
| 576 protected: | 587 protected: |
| 577 CFX_MapPtrToPtr m_IndirectObjs; | 588 CFX_MapPtrToPtr m_IndirectObjs; |
| 578 | 589 |
| 579 CPDF_Parser* m_pParser; | 590 CPDF_Parser* m_pParser; |
| 580 | 591 |
| 581 FX_DWORD m_LastObjNum; | 592 FX_DWORD m_LastObjNum; |
| 582 }; | 593 }; |
| 583 | 594 |
| 584 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 595 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
| OLD | NEW |