michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2011, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ******************************************************************************* michael@0: * file name: patternprops.h michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2011mar13 michael@0: * created by: Markus W. Scherer michael@0: */ michael@0: michael@0: #ifndef __PATTERNPROPS_H__ michael@0: #define __PATTERNPROPS_H__ michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * Implements the immutable Unicode properties Pattern_Syntax and Pattern_White_Space. michael@0: * Hardcodes these properties, does not load data, does not depend on other ICU classes. michael@0: *

michael@0: * Note: Both properties include ASCII as well as non-ASCII, non-Latin-1 code points, michael@0: * and both properties only include BMP code points (no supplementary ones). michael@0: * Pattern_Syntax includes some unassigned code points. michael@0: *

michael@0: * [:Pattern_White_Space:] = michael@0: * [\u0009-\u000D\ \u0085\u200E\u200F\u2028\u2029] michael@0: *

michael@0: * [:Pattern_Syntax:] = michael@0: * [!-/\:-@\[-\^`\{-~\u00A1-\u00A7\u00A9\u00AB\u00AC\u00AE michael@0: * \u00B0\u00B1\u00B6\u00BB\u00BF\u00D7\u00F7 michael@0: * \u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E michael@0: * \u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F michael@0: * \u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46] michael@0: * @author mscherer michael@0: */ michael@0: class U_COMMON_API PatternProps { michael@0: public: michael@0: /** michael@0: * @return TRUE if c is a Pattern_Syntax code point. michael@0: */ michael@0: static UBool isSyntax(UChar32 c); michael@0: michael@0: /** michael@0: * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point. michael@0: */ michael@0: static UBool isSyntaxOrWhiteSpace(UChar32 c); michael@0: michael@0: /** michael@0: * @return TRUE if c is a Pattern_White_Space character. michael@0: */ michael@0: static UBool isWhiteSpace(UChar32 c); michael@0: michael@0: /** michael@0: * Skips over Pattern_White_Space starting at s. michael@0: * @return The smallest pointer at or after s with a non-white space character. michael@0: */ michael@0: static const UChar *skipWhiteSpace(const UChar *s, int32_t length); michael@0: michael@0: /** michael@0: * @return s except with leading and trailing Pattern_White_Space removed and length adjusted. michael@0: */ michael@0: static const UChar *trimWhiteSpace(const UChar *s, int32_t &length); michael@0: michael@0: /** michael@0: * Tests whether the string contains a "pattern identifier", that is, michael@0: * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. michael@0: * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s. michael@0: */ michael@0: static UBool isIdentifier(const UChar *s, int32_t length); michael@0: michael@0: /** michael@0: * Skips over a "pattern identifier" starting at index s. michael@0: * @return The smallest pointer at or after s with michael@0: * a Pattern_White_Space or Pattern_Syntax character. michael@0: */ michael@0: static const UChar *skipIdentifier(const UChar *s, int32_t length); michael@0: michael@0: private: michael@0: PatternProps(); // no constructor: all static methods michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif // __PATTERNPROPS_H__