OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 virtual bool IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; | 88 virtual bool IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; |
89 }; | 89 }; |
90 | 90 |
91 class DownloadHints { | 91 class DownloadHints { |
92 public: | 92 public: |
93 virtual ~DownloadHints(); | 93 virtual ~DownloadHints(); |
94 virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; | 94 virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; |
95 }; | 95 }; |
96 | 96 |
97 CPDF_DataAvail(FileAvail* pFileAvail, | 97 CPDF_DataAvail(FileAvail* pFileAvail, |
98 IFX_SeekableReadStream* pFileRead, | 98 const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, |
99 bool bSupportHintTable); | 99 bool bSupportHintTable); |
100 ~CPDF_DataAvail(); | 100 ~CPDF_DataAvail(); |
101 | 101 |
102 bool IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); | 102 bool IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); |
103 DocAvailStatus IsDocAvail(DownloadHints* pHints); | 103 DocAvailStatus IsDocAvail(DownloadHints* pHints); |
104 void SetDocument(CPDF_Document* pDoc); | 104 void SetDocument(CPDF_Document* pDoc); |
105 DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints); | 105 DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints); |
106 DocFormStatus IsFormAvail(DownloadHints* pHints); | 106 DocFormStatus IsFormAvail(DownloadHints* pHints); |
107 DocLinearizationStatus IsLinearizedPDF(); | 107 DocLinearizationStatus IsLinearizedPDF(); |
108 bool IsLinearized(); | 108 bool IsLinearized(); |
109 void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); | 109 void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); |
110 IFX_SeekableReadStream* GetFileRead() const { return m_pFileRead; } | 110 CFX_RetainPtr<IFX_SeekableReadStream> GetFileRead() const { |
| 111 return m_pFileRead; |
| 112 } |
111 int GetPageCount() const; | 113 int GetPageCount() const; |
112 CPDF_Dictionary* GetPage(int index); | 114 CPDF_Dictionary* GetPage(int index); |
113 | 115 |
114 protected: | 116 protected: |
115 class PageNode { | 117 class PageNode { |
116 public: | 118 public: |
117 PageNode(); | 119 PageNode(); |
118 ~PageNode(); | 120 ~PageNode(); |
119 | 121 |
120 PDF_PAGENODE_TYPE m_type; | 122 PDF_PAGENODE_TYPE m_type; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 bool CheckArrayPageNode(uint32_t dwPageNo, | 190 bool CheckArrayPageNode(uint32_t dwPageNo, |
189 PageNode* pPageNode, | 191 PageNode* pPageNode, |
190 DownloadHints* pHints); | 192 DownloadHints* pHints); |
191 bool CheckPageCount(DownloadHints* pHints); | 193 bool CheckPageCount(DownloadHints* pHints); |
192 bool IsFirstCheck(uint32_t dwPage); | 194 bool IsFirstCheck(uint32_t dwPage); |
193 void ResetFirstCheck(uint32_t dwPage); | 195 void ResetFirstCheck(uint32_t dwPage); |
194 bool ValidatePage(uint32_t dwPage); | 196 bool ValidatePage(uint32_t dwPage); |
195 bool ValidateForm(); | 197 bool ValidateForm(); |
196 | 198 |
197 FileAvail* const m_pFileAvail; | 199 FileAvail* const m_pFileAvail; |
198 IFX_SeekableReadStream* const m_pFileRead; | 200 CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; |
199 CPDF_Parser m_parser; | 201 CPDF_Parser m_parser; |
200 CPDF_SyntaxParser m_syntaxParser; | 202 CPDF_SyntaxParser m_syntaxParser; |
201 std::unique_ptr<CPDF_Object> m_pRoot; | 203 std::unique_ptr<CPDF_Object> m_pRoot; |
202 uint32_t m_dwRootObjNum; | 204 uint32_t m_dwRootObjNum; |
203 uint32_t m_dwInfoObjNum; | 205 uint32_t m_dwInfoObjNum; |
204 std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized; | 206 std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized; |
205 CPDF_Object* m_pTrailer; | 207 CPDF_Object* m_pTrailer; |
206 bool m_bDocAvail; | 208 bool m_bDocAvail; |
207 FX_FILESIZE m_dwHeaderOffset; | 209 FX_FILESIZE m_dwHeaderOffset; |
208 FX_FILESIZE m_dwLastXRefOffset; | 210 FX_FILESIZE m_dwLastXRefOffset; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 bool m_bTotalLoadPageTree; | 248 bool m_bTotalLoadPageTree; |
247 bool m_bCurPageDictLoadOK; | 249 bool m_bCurPageDictLoadOK; |
248 PageNode m_pageNodes; | 250 PageNode m_pageNodes; |
249 std::set<uint32_t> m_pageMapCheckState; | 251 std::set<uint32_t> m_pageMapCheckState; |
250 std::set<uint32_t> m_pagesLoadState; | 252 std::set<uint32_t> m_pagesLoadState; |
251 std::unique_ptr<CPDF_HintTables> m_pHintTables; | 253 std::unique_ptr<CPDF_HintTables> m_pHintTables; |
252 bool m_bSupportHintTable; | 254 bool m_bSupportHintTable; |
253 }; | 255 }; |
254 | 256 |
255 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ | 257 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ |
OLD | NEW |