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_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 12 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
11 #include "core/fpdfapi/parser/cpdf_stream.h" | 13 #include "core/fpdfapi/parser/cpdf_stream.h" |
12 #include "core/fxcrt/fx_string.h" | 14 #include "core/fxcrt/fx_string.h" |
13 #include "core/fxcrt/fx_system.h" | 15 #include "core/fxcrt/fx_system.h" |
14 | 16 |
15 class CPDF_StreamAcc { | 17 class CPDF_StreamAcc { |
16 public: | 18 public: |
17 CPDF_StreamAcc(); | 19 CPDF_StreamAcc(); |
18 ~CPDF_StreamAcc(); | 20 ~CPDF_StreamAcc(); |
19 | 21 |
20 void LoadAllData(const CPDF_Stream* pStream, | 22 void LoadAllData(const CPDF_Stream* pStream, |
21 bool bRawAccess = false, | 23 bool bRawAccess = false, |
22 uint32_t estimated_size = 0, | 24 uint32_t estimated_size = 0, |
23 bool bImageAcc = false); | 25 bool bImageAcc = false); |
24 | 26 |
25 const CPDF_Stream* GetStream() const { return m_pStream; } | 27 const CPDF_Stream* GetStream() const { return m_pStream; } |
26 CPDF_Dictionary* GetDict() const { | 28 CPDF_Dictionary* GetDict() const { |
27 return m_pStream ? m_pStream->GetDict() : nullptr; | 29 return m_pStream ? m_pStream->GetDict() : nullptr; |
28 } | 30 } |
29 | 31 |
30 const uint8_t* GetData() const; | 32 const uint8_t* GetData() const; |
31 uint32_t GetSize() const; | 33 uint32_t GetSize() const; |
32 const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } | 34 const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } |
33 const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } | 35 const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } |
34 uint8_t* DetachData(); | 36 std::unique_ptr<uint8_t, FxFreeDeleter> DetachData(); |
35 | 37 |
36 protected: | 38 protected: |
37 uint8_t* m_pData; | 39 uint8_t* m_pData; |
38 uint32_t m_dwSize; | 40 uint32_t m_dwSize; |
39 bool m_bNewBuf; | 41 bool m_bNewBuf; |
40 CFX_ByteString m_ImageDecoder; | 42 CFX_ByteString m_ImageDecoder; |
41 CPDF_Dictionary* m_pImageParam; | 43 CPDF_Dictionary* m_pImageParam; |
42 const CPDF_Stream* m_pStream; | 44 const CPDF_Stream* m_pStream; |
43 uint8_t* m_pSrcData; | 45 uint8_t* m_pSrcData; |
44 }; | 46 }; |
45 | 47 |
46 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ | 48 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_ |
OLD | NEW |