OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 1999-2010, International Business Machines | 4 * Copyright (C) 1999-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: uinvchar.h | 8 * file name: uinvchar.h |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:2 | 11 * indentation:2 |
12 * | 12 * |
13 * created on: 2004sep14 | 13 * created on: 2004sep14 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
15 * | 15 * |
16 * Definitions for handling invariant characters, moved here from putil.c | 16 * Definitions for handling invariant characters, moved here from putil.c |
17 * for better modularization. | 17 * for better modularization. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef __UINVCHAR_H__ | 20 #ifndef __UINVCHAR_H__ |
21 #define __UINVCHAR_H__ | 21 #define __UINVCHAR_H__ |
22 | 22 |
23 #include "unicode/utypes.h" | 23 #include "unicode/utypes.h" |
| 24 #ifdef __cplusplus |
| 25 #include "unicode/unistr.h" |
| 26 #endif |
24 | 27 |
25 /** | 28 /** |
26 * Check if a char string only contains invariant characters. | 29 * Check if a char string only contains invariant characters. |
27 * See utypes.h for details. | 30 * See utypes.h for details. |
28 * | 31 * |
29 * @param s Input string pointer. | 32 * @param s Input string pointer. |
30 * @param length Length of the string, can be -1 if NUL-terminated. | 33 * @param length Length of the string, can be -1 if NUL-terminated. |
31 * @return TRUE if s contains only invariant characters. | 34 * @return TRUE if s contains only invariant characters. |
32 * | 35 * |
33 * @internal (ICU 2.8) | 36 * @internal (ICU 2.8) |
34 */ | 37 */ |
35 U_INTERNAL UBool U_EXPORT2 | 38 U_INTERNAL UBool U_EXPORT2 |
36 uprv_isInvariantString(const char *s, int32_t length); | 39 uprv_isInvariantString(const char *s, int32_t length); |
37 | 40 |
38 /** | 41 /** |
39 * Check if a Unicode string only contains invariant characters. | 42 * Check if a Unicode string only contains invariant characters. |
40 * See utypes.h for details. | 43 * See utypes.h for details. |
41 * | 44 * |
42 * @param s Input string pointer. | 45 * @param s Input string pointer. |
43 * @param length Length of the string, can be -1 if NUL-terminated. | 46 * @param length Length of the string, can be -1 if NUL-terminated. |
44 * @return TRUE if s contains only invariant characters. | 47 * @return TRUE if s contains only invariant characters. |
45 * | 48 * |
46 * @internal (ICU 2.8) | 49 * @internal (ICU 2.8) |
47 */ | 50 */ |
48 U_INTERNAL UBool U_EXPORT2 | 51 U_INTERNAL UBool U_EXPORT2 |
49 uprv_isInvariantUString(const UChar *s, int32_t length); | 52 uprv_isInvariantUString(const UChar *s, int32_t length); |
50 | 53 |
| 54 #ifdef __cplusplus |
| 55 |
| 56 /** |
| 57 * Check if a UnicodeString only contains invariant characters. |
| 58 * See utypes.h for details. |
| 59 * |
| 60 * @param s Input string. |
| 61 * @return TRUE if s contains only invariant characters. |
| 62 */ |
| 63 U_INTERNAL inline UBool U_EXPORT2 |
| 64 uprv_isInvariantUnicodeString(const icu::UnicodeString &s) { |
| 65 return uprv_isInvariantUString(s.getBuffer(), s.length()); |
| 66 } |
| 67 |
| 68 #endif /* __cplusplus */ |
| 69 |
51 /** | 70 /** |
52 * \def U_UPPER_ORDINAL | 71 * \def U_UPPER_ORDINAL |
53 * Get the ordinal number of an uppercase invariant character | 72 * Get the ordinal number of an uppercase invariant character |
54 * @internal | 73 * @internal |
55 */ | 74 */ |
56 #if U_CHARSET_FAMILY==U_ASCII_FAMILY | 75 #if U_CHARSET_FAMILY==U_ASCII_FAMILY |
57 # define U_UPPER_ORDINAL(x) ((x)-'A') | 76 # define U_UPPER_ORDINAL(x) ((x)-'A') |
58 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY | 77 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY |
59 # define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \ | 78 # define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \ |
60 (((x) < 'S') ? ((x)-'J'+9) : \ | 79 (((x) < 'S') ? ((x)-'J'+9) : \ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 * Copy ASCII to EBCDIC | 135 * Copy ASCII to EBCDIC |
117 * @internal | 136 * @internal |
118 * @see uprv_strncpy | 137 * @see uprv_strncpy |
119 */ | 138 */ |
120 U_INTERNAL uint8_t* U_EXPORT2 | 139 U_INTERNAL uint8_t* U_EXPORT2 |
121 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n); | 140 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n); |
122 | 141 |
123 | 142 |
124 | 143 |
125 #endif | 144 #endif |
OLD | NEW |