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_hint_tables.h
Go to the documentation of this file.
1// Copyright 2016 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_FPDFAPI_PARSER_CPDF_HINT_TABLES_H_
8#define CORE_FPDFAPI_PARSER_CPDF_HINT_TABLES_H_
9
10#include <memory>
11#include <vector>
12
13#include "core/fpdfapi/parser/cpdf_data_avail.h"
14#include "core/fxcrt/unowned_ptr.h"
15
16class CFX_BitStream;
19class CPDF_Stream;
21
23 public:
26 uint32_t m_dwLength = 0;
27 uint32_t m_dwObjectsCount = 0;
28 uint32_t m_dwStartObjNum = 0;
29 };
30
31 class PageInfo {
32 public:
35
36 void set_objects_count(uint32_t objects_count) {
37 m_dwObjectsCount = objects_count;
38 }
39 uint32_t objects_count() const { return m_dwObjectsCount; }
40
41 void set_page_offset(FX_FILESIZE offset) { m_szOffset = offset; }
42 FX_FILESIZE page_offset() const { return m_szOffset; }
43
44 void set_page_length(uint32_t length) { m_dwLength = length; }
45 uint32_t page_length() const { return m_dwLength; }
46
47 void set_start_obj_num(uint32_t start_obj_num) {
48 m_dwStartObjNum = start_obj_num;
49 }
50 uint32_t start_obj_num() const { return m_dwStartObjNum; }
51
52 void AddIdentifier(uint32_t Identifier) {
53 m_dwIdentifierArray.push_back(Identifier);
54 }
55
56 const std::vector<uint32_t>& Identifiers() const {
57 return m_dwIdentifierArray;
58 }
59
60 private:
61 uint32_t m_dwObjectsCount = 0;
62 FX_FILESIZE m_szOffset = 0;
63 uint32_t m_dwLength = 0;
64 uint32_t m_dwStartObjNum = 0;
65 std::vector<uint32_t> m_dwIdentifierArray;
66
67 PageInfo(const PageInfo& other) = delete;
68 PageInfo& operator=(const PageInfo&) = delete;
69 };
70
72 CPDF_SyntaxParser* parser,
73 const CPDF_LinearizedHeader* pLinearized);
74
76 const CPDF_LinearizedHeader* pLinearized);
77 virtual ~CPDF_HintTables();
78
79 bool GetPagePos(uint32_t index,
80 FX_FILESIZE* szPageStartPos,
81 FX_FILESIZE* szPageLength,
82 uint32_t* dwObjNum) const;
83
84 CPDF_DataAvail::DocAvailStatus CheckPage(uint32_t index);
85
86 bool LoadHintStream(CPDF_Stream* pHintStream);
87
88 const std::vector<PageInfo>& PageInfos() const { return m_PageInfos; }
90 return m_SharedObjGroupInfos;
91 }
92
93 FX_FILESIZE GetFirstPageObjOffset() const { return m_szFirstPageObjOffset; }
94
95 protected:
96 bool ReadPageHintTable(CFX_BitStream* hStream);
97 bool ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset);
98
99 private:
100 FX_FILESIZE HintsOffsetToFileOffset(uint32_t hints_offset) const;
101
102 uint32_t m_nFirstPageSharedObjs = 0;
103 FX_FILESIZE m_szFirstPageObjOffset = 0;
104 std::vector<PageInfo> m_PageInfos;
105 std::vector<SharedObjGroupInfo> m_SharedObjGroupInfos;
106 UnownedPtr<CPDF_ReadValidator> m_pValidator;
107 UnownedPtr<const CPDF_LinearizedHeader> const m_pLinearized;
108};
109
110#endif // CORE_FPDFAPI_PARSER_CPDF_HINT_TABLES_H_
CPDF_DataAvail(FileAvail *pFileAvail, RetainPtr< IFX_SeekableReadStream > pFileRead)
~CPDF_DataAvail() override
DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints *pHints)
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)
FX_FILESIZE page_offset() const
void set_page_offset(FX_FILESIZE offset)
void AddIdentifier(uint32_t Identifier)
const std::vector< uint32_t > & Identifiers() const
void set_start_obj_num(uint32_t start_obj_num)
uint32_t start_obj_num() const
void set_page_length(uint32_t length)
void set_objects_count(uint32_t objects_count)
uint32_t objects_count() const
CPDF_DataAvail::DocAvailStatus CheckPage(uint32_t index)
virtual ~CPDF_HintTables()
FX_FILESIZE GetFirstPageObjOffset() const
bool GetPagePos(uint32_t index, FX_FILESIZE *szPageStartPos, FX_FILESIZE *szPageLength, uint32_t *dwObjNum) const
static std::unique_ptr< CPDF_HintTables > Parse(CPDF_SyntaxParser *parser, const CPDF_LinearizedHeader *pLinearized)
bool LoadHintStream(CPDF_Stream *pHintStream)
bool ReadSharedObjHintTable(CFX_BitStream *hStream, uint32_t offset)
CPDF_HintTables(CPDF_ReadValidator *pValidator, const CPDF_LinearizedHeader *pLinearized)
const std::vector< SharedObjGroupInfo > & SharedGroupInfos() const
bool ReadPageHintTable(CFX_BitStream *hStream)
const std::vector< PageInfo > & PageInfos() const
CPDF_DataAvail::DocAvailStatus CheckAvail()
static constexpr uint32_t kInvalidObjNum
Definition cpdf_object.h:52
uint32_t GetRefObjNum() const
FX_FILESIZE GetPos() const
void SetPos(FX_FILESIZE pos)
bool operator==(const char *ptr) const
bool operator!=(const char *ptr) const
Definition bytestring.h:130
#define FX_FILESIZE
Definition fx_types.h:19