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