ICU 78.1 78.1

utf.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 * Copyright (C) 1999-2011, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 *******************************************************************************
10 * file name: utf.h
11 * encoding: UTF-8
12 * tab size: 8 (not used)
13 * indentation:4
14 *
15 * created on: 1999sep09
16 * created by: Markus W. Scherer
17 */
18
116 #ifndef __UTF_H__
117 #define __UTF_H__
118
119 #include "unicode/umachine.h"
120 /* include the utfXX.h after the following definitions */
121
122 /* single-code point definitions -------------------------------------------- */
123
124 #ifndef U_HIDE_DRAFT_API
125
136 #define U_IS_CODE_POINT(c) ((uint32_t)(c)<=0x10ffff)
137
149 #define U_IS_SCALAR_VALUE(c) ((uint32_t)(c)<0xd800 || (0xe000<=(c) && (c)<=0x10ffff))
150
151 #endif // U_HIDE_DRAFT_API
152
161 #define U_IS_UNICODE_NONCHAR(c) \
162 ((c)>=0xfdd0 && \
163 ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
164
182 #define U_IS_UNICODE_CHAR(c) \
183 ((uint32_t)(c)<0xd800 || \
184 (0xe000<=(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
185
192 #define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
193
200 #define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
201
208 #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
209
216 #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
217
224 #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
225
233 #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
234
242 #define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
243
244 /* include the utfXX.h ------------------------------------------------------ */
245
246 #if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
247
248 #include "unicode/utf8.h"
249 #include "unicode/utf16.h"
250
251 /* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
252 #include "unicode/utf_old.h"
253
254 #endif /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
255
256 #endif /* __UTF_H__ */
umachine.h
Basic types and constants for UTF.
utf16.h
C API: 16-bit Unicode handling macros.
utf8.h
C API: 8-bit Unicode handling macros.
utf_old.h
C API: Deprecated macros for Unicode string handling.