1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/patternprops.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* Copyright (C) 2011, International Business Machines 1.7 +* Corporation and others. All Rights Reserved. 1.8 +******************************************************************************* 1.9 +* file name: patternprops.h 1.10 +* encoding: US-ASCII 1.11 +* tab size: 8 (not used) 1.12 +* indentation:4 1.13 +* 1.14 +* created on: 2011mar13 1.15 +* created by: Markus W. Scherer 1.16 +*/ 1.17 + 1.18 +#ifndef __PATTERNPROPS_H__ 1.19 +#define __PATTERNPROPS_H__ 1.20 + 1.21 +#include "unicode/utypes.h" 1.22 + 1.23 +U_NAMESPACE_BEGIN 1.24 + 1.25 +/** 1.26 + * Implements the immutable Unicode properties Pattern_Syntax and Pattern_White_Space. 1.27 + * Hardcodes these properties, does not load data, does not depend on other ICU classes. 1.28 + * <p> 1.29 + * Note: Both properties include ASCII as well as non-ASCII, non-Latin-1 code points, 1.30 + * and both properties only include BMP code points (no supplementary ones). 1.31 + * Pattern_Syntax includes some unassigned code points. 1.32 + * <p> 1.33 + * [:Pattern_White_Space:] = 1.34 + * [\u0009-\u000D\ \u0085\u200E\u200F\u2028\u2029] 1.35 + * <p> 1.36 + * [:Pattern_Syntax:] = 1.37 + * [!-/\:-@\[-\^`\{-~\u00A1-\u00A7\u00A9\u00AB\u00AC\u00AE 1.38 + * \u00B0\u00B1\u00B6\u00BB\u00BF\u00D7\u00F7 1.39 + * \u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E 1.40 + * \u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F 1.41 + * \u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46] 1.42 + * @author mscherer 1.43 + */ 1.44 +class U_COMMON_API PatternProps { 1.45 +public: 1.46 + /** 1.47 + * @return TRUE if c is a Pattern_Syntax code point. 1.48 + */ 1.49 + static UBool isSyntax(UChar32 c); 1.50 + 1.51 + /** 1.52 + * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point. 1.53 + */ 1.54 + static UBool isSyntaxOrWhiteSpace(UChar32 c); 1.55 + 1.56 + /** 1.57 + * @return TRUE if c is a Pattern_White_Space character. 1.58 + */ 1.59 + static UBool isWhiteSpace(UChar32 c); 1.60 + 1.61 + /** 1.62 + * Skips over Pattern_White_Space starting at s. 1.63 + * @return The smallest pointer at or after s with a non-white space character. 1.64 + */ 1.65 + static const UChar *skipWhiteSpace(const UChar *s, int32_t length); 1.66 + 1.67 + /** 1.68 + * @return s except with leading and trailing Pattern_White_Space removed and length adjusted. 1.69 + */ 1.70 + static const UChar *trimWhiteSpace(const UChar *s, int32_t &length); 1.71 + 1.72 + /** 1.73 + * Tests whether the string contains a "pattern identifier", that is, 1.74 + * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. 1.75 + * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s. 1.76 + */ 1.77 + static UBool isIdentifier(const UChar *s, int32_t length); 1.78 + 1.79 + /** 1.80 + * Skips over a "pattern identifier" starting at index s. 1.81 + * @return The smallest pointer at or after s with 1.82 + * a Pattern_White_Space or Pattern_Syntax character. 1.83 + */ 1.84 + static const UChar *skipIdentifier(const UChar *s, int32_t length); 1.85 + 1.86 +private: 1.87 + PatternProps(); // no constructor: all static methods 1.88 +}; 1.89 + 1.90 +U_NAMESPACE_END 1.91 + 1.92 +#endif // __PATTERNPROPS_H__