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_SYNTAX_PARSER_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "core/fxcrt/cfx_string_pool_template.h" | 12 #include "core/fxcrt/cfx_string_pool_template.h" |
13 #include "core/fxcrt/cfx_weak_ptr.h" | 13 #include "core/fxcrt/cfx_weak_ptr.h" |
14 #include "core/fxcrt/fx_basic.h" | 14 #include "core/fxcrt/fx_basic.h" |
15 | 15 |
16 class CPDF_CryptoHandler; | 16 class CPDF_CryptoHandler; |
17 class CPDF_Dictionary; | 17 class CPDF_Dictionary; |
18 class CPDF_IndirectObjectHolder; | 18 class CPDF_IndirectObjectHolder; |
19 class CPDF_Object; | 19 class CPDF_Object; |
20 class CPDF_Stream; | 20 class CPDF_Stream; |
21 class IFX_FileRead; | 21 class IFX_SeekableReadStream; |
22 | 22 |
23 class CPDF_SyntaxParser { | 23 class CPDF_SyntaxParser { |
24 public: | 24 public: |
25 CPDF_SyntaxParser(); | 25 CPDF_SyntaxParser(); |
26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); | 26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); |
27 ~CPDF_SyntaxParser(); | 27 ~CPDF_SyntaxParser(); |
28 | 28 |
29 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset); | 29 void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); |
30 | 30 |
31 FX_FILESIZE SavePos() const { return m_Pos; } | 31 FX_FILESIZE SavePos() const { return m_Pos; } |
32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } | 32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } |
33 | 33 |
34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, | 34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, |
35 uint32_t objnum, | 35 uint32_t objnum, |
36 uint32_t gennum, | 36 uint32_t gennum, |
37 FX_BOOL bDecrypt); | 37 FX_BOOL bDecrypt); |
38 CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList, | 38 CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList, |
39 uint32_t objnum, | 39 uint32_t objnum, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 CFX_ByteString ReadHexString(); | 79 CFX_ByteString ReadHexString(); |
80 unsigned int ReadEOLMarkers(FX_FILESIZE pos); | 80 unsigned int ReadEOLMarkers(FX_FILESIZE pos); |
81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, | 81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, |
82 uint32_t objnum, | 82 uint32_t objnum, |
83 uint32_t gennum); | 83 uint32_t gennum); |
84 | 84 |
85 CFX_ByteString MaybeIntern(const CFX_ByteString& str); | 85 CFX_ByteString MaybeIntern(const CFX_ByteString& str); |
86 | 86 |
87 FX_FILESIZE m_Pos; | 87 FX_FILESIZE m_Pos; |
88 int m_MetadataObjnum; | 88 int m_MetadataObjnum; |
89 IFX_FileRead* m_pFileAccess; | 89 IFX_SeekableReadStream* m_pFileAccess; |
90 FX_FILESIZE m_HeaderOffset; | 90 FX_FILESIZE m_HeaderOffset; |
91 FX_FILESIZE m_FileLen; | 91 FX_FILESIZE m_FileLen; |
92 uint8_t* m_pFileBuf; | 92 uint8_t* m_pFileBuf; |
93 uint32_t m_BufSize; | 93 uint32_t m_BufSize; |
94 FX_FILESIZE m_BufOffset; | 94 FX_FILESIZE m_BufOffset; |
95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
96 uint8_t m_WordBuffer[257]; | 96 uint8_t m_WordBuffer[257]; |
97 uint32_t m_WordSize; | 97 uint32_t m_WordSize; |
98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; | 98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
99 }; | 99 }; |
100 | 100 |
101 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 101 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
OLD | NEW |