2 *******************************************************************************
3 * Copyright (C) 2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: patternprops.h
8 * tab size: 8 (not used)
11 * created on: 2011mar13
12 * created by: Markus W. Scherer
15 #ifndef __PATTERNPROPS_H__
16 #define __PATTERNPROPS_H__
18 #include "unicode/utypes.h"
23 * Implements the immutable Unicode properties Pattern_Syntax and Pattern_White_Space.
24 * Hardcodes these properties, does not load data, does not depend on other ICU classes.
26 * Note: Both properties include ASCII as well as non-ASCII, non-Latin-1 code points,
27 * and both properties only include BMP code points (no supplementary ones).
28 * Pattern_Syntax includes some unassigned code points.
30 * [:Pattern_White_Space:] =
31 * [\u0009-\u000D\ \u0085\u200E\u200F\u2028\u2029]
33 * [:Pattern_Syntax:] =
34 * [!-/\:-@\[-\^`\{-~\u00A1-\u00A7\u00A9\u00AB\u00AC\u00AE
35 * \u00B0\u00B1\u00B6\u00BB\u00BF\u00D7\u00F7
36 * \u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E
37 * \u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F
38 * \u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]
41 class U_COMMON_API PatternProps
{
44 * @return TRUE if c is a Pattern_Syntax code point.
46 static UBool
isSyntax(UChar32 c
);
49 * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point.
51 static UBool
isSyntaxOrWhiteSpace(UChar32 c
);
54 * @return TRUE if c is a Pattern_White_Space character.
56 static UBool
isWhiteSpace(UChar32 c
);
59 * Skips over Pattern_White_Space starting at s.
60 * @return The smallest pointer at or after s with a non-white space character.
62 static const UChar
*skipWhiteSpace(const UChar
*s
, int32_t length
);
65 * @return s except with leading and trailing Pattern_White_Space removed and length adjusted.
67 static const UChar
*trimWhiteSpace(const UChar
*s
, int32_t &length
);
70 * Tests whether the string contains a "pattern identifier", that is,
71 * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters.
72 * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s.
74 static UBool
isIdentifier(const UChar
*s
, int32_t length
);
77 * Skips over a "pattern identifier" starting at index s.
78 * @return The smallest pointer at or after s with
79 * a Pattern_White_Space or Pattern_Syntax character.
81 static const UChar
*skipIdentifier(const UChar
*s
, int32_t length
);
84 PatternProps(); // no constructor: all static methods
89 #endif // __PATTERNPROPS_H__