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_PARSER_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_PARSER_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_PARSER_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_PARSER_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "core/fxcrt/fx_basic.h" | 15 #include "core/fxcrt/fx_basic.h" |
16 | 16 |
17 class CPDF_Array; | 17 class CPDF_Array; |
18 class CPDF_CryptoHandler; | 18 class CPDF_CryptoHandler; |
19 class CPDF_Dictionary; | 19 class CPDF_Dictionary; |
20 class CPDF_Document; | 20 class CPDF_Document; |
21 class CPDF_IndirectObjectHolder; | 21 class CPDF_IndirectObjectHolder; |
22 class CPDF_Linearized; | |
23 class CPDF_Object; | 22 class CPDF_Object; |
24 class CPDF_SecurityHandler; | 23 class CPDF_SecurityHandler; |
25 class CPDF_StreamAcc; | 24 class CPDF_StreamAcc; |
26 class CPDF_SyntaxParser; | 25 class CPDF_SyntaxParser; |
27 class IFX_SeekableReadStream; | 26 class IFX_SeekableReadStream; |
28 | 27 |
29 class CPDF_Parser { | 28 class CPDF_Parser { |
30 public: | 29 public: |
31 enum Error { | 30 enum Error { |
32 SUCCESS = 0, | 31 SUCCESS = 0, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, | 81 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, |
83 FX_FILESIZE pos, | 82 FX_FILESIZE pos, |
84 uint32_t objnum); | 83 uint32_t objnum); |
85 | 84 |
86 CPDF_Object* ParseIndirectObjectAtByStrict( | 85 CPDF_Object* ParseIndirectObjectAtByStrict( |
87 CPDF_IndirectObjectHolder* pObjList, | 86 CPDF_IndirectObjectHolder* pObjList, |
88 FX_FILESIZE pos, | 87 FX_FILESIZE pos, |
89 uint32_t objnum, | 88 uint32_t objnum, |
90 FX_FILESIZE* pResultPos); | 89 FX_FILESIZE* pResultPos); |
91 | 90 |
92 uint32_t GetFirstPageNo() const; | 91 uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; } |
93 | 92 |
94 protected: | 93 protected: |
95 struct ObjectInfo { | 94 struct ObjectInfo { |
96 ObjectInfo() : pos(0), type(0), gennum(0) {} | 95 ObjectInfo() : pos(0), type(0), gennum(0) {} |
97 | 96 |
98 FX_FILESIZE pos; | 97 FX_FILESIZE pos; |
99 uint8_t type; | 98 uint8_t type; |
100 uint16_t gennum; | 99 uint16_t gennum; |
101 }; | 100 }; |
102 | 101 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 int m_FileVersion; | 150 int m_FileVersion; |
152 CPDF_Dictionary* m_pTrailer; | 151 CPDF_Dictionary* m_pTrailer; |
153 CPDF_Dictionary* m_pEncryptDict; | 152 CPDF_Dictionary* m_pEncryptDict; |
154 FX_FILESIZE m_LastXRefOffset; | 153 FX_FILESIZE m_LastXRefOffset; |
155 bool m_bXRefStream; | 154 bool m_bXRefStream; |
156 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; | 155 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; |
157 CFX_ByteString m_Password; | 156 CFX_ByteString m_Password; |
158 std::set<FX_FILESIZE> m_SortedOffset; | 157 std::set<FX_FILESIZE> m_SortedOffset; |
159 std::vector<CPDF_Dictionary*> m_Trailers; | 158 std::vector<CPDF_Dictionary*> m_Trailers; |
160 bool m_bVersionUpdated; | 159 bool m_bVersionUpdated; |
161 std::unique_ptr<CPDF_Linearized> m_pLinearized; | 160 CPDF_Object* m_pLinearized; |
| 161 uint32_t m_dwFirstPageNo; |
162 uint32_t m_dwXrefStartObjNum; | 162 uint32_t m_dwXrefStartObjNum; |
163 | 163 |
164 // A map of object numbers to indirect streams. Map owns the streams. | 164 // A map of object numbers to indirect streams. Map owns the streams. |
165 std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap; | 165 std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap; |
166 | 166 |
167 // Mapping of object numbers to offsets. The offsets are relative to the first | 167 // Mapping of object numbers to offsets. The offsets are relative to the first |
168 // object in the stream. | 168 // object in the stream. |
169 using StreamObjectCache = std::map<uint32_t, uint32_t>; | 169 using StreamObjectCache = std::map<uint32_t, uint32_t>; |
170 | 170 |
171 // Mapping of streams to their object caches. This is valid as long as the | 171 // Mapping of streams to their object caches. This is valid as long as the |
172 // streams in |m_ObjectStreamMap| are valid. | 172 // streams in |m_ObjectStreamMap| are valid. |
173 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache; | 173 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache; |
174 | 174 |
175 // All indirect object numbers that are being parsed. | 175 // All indirect object numbers that are being parsed. |
176 std::set<uint32_t> m_ParsingObjNums; | 176 std::set<uint32_t> m_ParsingObjNums; |
177 }; | 177 }; |
178 | 178 |
179 #endif // CORE_FPDFAPI_PARSER_CPDF_PARSER_H_ | 179 #endif // CORE_FPDFAPI_PARSER_CPDF_PARSER_H_ |
OLD | NEW |