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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 CPDF_Array* GetArray() const; | 72 CPDF_Array* GetArray() const; |
73 | 73 |
74 void SetString(const CFX_ByteString& str); | 74 void SetString(const CFX_ByteString& str); |
75 | 75 |
76 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); | 76 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); |
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 IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } | 83 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } |
83 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } | 84 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } |
84 bool IsName() const { return m_Type == PDFOBJ_NAME; } | 85 bool IsName() const { return m_Type == PDFOBJ_NAME; } |
85 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } | 86 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } |
86 bool IsString() const { return m_Type == PDFOBJ_STRING; } | 87 bool IsString() const { return m_Type == PDFOBJ_STRING; } |
87 | 88 |
| 89 CPDF_Array* AsArray(); |
| 90 const CPDF_Array* AsArray() const; |
| 91 |
88 CPDF_Boolean* AsBoolean(); | 92 CPDF_Boolean* AsBoolean(); |
89 const CPDF_Boolean* AsBoolean() const; | 93 const CPDF_Boolean* AsBoolean() const; |
90 | 94 |
91 CPDF_Dictionary* AsDictionary(); | 95 CPDF_Dictionary* AsDictionary(); |
92 const CPDF_Dictionary* AsDictionary() const; | 96 const CPDF_Dictionary* AsDictionary() const; |
93 | 97 |
94 CPDF_Name* AsName(); | 98 CPDF_Name* AsName(); |
95 const CPDF_Name* AsName() const; | 99 const CPDF_Name* AsName() const; |
96 | 100 |
97 CPDF_Number* AsNumber(); | 101 CPDF_Number* AsNumber(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void AddNumber16(FX_FLOAT value) { AddNumber(value); } | 338 void AddNumber16(FX_FLOAT value) { AddNumber(value); } |
335 | 339 |
336 FX_BOOL Identical(CPDF_Array* pOther) const; | 340 FX_BOOL Identical(CPDF_Array* pOther) const; |
337 | 341 |
338 protected: | 342 protected: |
339 ~CPDF_Array(); | 343 ~CPDF_Array(); |
340 | 344 |
341 CFX_PtrArray m_Objects; | 345 CFX_PtrArray m_Objects; |
342 friend class CPDF_Object; | 346 friend class CPDF_Object; |
343 }; | 347 }; |
| 348 inline CPDF_Array* ToArray(CPDF_Object* obj) { |
| 349 return obj ? obj->AsArray() : nullptr; |
| 350 } |
| 351 inline const CPDF_Array* ToArray(const CPDF_Object* obj) { |
| 352 return obj ? obj->AsArray() : nullptr; |
| 353 } |
| 354 |
344 class CPDF_Dictionary : public CPDF_Object { | 355 class CPDF_Dictionary : public CPDF_Object { |
345 public: | 356 public: |
346 static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); } | 357 static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); } |
347 | 358 |
348 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {} | 359 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {} |
349 | 360 |
350 CPDF_Object* GetElement(const CFX_ByteStringC& key) const; | 361 CPDF_Object* GetElement(const CFX_ByteStringC& key) const; |
351 | 362 |
352 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; | 363 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; |
353 | 364 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 620 |
610 protected: | 621 protected: |
611 CFX_MapPtrToPtr m_IndirectObjs; | 622 CFX_MapPtrToPtr m_IndirectObjs; |
612 | 623 |
613 CPDF_Parser* m_pParser; | 624 CPDF_Parser* m_pParser; |
614 | 625 |
615 FX_DWORD m_LastObjNum; | 626 FX_DWORD m_LastObjNum; |
616 }; | 627 }; |
617 | 628 |
618 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 629 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |