]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
4388f060 A |
3 | /* |
4 | ******************************************************************************* | |
5 | * Copyright (C) 2011, International Business Machines | |
6 | * Corporation and others. All Rights Reserved. | |
7 | ******************************************************************************* | |
8 | * file name: patternprops.h | |
f3c0d7a5 | 9 | * encoding: UTF-8 |
4388f060 A |
10 | * tab size: 8 (not used) |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2011mar13 | |
14 | * created by: Markus W. Scherer | |
15 | */ | |
16 | ||
17 | #ifndef __PATTERNPROPS_H__ | |
18 | #define __PATTERNPROPS_H__ | |
19 | ||
20 | #include "unicode/utypes.h" | |
21 | ||
22 | U_NAMESPACE_BEGIN | |
23 | ||
24 | /** | |
25 | * Implements the immutable Unicode properties Pattern_Syntax and Pattern_White_Space. | |
26 | * Hardcodes these properties, does not load data, does not depend on other ICU classes. | |
27 | * <p> | |
28 | * Note: Both properties include ASCII as well as non-ASCII, non-Latin-1 code points, | |
29 | * and both properties only include BMP code points (no supplementary ones). | |
30 | * Pattern_Syntax includes some unassigned code points. | |
31 | * <p> | |
32 | * [:Pattern_White_Space:] = | |
33 | * [\u0009-\u000D\ \u0085\u200E\u200F\u2028\u2029] | |
34 | * <p> | |
35 | * [:Pattern_Syntax:] = | |
36 | * [!-/\:-@\[-\^`\{-~\u00A1-\u00A7\u00A9\u00AB\u00AC\u00AE | |
37 | * \u00B0\u00B1\u00B6\u00BB\u00BF\u00D7\u00F7 | |
38 | * \u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E | |
39 | * \u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F | |
40 | * \u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46] | |
41 | * @author mscherer | |
42 | */ | |
43 | class U_COMMON_API PatternProps { | |
44 | public: | |
45 | /** | |
46 | * @return TRUE if c is a Pattern_Syntax code point. | |
47 | */ | |
48 | static UBool isSyntax(UChar32 c); | |
49 | ||
50 | /** | |
51 | * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point. | |
52 | */ | |
53 | static UBool isSyntaxOrWhiteSpace(UChar32 c); | |
54 | ||
55 | /** | |
56 | * @return TRUE if c is a Pattern_White_Space character. | |
57 | */ | |
58 | static UBool isWhiteSpace(UChar32 c); | |
59 | ||
60 | /** | |
61 | * Skips over Pattern_White_Space starting at s. | |
62 | * @return The smallest pointer at or after s with a non-white space character. | |
63 | */ | |
64 | static const UChar *skipWhiteSpace(const UChar *s, int32_t length); | |
65 | ||
66 | /** | |
67 | * @return s except with leading and trailing Pattern_White_Space removed and length adjusted. | |
68 | */ | |
69 | static const UChar *trimWhiteSpace(const UChar *s, int32_t &length); | |
70 | ||
71 | /** | |
72 | * Tests whether the string contains a "pattern identifier", that is, | |
73 | * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. | |
74 | * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s. | |
75 | */ | |
76 | static UBool isIdentifier(const UChar *s, int32_t length); | |
77 | ||
78 | /** | |
79 | * Skips over a "pattern identifier" starting at index s. | |
80 | * @return The smallest pointer at or after s with | |
81 | * a Pattern_White_Space or Pattern_Syntax character. | |
82 | */ | |
83 | static const UChar *skipIdentifier(const UChar *s, int32_t length); | |
84 | ||
85 | private: | |
86 | PatternProps(); // no constructor: all static methods | |
87 | }; | |
88 | ||
89 | U_NAMESPACE_END | |
90 | ||
91 | #endif // __PATTERNPROPS_H__ |