summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-28 10:14:08 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-28 10:14:08 -0400
commite3e5675bcdd26b8df7286e10a42d585df6d2321d (patch)
tree51e839324e4b9a923a669438295acf4151ab418d /core/include
parent74b147b5747cf65a8936d201b3ed5b32454365cc (diff)
downloadpdfium-e3e5675bcdd26b8df7286e10a42d585df6d2321d.tar.xz
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 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h19
1 files changed, 14 insertions, 5 deletions
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];