From e3e5675bcdd26b8df7286e10a42d585df6d2321d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 28 Oct 2015 10:14:08 -0400 Subject: Add helpers to check the PDF_CharType. This CL adds helpers to provide more descriptive access to PDF_CharType. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1407913004 . --- core/include/fpdfapi/fpdf_parser.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'core/include/fpdfapi/fpdf_parser.h') diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index a5fce34fd7..d121bb4f79 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -45,13 +45,22 @@ class CFX_PrivateData; #define FPDFPERM_PRINT_HIGH 0x0800 #define FPDF_PAGE_MAX_NUM 0xFFFFF -// Indexed by 8-bit character code, contains either: -// 'W' - for whitespace: NUL, TAB, CR, LF, FF, 0x80, 0xff -// 'N' - for numeric: 0123456789+-. -// 'D' - for delimiter: %()/<>[]{} -// 'R' - otherwise. +// Use the accessors below instead of directly accessing PDF_CharType. extern const char PDF_CharType[256]; +inline bool PDFCharIsWhitespace(uint8_t c) { + return PDF_CharType[c] == 'W'; +} +inline bool PDFCharIsNumeric(uint8_t c) { + return PDF_CharType[c] == 'N'; +} +inline bool PDFCharIsDelimiter(uint8_t c) { + return PDF_CharType[c] == 'D'; +} +inline bool PDFCharIsOther(uint8_t c) { + return PDF_CharType[c] == 'R'; +} + // Indexed by 8-bit char code, contains unicode code points. extern const FX_WORD PDFDocEncoding[256]; -- cgit v1.2.3