| 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 IsStream() const { return m_Type == PDFOBJ_STREAM; } |
| 87 bool IsString() const { return m_Type == PDFOBJ_STRING; } | 88 bool IsString() const { return m_Type == PDFOBJ_STRING; } |
| 88 | 89 |
| 89 CPDF_Array* AsArray(); | 90 CPDF_Array* AsArray(); |
| 90 const CPDF_Array* AsArray() const; | 91 const CPDF_Array* AsArray() const; |
| 91 | 92 |
| 92 CPDF_Boolean* AsBoolean(); | 93 CPDF_Boolean* AsBoolean(); |
| 93 const CPDF_Boolean* AsBoolean() const; | 94 const CPDF_Boolean* AsBoolean() const; |
| 94 | 95 |
| 95 CPDF_Dictionary* AsDictionary(); | 96 CPDF_Dictionary* AsDictionary(); |
| 96 const CPDF_Dictionary* AsDictionary() const; | 97 const CPDF_Dictionary* AsDictionary() const; |
| 97 | 98 |
| 98 CPDF_Name* AsName(); | 99 CPDF_Name* AsName(); |
| 99 const CPDF_Name* AsName() const; | 100 const CPDF_Name* AsName() const; |
| 100 | 101 |
| 101 CPDF_Number* AsNumber(); | 102 CPDF_Number* AsNumber(); |
| 102 const CPDF_Number* AsNumber() const; | 103 const CPDF_Number* AsNumber() const; |
| 103 | 104 |
| 105 CPDF_Stream* AsStream(); |
| 106 const CPDF_Stream* AsStream() const; |
| 107 |
| 104 CPDF_String* AsString(); | 108 CPDF_String* AsString(); |
| 105 const CPDF_String* AsString() const; | 109 const CPDF_String* AsString() const; |
| 106 | 110 |
| 107 protected: | 111 protected: |
| 108 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} | 112 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} |
| 109 ~CPDF_Object() {} | 113 ~CPDF_Object() {} |
| 110 void Destroy(); | 114 void Destroy(); |
| 111 | 115 |
| 112 static const int OBJECT_REF_MAX_DEPTH = 128; | 116 static const int OBJECT_REF_MAX_DEPTH = 128; |
| 113 static int s_nCurRefDepth; | 117 static int s_nCurRefDepth; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 | 516 |
| 513 FX_FILESIZE m_FileOffset; | 517 FX_FILESIZE m_FileOffset; |
| 514 | 518 |
| 515 CPDF_CryptoHandler* m_pCryptoHandler; | 519 CPDF_CryptoHandler* m_pCryptoHandler; |
| 516 | 520 |
| 517 void InitStream(CPDF_Dictionary* pDict); | 521 void InitStream(CPDF_Dictionary* pDict); |
| 518 friend class CPDF_Object; | 522 friend class CPDF_Object; |
| 519 friend class CPDF_StreamAcc; | 523 friend class CPDF_StreamAcc; |
| 520 friend class CPDF_AttachmentAcc; | 524 friend class CPDF_AttachmentAcc; |
| 521 }; | 525 }; |
| 526 inline CPDF_Stream* ToStream(CPDF_Object* obj) { |
| 527 return obj ? obj->AsStream() : nullptr; |
| 528 } |
| 529 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { |
| 530 return obj ? obj->AsStream() : nullptr; |
| 531 } |
| 532 |
| 522 class CPDF_StreamAcc { | 533 class CPDF_StreamAcc { |
| 523 public: | 534 public: |
| 524 CPDF_StreamAcc(); | 535 CPDF_StreamAcc(); |
| 525 | 536 |
| 526 ~CPDF_StreamAcc(); | 537 ~CPDF_StreamAcc(); |
| 527 | 538 |
| 528 void LoadAllData(const CPDF_Stream* pStream, | 539 void LoadAllData(const CPDF_Stream* pStream, |
| 529 FX_BOOL bRawAccess = FALSE, | 540 FX_BOOL bRawAccess = FALSE, |
| 530 FX_DWORD estimated_size = 0, | 541 FX_DWORD estimated_size = 0, |
| 531 FX_BOOL bImageAcc = FALSE); | 542 FX_BOOL bImageAcc = FALSE); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 631 |
| 621 protected: | 632 protected: |
| 622 CFX_MapPtrToPtr m_IndirectObjs; | 633 CFX_MapPtrToPtr m_IndirectObjs; |
| 623 | 634 |
| 624 CPDF_Parser* m_pParser; | 635 CPDF_Parser* m_pParser; |
| 625 | 636 |
| 626 FX_DWORD m_LastObjNum; | 637 FX_DWORD m_LastObjNum; |
| 627 }; | 638 }; |
| 628 | 639 |
| 629 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 640 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
| OLD | NEW |