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
cpdf_read_validator.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#ifndef CORE_FPDFAPI_PARSER_CPDF_READ_VALIDATOR_H_
6#define CORE_FPDFAPI_PARSER_CPDF_READ_VALIDATOR_H_
7
8#include "core/fpdfapi/parser/cpdf_data_avail.h"
9#include "core/fxcrt/fx_memory.h"
10#include "core/fxcrt/fx_stream.h"
11#include "core/fxcrt/retain_ptr.h"
12#include "core/fxcrt/unowned_ptr.h"
13
15 public:
17 public:
18 FX_STACK_ALLOCATED();
19
20 explicit ScopedSession(RetainPtr<CPDF_ReadValidator> validator);
21 ScopedSession(const ScopedSession& that) = delete;
22 ScopedSession& operator=(const ScopedSession& that) = delete;
24
25 private:
26 RetainPtr<CPDF_ReadValidator> const validator_;
27 const bool saved_read_error_;
28 const bool saved_has_unavailable_data_;
29 };
30
32
33 void SetDownloadHints(CPDF_DataAvail::DownloadHints* hints) {
34 hints_ = hints;
35 }
36 bool read_error() const { return read_error_; }
37 bool has_unavailable_data() const { return has_unavailable_data_; }
38 bool has_read_problems() const {
40 }
41
42 void ResetErrors();
44 bool CheckDataRangeAndRequestIfUnavailable(FX_FILESIZE offset, size_t size);
46
47 // IFX_SeekableReadStream overrides:
48 bool ReadBlockAtOffset(pdfium::span<uint8_t> buffer,
49 FX_FILESIZE offset) override;
50 FX_FILESIZE GetSize() override;
51
52 protected:
54 CPDF_DataAvail::FileAvail* file_avail);
55 ~CPDF_ReadValidator() override;
56
57 private:
58 void ScheduleDownload(FX_FILESIZE offset, size_t size);
59 bool IsDataRangeAvailable(FX_FILESIZE offset, size_t size) const;
60
61 RetainPtr<IFX_SeekableReadStream> const file_read_;
62 UnownedPtr<CPDF_DataAvail::FileAvail> const file_avail_;
63 UnownedPtr<CPDF_DataAvail::DownloadHints> hints_;
64 bool read_error_ = false;
65 bool has_unavailable_data_ = false;
66 bool whole_file_already_available_ = false;
67 const FX_FILESIZE file_size_;
68};
69
70#endif // CORE_FPDFAPI_PARSER_CPDF_READ_VALIDATOR_H_
FX_FILESIZE last_crossref_offset() const
CPDF_CrossRefAvail(CPDF_SyntaxParser *parser, FX_FILESIZE last_crossref_offset)
CPDF_DataAvail::DocAvailStatus CheckAvail()
virtual void AddSegment(FX_FILESIZE offset, size_t size)=0
virtual bool IsDataAvail(FX_FILESIZE offset, size_t size)=0
CPDF_DataAvail(FileAvail *pFileAvail, RetainPtr< IFX_SeekableReadStream > pFileRead)
~CPDF_DataAvail() override
DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints *pHints)
const CPDF_HintTables * GetHintTablesForTest() const
std::pair< CPDF_Parser::Error, std::unique_ptr< CPDF_Document > > ParseDocument(std::unique_ptr< CPDF_Document::RenderDataIface > pRenderData, std::unique_ptr< CPDF_Document::PageDataIface > pPageData, const ByteString &password)
RetainPtr< const CPDF_Dictionary > GetPageDictionary(int index) const
RetainPtr< CPDF_ReadValidator > GetValidator() const
DocAvailStatus IsDocAvail(DownloadHints *pHints)
void OnObservableDestroyed() override
DocLinearizationStatus IsLinearizedPDF()
int GetPageCount() const
DocFormStatus IsFormAvail(DownloadHints *pHints)
ScopedSession & operator=(const ScopedSession &that)=delete
ScopedSession(const ScopedSession &that)=delete
ScopedSession(RetainPtr< CPDF_ReadValidator > validator)
bool has_read_problems() const
void SetDownloadHints(CPDF_DataAvail::DownloadHints *hints)
CPDF_ReadValidator(RetainPtr< IFX_SeekableReadStream > file_read, CPDF_DataAvail::FileAvail *file_avail)
bool has_unavailable_data() const
FX_FILESIZE GetSize() override
bool CheckDataRangeAndRequestIfUnavailable(FX_FILESIZE offset, size_t size)
~CPDF_ReadValidator() override
bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset) override
bool operator==(const char *ptr) const
bool IsEmpty() const
Definition bytestring.h:119
bool operator!=(const char *ptr) const
Definition bytestring.h:130
#define FX_FILESIZE
Definition fx_types.h:19
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:224