Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_seekablestreamproxy.h
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_
8#define CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_
9
10#include <stddef.h>
11#include <stdint.h>
12
13#include "core/fxcrt/fx_codepage.h"
14#include "core/fxcrt/fx_stream.h"
15#include "core/fxcrt/fx_types.h"
16#include "core/fxcrt/retain_ptr.h"
17#include "core/fxcrt/span.h"
18
19class CFX_SeekableStreamProxy final : public Retainable {
20 public:
22
23 FX_FILESIZE GetSize() const; // Estimate under worst possible expansion.
24 bool IsEOF() const;
25
26 // Returns number of wchar_t elements placed into `buffer`.
27 size_t ReadBlock(pdfium::span<wchar_t> buffer);
28
29 FX_CodePage GetCodePage() const { return m_wCodePage; }
30 void SetCodePage(FX_CodePage wCodePage);
31
32 private:
33 enum class From {
34 Begin = 0,
35 Current,
36 };
37
38 explicit CFX_SeekableStreamProxy(
39 const RetainPtr<IFX_SeekableReadStream>& stream);
41
42 FX_FILESIZE GetPosition() const;
43 void Seek(From eSeek, FX_FILESIZE iOffset);
44 size_t ReadData(pdfium::span<uint8_t> buffer);
45
47 size_t m_wBOMLength = 0;
48 FX_FILESIZE m_iPosition = 0;
49 RetainPtr<IFX_SeekableReadStream> const m_pStream;
50};
51
52#endif // CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_
#define BOM_UTF8
#define BOM_UTF16_LE
#define BOM_UTF16_BE
#define BOM_UTF8_MASK
#define BOM_UTF16_MASK
#define DCHECK
Definition check.h:33
size_t ReadBlock(pdfium::span< wchar_t > buffer)
void SetCodePage(FX_CodePage wCodePage)
~CFX_SeekableStreamProxy() override
FX_CodePage FX_GetACP()
FX_CodePage
Definition fx_codepage.h:19
pdfium::CheckedNumeric< FX_FILESIZE > FX_SAFE_FILESIZE
#define FX_FILESIZE
Definition fx_types.h:19
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:222