OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
9 | 9 |
| 10 #include "../../../third_party/base/nonstd_unique_ptr.h" |
10 #include "../fxcrt/fx_system.h" | 11 #include "../fxcrt/fx_system.h" |
11 #include "fpdf_objects.h" | 12 #include "fpdf_objects.h" |
12 | 13 |
13 class CPDF_Document; | 14 class CPDF_Document; |
14 class CPDF_Parser; | 15 class CPDF_Parser; |
15 class CPDF_SecurityHandler; | 16 class CPDF_SecurityHandler; |
16 class CPDF_StandardSecurityHandler; | 17 class CPDF_StandardSecurityHandler; |
17 class CPDF_CryptoHandler; | 18 class CPDF_CryptoHandler; |
18 class CPDF_Object; | 19 class CPDF_Object; |
19 class IFX_FileRead; | 20 class IFX_FileRead; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 FX_BOOL bForward, | 264 FX_BOOL bForward, |
264 FX_FILESIZE limit); | 265 FX_FILESIZE limit); |
265 | 266 |
266 int SearchMultiWord(const CFX_ByteStringC& words, | 267 int SearchMultiWord(const CFX_ByteStringC& words, |
267 FX_BOOL bWholeWord, | 268 FX_BOOL bWholeWord, |
268 FX_FILESIZE limit); | 269 FX_FILESIZE limit); |
269 | 270 |
270 FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); | 271 FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); |
271 | 272 |
272 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { | 273 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { |
273 m_pCryptoHandler = pCryptoHandler; | 274 m_pCryptoHandler.reset(pCryptoHandler); |
274 } | 275 } |
275 | 276 |
276 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } | 277 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } |
277 | 278 |
278 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); | 279 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); |
279 | 280 |
280 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); | 281 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); |
281 | 282 |
282 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); | 283 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); |
283 | 284 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 FX_DWORD m_HeaderOffset; | 320 FX_DWORD m_HeaderOffset; |
320 | 321 |
321 FX_FILESIZE m_FileLen; | 322 FX_FILESIZE m_FileLen; |
322 | 323 |
323 uint8_t* m_pFileBuf; | 324 uint8_t* m_pFileBuf; |
324 | 325 |
325 FX_DWORD m_BufSize; | 326 FX_DWORD m_BufSize; |
326 | 327 |
327 FX_FILESIZE m_BufOffset; | 328 FX_FILESIZE m_BufOffset; |
328 | 329 |
329 CPDF_CryptoHandler* m_pCryptoHandler; | 330 nonstd::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
330 | 331 |
331 uint8_t m_WordBuffer[257]; | 332 uint8_t m_WordBuffer[257]; |
332 | 333 |
333 FX_DWORD m_WordSize; | 334 FX_DWORD m_WordSize; |
334 | 335 |
335 FX_BOOL m_bIsNumber; | 336 FX_BOOL m_bIsNumber; |
336 | 337 |
337 FX_FILESIZE m_dwWordPos; | 338 FX_FILESIZE m_dwWordPos; |
338 friend class CPDF_Parser; | 339 friend class CPDF_Parser; |
339 friend class CPDF_DataAvail; | 340 friend class CPDF_DataAvail; |
(...skipping 28 matching lines...) Expand all Loading... |
368 void CloseParser(FX_BOOL bReParse = FALSE); | 369 void CloseParser(FX_BOOL bReParse = FALSE); |
369 | 370 |
370 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); | 371 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); |
371 | 372 |
372 FX_BOOL IsOwner(); | 373 FX_BOOL IsOwner(); |
373 | 374 |
374 void SetPassword(const FX_CHAR* password) { m_Password = password; } | 375 void SetPassword(const FX_CHAR* password) { m_Password = password; } |
375 | 376 |
376 CFX_ByteString GetPassword() { return m_Password; } | 377 CFX_ByteString GetPassword() { return m_Password; } |
377 | 378 |
378 CPDF_SecurityHandler* GetSecurityHandler() { return m_pSecurityHandler; } | 379 CPDF_SecurityHandler* GetSecurityHandler() { |
| 380 return m_pSecurityHandler.get(); |
| 381 } |
379 | 382 |
380 CPDF_CryptoHandler* GetCryptoHandler() { return m_Syntax.m_pCryptoHandler; } | 383 CPDF_CryptoHandler* GetCryptoHandler() { |
| 384 return m_Syntax.m_pCryptoHandler.get(); |
| 385 } |
381 | 386 |
382 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, | 387 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, |
383 FX_BOOL bForced = FALSE); | 388 FX_BOOL bForced = FALSE); |
384 | 389 |
385 CFX_ByteString GetRecipient() { return m_bsRecipient; } | 390 CFX_ByteString GetRecipient() { return m_bsRecipient; } |
386 | 391 |
387 CPDF_Dictionary* GetTrailer() { return m_pTrailer; } | 392 CPDF_Dictionary* GetTrailer() { return m_pTrailer; } |
388 | 393 |
389 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; } | 394 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; } |
390 | 395 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 493 |
489 CPDF_Dictionary* m_pTrailer; | 494 CPDF_Dictionary* m_pTrailer; |
490 | 495 |
491 CPDF_Dictionary* m_pEncryptDict; | 496 CPDF_Dictionary* m_pEncryptDict; |
492 void SetEncryptDictionary(CPDF_Dictionary* pDict); | 497 void SetEncryptDictionary(CPDF_Dictionary* pDict); |
493 | 498 |
494 FX_FILESIZE m_LastXRefOffset; | 499 FX_FILESIZE m_LastXRefOffset; |
495 | 500 |
496 FX_BOOL m_bXRefStream; | 501 FX_BOOL m_bXRefStream; |
497 | 502 |
498 CPDF_SecurityHandler* m_pSecurityHandler; | 503 nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; |
499 | 504 |
500 FX_BOOL m_bForceUseSecurityHandler; | 505 FX_BOOL m_bForceUseSecurityHandler; |
501 | 506 |
502 CFX_ByteString m_bsRecipient; | 507 CFX_ByteString m_bsRecipient; |
503 | 508 |
504 CFX_ByteString m_FilePath; | 509 CFX_ByteString m_FilePath; |
505 | 510 |
506 CFX_ByteString m_Password; | 511 CFX_ByteString m_Password; |
507 | 512 |
508 CFX_FileSizeArray m_CrossRef; | 513 CFX_FileSizeArray m_CrossRef; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 FX_DWORD src_size, | 936 FX_DWORD src_size, |
932 const CPDF_Dictionary* pDict, | 937 const CPDF_Dictionary* pDict, |
933 uint8_t*& dest_buf, | 938 uint8_t*& dest_buf, |
934 FX_DWORD& dest_size, | 939 FX_DWORD& dest_size, |
935 CFX_ByteString& ImageEncoding, | 940 CFX_ByteString& ImageEncoding, |
936 CPDF_Dictionary*& pImageParms, | 941 CPDF_Dictionary*& pImageParms, |
937 FX_DWORD estimated_size, | 942 FX_DWORD estimated_size, |
938 FX_BOOL bImageAcc); | 943 FX_BOOL bImageAcc); |
939 | 944 |
940 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 945 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
OLD | NEW |