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_FPDF_PARSER_UTILITY_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ |
8 #define CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ | 8 #define CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ |
9 | 9 |
| 10 #include "core/fxcrt/cfx_retain_ptr.h" |
10 #include "core/fxcrt/fx_string.h" | 11 #include "core/fxcrt/fx_string.h" |
11 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
12 | 13 |
13 class IFX_SeekableReadStream; | 14 class IFX_SeekableReadStream; |
14 class CPDF_Dictionary; | 15 class CPDF_Dictionary; |
15 | 16 |
16 // Use the accessors below instead of directly accessing PDF_CharType. | 17 // Use the accessors below instead of directly accessing PDF_CharType. |
17 extern const char PDF_CharType[256]; | 18 extern const char PDF_CharType[256]; |
18 | 19 |
19 inline bool PDFCharIsWhitespace(uint8_t c) { | 20 inline bool PDFCharIsWhitespace(uint8_t c) { |
20 return PDF_CharType[c] == 'W'; | 21 return PDF_CharType[c] == 'W'; |
21 } | 22 } |
22 inline bool PDFCharIsNumeric(uint8_t c) { | 23 inline bool PDFCharIsNumeric(uint8_t c) { |
23 return PDF_CharType[c] == 'N'; | 24 return PDF_CharType[c] == 'N'; |
24 } | 25 } |
25 inline bool PDFCharIsDelimiter(uint8_t c) { | 26 inline bool PDFCharIsDelimiter(uint8_t c) { |
26 return PDF_CharType[c] == 'D'; | 27 return PDF_CharType[c] == 'D'; |
27 } | 28 } |
28 inline bool PDFCharIsOther(uint8_t c) { | 29 inline bool PDFCharIsOther(uint8_t c) { |
29 return PDF_CharType[c] == 'R'; | 30 return PDF_CharType[c] == 'R'; |
30 } | 31 } |
31 | 32 |
32 inline bool PDFCharIsLineEnding(uint8_t c) { | 33 inline bool PDFCharIsLineEnding(uint8_t c) { |
33 return c == '\r' || c == '\n'; | 34 return c == '\r' || c == '\n'; |
34 } | 35 } |
35 | 36 |
36 int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile); | 37 int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile); |
37 int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key); | 38 int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key); |
38 | 39 |
39 #endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ | 40 #endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ |
OLD | NEW |