diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-23 20:04:39 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-23 20:04:39 +0000 |
commit | 4e4147eccd25e66a5c61712121c30c8d5f2ba56c (patch) | |
tree | 054553a3d2b26118288bbfa70fc49dfc4cd503fa /core/fxcrt/cfx_seekablestreamproxy.h | |
parent | a3dd6c390ebc2af63fc0b706a4747315acef02bf (diff) | |
download | pdfium-4e4147eccd25e66a5c61712121c30c8d5f2ba56c.tar.xz |
Make CFX_SeekableStreamProxy a subclass of IFX_SeekableReadStreamchromium/3405
This CL changes CFX_SeekableStreamProxy to be an IFX_SeekableReadStream
subclass.
This is a reland of https://pdfium-review.googlesource.com/c/pdfium/+/30879
after fix bad merge.
Change-Id: Iad58abe7e065541867f202059a944e9be4da5713
Reviewed-on: https://pdfium-review.googlesource.com/31195
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_seekablestreamproxy.h')
-rw-r--r-- | core/fxcrt/cfx_seekablestreamproxy.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h index 5e0eecb87b..d389baf13f 100644 --- a/core/fxcrt/cfx_seekablestreamproxy.h +++ b/core/fxcrt/cfx_seekablestreamproxy.h @@ -13,7 +13,7 @@ #include "core/fxcrt/fx_system.h" #include "core/fxcrt/retain_ptr.h" -class CFX_SeekableStreamProxy : public Retainable { +class CFX_SeekableStreamProxy : public IFX_SeekableReadStream { public: enum class From { Begin = 0, @@ -23,27 +23,28 @@ class CFX_SeekableStreamProxy : public Retainable { template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - FX_FILESIZE GetLength() const { return m_pStream->GetSize(); } - FX_FILESIZE GetPosition() { return m_iPosition; } - size_t GetBOMLength() const { return m_wBOMLength; } - bool IsEOF() const { return m_iPosition >= GetLength(); } + FX_FILESIZE GetSize() override; + FX_FILESIZE GetPosition() override; + bool IsEOF() override; - void Seek(From eSeek, FX_FILESIZE iOffset); - size_t ReadString(wchar_t* pStr, size_t iMaxLength, bool* bEOS); + size_t ReadBlock(void* pStr, size_t size) override; + bool ReadBlock(void* pStr, FX_FILESIZE offset, size_t size) override; uint16_t GetCodePage() const { return m_wCodePage; } void SetCodePage(uint16_t wCodePage); private: - explicit CFX_SeekableStreamProxy(const RetainPtr<IFX_SeekableStream>& stream); + explicit CFX_SeekableStreamProxy( + const RetainPtr<IFX_SeekableReadStream>& stream); ~CFX_SeekableStreamProxy() override; + void Seek(From eSeek, FX_FILESIZE iOffset); size_t ReadData(uint8_t* pBuffer, size_t iBufferSize); uint16_t m_wCodePage; size_t m_wBOMLength; FX_FILESIZE m_iPosition; - RetainPtr<IFX_SeekableStream> m_pStream; + RetainPtr<IFX_SeekableReadStream> m_pStream; }; #endif // CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_ |