diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-03-15 09:33:58 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-03-15 09:33:58 -0700 |
commit | 92bbb6fce88d1cb4d931da66adf690850ce62fd1 (patch) | |
tree | 5fa459547fd43200d341ef1849fad268e34743b5 /core/include | |
parent | 2df269c52741c12d63300cee806e96ae5d0b038f (diff) | |
download | pdfium-92bbb6fce88d1cb4d931da66adf690850ce62fd1.tar.xz |
Split CPDF_Stream/CPDF_StreamAcc into separate files
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1783933003 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fpdfapi/cpdf_object.h | 8 | ||||
-rw-r--r-- | core/include/fpdfapi/cpdf_stream.h | 40 | ||||
-rw-r--r-- | core/include/fpdfapi/cpdf_stream_acc.h | 46 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_resource.h | 1 |
4 files changed, 56 insertions, 39 deletions
diff --git a/core/include/fpdfapi/cpdf_object.h b/core/include/fpdfapi/cpdf_object.h index 2add5524a8..97499d140c 100644 --- a/core/include/fpdfapi/cpdf_object.h +++ b/core/include/fpdfapi/cpdf_object.h @@ -150,4 +150,12 @@ inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { return obj ? obj->AsReference() : nullptr; } +inline CPDF_Stream* ToStream(CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + +inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + #endif // CORE_INCLUDE_FPDFAPI_CPDF_OBJECT_H_ diff --git a/core/include/fpdfapi/cpdf_stream.h b/core/include/fpdfapi/cpdf_stream.h index fd3b8c0047..579a3a97be 100644 --- a/core/include/fpdfapi/cpdf_stream.h +++ b/core/include/fpdfapi/cpdf_stream.h @@ -7,6 +7,7 @@ #ifndef CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ #define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ +#include "core/include/fpdfapi/cpdf_dictionary.h" #include "core/include/fpdfapi/cpdf_object.h" #include "core/include/fxcrt/fx_stream.h" @@ -57,43 +58,4 @@ class CPDF_Stream : public CPDF_Object { }; }; -inline CPDF_Stream* ToStream(CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -class CPDF_StreamAcc { - public: - CPDF_StreamAcc(); - ~CPDF_StreamAcc(); - - void LoadAllData(const CPDF_Stream* pStream, - FX_BOOL bRawAccess = FALSE, - FX_DWORD estimated_size = 0, - FX_BOOL bImageAcc = FALSE); - - const CPDF_Stream* GetStream() const { return m_pStream; } - CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : nullptr; - } - const uint8_t* GetData() const; - FX_DWORD GetSize() const; - const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } - const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } - - uint8_t* DetachData(); - - protected: - uint8_t* m_pData; - FX_DWORD m_dwSize; - FX_BOOL m_bNewBuf; - CFX_ByteString m_ImageDecoder; - CPDF_Dictionary* m_pImageParam; - const CPDF_Stream* m_pStream; - uint8_t* m_pSrcData; -}; - #endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ diff --git a/core/include/fpdfapi/cpdf_stream_acc.h b/core/include/fpdfapi/cpdf_stream_acc.h new file mode 100644 index 0000000000..77ad272de3 --- /dev/null +++ b/core/include/fpdfapi/cpdf_stream_acc.h @@ -0,0 +1,46 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ +#define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ + +#include "core/include/fpdfapi/cpdf_stream.h" +#include "core/include/fpdfapi/cpdf_dictionary.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_StreamAcc { + public: + CPDF_StreamAcc(); + ~CPDF_StreamAcc(); + + void LoadAllData(const CPDF_Stream* pStream, + FX_BOOL bRawAccess = FALSE, + FX_DWORD estimated_size = 0, + FX_BOOL bImageAcc = FALSE); + + const CPDF_Stream* GetStream() const { return m_pStream; } + CPDF_Dictionary* GetDict() const { + return m_pStream ? m_pStream->GetDict() : nullptr; + } + + const uint8_t* GetData() const; + FX_DWORD GetSize() const; + const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } + const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } + uint8_t* DetachData(); + + protected: + uint8_t* m_pData; + FX_DWORD m_dwSize; + FX_BOOL m_bNewBuf; + CFX_ByteString m_ImageDecoder; + CPDF_Dictionary* m_pImageParam; + const CPDF_Stream* m_pStream; + uint8_t* m_pSrcData; +}; + +#endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index 06b1245b4b..7c19dd52c3 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -10,6 +10,7 @@ #include <map> #include "core/include/fpdfapi/cpdf_stream.h" +#include "core/include/fpdfapi/cpdf_stream_acc.h" #include "core/include/fxcrt/fx_system.h" #include "core/include/fxge/fx_font.h" |