OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDF_STREAM_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ |
8 #define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ | 8 #define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ |
9 | 9 |
| 10 #include "core/include/fpdfapi/cpdf_dictionary.h" |
10 #include "core/include/fpdfapi/cpdf_object.h" | 11 #include "core/include/fpdfapi/cpdf_object.h" |
11 #include "core/include/fxcrt/fx_stream.h" | 12 #include "core/include/fxcrt/fx_stream.h" |
12 | 13 |
13 class CPDF_Stream : public CPDF_Object { | 14 class CPDF_Stream : public CPDF_Object { |
14 public: | 15 public: |
15 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); | 16 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
16 | 17 |
17 // CPDF_Object. | 18 // CPDF_Object. |
18 Type GetType() const override; | 19 Type GetType() const override; |
19 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; | 20 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; |
(...skipping 30 matching lines...) Expand all Loading... |
50 CPDF_Dictionary* m_pDict; | 51 CPDF_Dictionary* m_pDict; |
51 FX_DWORD m_dwSize; | 52 FX_DWORD m_dwSize; |
52 FX_DWORD m_GenNum; | 53 FX_DWORD m_GenNum; |
53 | 54 |
54 union { | 55 union { |
55 uint8_t* m_pDataBuf; | 56 uint8_t* m_pDataBuf; |
56 IFX_FileRead* m_pFile; | 57 IFX_FileRead* m_pFile; |
57 }; | 58 }; |
58 }; | 59 }; |
59 | 60 |
60 inline CPDF_Stream* ToStream(CPDF_Object* obj) { | |
61 return obj ? obj->AsStream() : nullptr; | |
62 } | |
63 | |
64 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { | |
65 return obj ? obj->AsStream() : nullptr; | |
66 } | |
67 | |
68 class CPDF_StreamAcc { | |
69 public: | |
70 CPDF_StreamAcc(); | |
71 ~CPDF_StreamAcc(); | |
72 | |
73 void LoadAllData(const CPDF_Stream* pStream, | |
74 FX_BOOL bRawAccess = FALSE, | |
75 FX_DWORD estimated_size = 0, | |
76 FX_BOOL bImageAcc = FALSE); | |
77 | |
78 const CPDF_Stream* GetStream() const { return m_pStream; } | |
79 CPDF_Dictionary* GetDict() const { | |
80 return m_pStream ? m_pStream->GetDict() : nullptr; | |
81 } | |
82 const uint8_t* GetData() const; | |
83 FX_DWORD GetSize() const; | |
84 const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } | |
85 const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } | |
86 | |
87 uint8_t* DetachData(); | |
88 | |
89 protected: | |
90 uint8_t* m_pData; | |
91 FX_DWORD m_dwSize; | |
92 FX_BOOL m_bNewBuf; | |
93 CFX_ByteString m_ImageDecoder; | |
94 CPDF_Dictionary* m_pImageParam; | |
95 const CPDF_Stream* m_pStream; | |
96 uint8_t* m_pSrcData; | |
97 }; | |
98 | |
99 #endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ | 61 #endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ |
OLD | NEW |