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_memorystream.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_MEMORYSTREAM_H_
8#define CORE_FXCRT_CFX_MEMORYSTREAM_H_
9
10#include "core/fxcrt/data_vector.h"
11#include "core/fxcrt/fx_stream.h"
12#include "core/fxcrt/retain_ptr.h"
13#include "third_party/base/containers/span.h"
14
15class CFX_MemoryStream final : public IFX_SeekableStream {
16 public:
18
19 // IFX_SeekableStream
20 FX_FILESIZE GetSize() override;
21 FX_FILESIZE GetPosition() override;
22 bool IsEOF() override;
23 size_t ReadBlock(pdfium::span<uint8_t> buffer) override;
24 bool ReadBlockAtOffset(pdfium::span<uint8_t> buffer,
25 FX_FILESIZE offset) override;
26 bool WriteBlockAtOffset(pdfium::span<const uint8_t> buffer,
27 FX_FILESIZE offset) override;
28 bool Flush() override;
29
30 pdfium::span<const uint8_t> GetSpan() const;
31
32 private:
33 CFX_MemoryStream();
34 ~CFX_MemoryStream() override;
35
36 DataVector<uint8_t> m_data;
37 size_t m_nCurSize = 0;
38 size_t m_nCurPos = 0;
39};
40
41#endif // CORE_FXCRT_CFX_MEMORYSTREAM_H_
FX_FILESIZE GetPosition() override
bool IsEOF() override
~CFX_MemoryStream() override
bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset) override
FX_FILESIZE GetSize() override
size_t ReadBlock(pdfium::span< uint8_t > buffer) override
bool Flush() override
pdfium::span< const uint8_t > GetSpan() const
bool WriteBlockAtOffset(pdfium::span< const uint8_t > buffer, FX_FILESIZE offset) override
ByteString GetNameFor(const ByteString &key) const
bool WriteDictTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const
RetainPtr< const CPDF_Dictionary > GetDict() const
uint32_t m_ObjNum
static constexpr uint32_t kInvalidObjNum
Definition cpdf_object.h:52
RetainPtr< CPDF_Object > CloneObjectNonCyclic(bool bDirect) const
bool HasFilter() const
RetainPtr< CPDF_Object > Clone() const override
~CPDF_Stream() override
size_t GetRawSize() const
CPDF_Stream * AsMutableStream() override
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
bool IsFileBased() const
Definition cpdf_stream.h:64
void SetDataFromStringstreamAndRemoveFilter(fxcrt::ostringstream *stream)
Type GetType() const override
void SetDataAndRemoveFilter(pdfium::span< const uint8_t > pData)
void SetDataFromStringstream(fxcrt::ostringstream *stream)
DataVector< uint8_t > ReadAllRawData() const
void SetData(pdfium::span< const uint8_t > pData)
void InitStreamWithEmptyData(RetainPtr< CPDF_Dictionary > pDict)
void InitStreamFromFile(RetainPtr< IFX_SeekableReadStream > pFile, RetainPtr< CPDF_Dictionary > pDict)
pdfium::span< const uint8_t > GetInMemoryRawData() const
RetainPtr< CPDF_Object > CloneNonCyclic(bool bDirect, std::set< const CPDF_Object * > *pVisited) const override
WideString GetUnicodeText() const override
const CPDF_Dictionary * GetDictInternal() const override
bool WriteString(ByteStringView str)
Definition fx_stream.cpp:47
virtual bool WriteBlock(pdfium::span< const uint8_t > data)=0
bool operator==(const char *ptr) const
#define FX_FILESIZE
Definition fx_types.h:19
#define CHECK(cvref)
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:224