summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-28 10:20:35 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-28 10:20:35 -0400
commit69472875a28a4e2d40623893e029af129f5e88e2 (patch)
tree667ea56c427e620edfa4262e23d6c24cd967238d /core/include
parentbf18cb6220aa19a64d2705640aad29d3f86ed04a (diff)
downloadpdfium-69472875a28a4e2d40623893e029af129f5e88e2.tar.xz
Merge to XFA: Add helpers to check the PDF_CharType.
This CL adds helpers to provide more descriptive access to PDF_CharType. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1407913004 . (cherry picked from commit e3e5675bcdd26b8df7286e10a42d585df6d2321d) Review URL: https://codereview.chromium.org/1419893004 .
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];