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_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ |
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ | 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 19 matching lines...) Expand all Loading... |
30 SUCCESS = 0, | 30 SUCCESS = 0, |
31 FILE_ERROR, | 31 FILE_ERROR, |
32 FORMAT_ERROR, | 32 FORMAT_ERROR, |
33 PASSWORD_ERROR, | 33 PASSWORD_ERROR, |
34 HANDLER_ERROR | 34 HANDLER_ERROR |
35 }; | 35 }; |
36 | 36 |
37 CPDF_Parser(); | 37 CPDF_Parser(); |
38 ~CPDF_Parser(); | 38 ~CPDF_Parser(); |
39 | 39 |
40 Error StartParse(IFX_FileRead* pFile, | 40 Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); |
41 std::unique_ptr<CPDF_Document> pDocument); | 41 Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); |
42 | |
43 Error StartLinearizedParse(IFX_FileRead* pFile, | |
44 std::unique_ptr<CPDF_Document> pDocument); | |
45 | 42 |
46 void SetPassword(const FX_CHAR* password) { m_Password = password; } | 43 void SetPassword(const FX_CHAR* password) { m_Password = password; } |
47 CFX_ByteString GetPassword() { return m_Password; } | 44 CFX_ByteString GetPassword() { return m_Password; } |
48 CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } | 45 CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } |
49 FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } | 46 FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } |
50 CPDF_Document* GetDocument() const { return m_pDocument.get(); } | 47 CPDF_Document* GetDocument() const { return m_pDocument; } |
51 | 48 |
52 uint32_t GetPermissions() const; | 49 uint32_t GetPermissions() const; |
53 uint32_t GetRootObjNum(); | 50 uint32_t GetRootObjNum(); |
54 uint32_t GetInfoObjNum(); | 51 uint32_t GetInfoObjNum(); |
55 CPDF_Array* GetIDArray(); | 52 CPDF_Array* GetIDArray(); |
56 | 53 |
57 CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } | 54 CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } |
58 | 55 |
59 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, | 56 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, |
60 uint32_t objnum); | 57 uint32_t objnum); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); | 110 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); |
114 Error LoadLinearizedMainXRefTable(); | 111 Error LoadLinearizedMainXRefTable(); |
115 CPDF_StreamAcc* GetObjectStream(uint32_t number); | 112 CPDF_StreamAcc* GetObjectStream(uint32_t number); |
116 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); | 113 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); |
117 void SetEncryptDictionary(CPDF_Dictionary* pDict); | 114 void SetEncryptDictionary(CPDF_Dictionary* pDict); |
118 void ShrinkObjectMap(uint32_t size); | 115 void ShrinkObjectMap(uint32_t size); |
119 // A simple check whether the cross reference table matches with | 116 // A simple check whether the cross reference table matches with |
120 // the objects. | 117 // the objects. |
121 bool VerifyCrossRefV4(); | 118 bool VerifyCrossRefV4(); |
122 | 119 |
123 std::unique_ptr<CPDF_Document> m_pDocument; | 120 CPDF_Document* m_pDocument; // not owned |
124 std::unique_ptr<CPDF_SyntaxParser> m_pSyntax; | 121 std::unique_ptr<CPDF_SyntaxParser> m_pSyntax; |
125 bool m_bOwnFileRead; | 122 bool m_bOwnFileRead; |
126 int m_FileVersion; | 123 int m_FileVersion; |
127 CPDF_Dictionary* m_pTrailer; | 124 CPDF_Dictionary* m_pTrailer; |
128 CPDF_Dictionary* m_pEncryptDict; | 125 CPDF_Dictionary* m_pEncryptDict; |
129 FX_FILESIZE m_LastXRefOffset; | 126 FX_FILESIZE m_LastXRefOffset; |
130 FX_BOOL m_bXRefStream; | 127 FX_BOOL m_bXRefStream; |
131 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; | 128 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; |
132 CFX_ByteString m_Password; | 129 CFX_ByteString m_Password; |
133 std::map<uint32_t, ObjectInfo> m_ObjectInfo; | 130 std::map<uint32_t, ObjectInfo> m_ObjectInfo; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 kPostObjNum, | 164 kPostObjNum, |
168 kGenNum, | 165 kGenNum, |
169 kPostGenNum, | 166 kPostGenNum, |
170 kTrailer, | 167 kTrailer, |
171 kBeginObj, | 168 kBeginObj, |
172 kEndObj | 169 kEndObj |
173 }; | 170 }; |
174 }; | 171 }; |
175 | 172 |
176 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ | 173 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ |
OLD | NEW |