ICU 73.1 73.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
130#define U_IS_UNICODE_NONCHAR(c) \
131 ((c)>=0xfdd0 && \
132 ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
133
151#define U_IS_UNICODE_CHAR(c) \
152 ((uint32_t)(c)<0xd800 || \
153 (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
154
161#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
162
169#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
170
177#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
178
185#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
186
193#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
194
202#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
203
211#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
212
213/* include the utfXX.h ------------------------------------------------------ */
214
215#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
216
217#include "unicode/utf8.h"
218#include "unicode/utf16.h"
219
220/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
221#include "unicode/utf_old.h"
222
223#endif /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
224
225#endif /* __UTF_H__ */
Basic types and constants for UTF.
C API: 16-bit Unicode handling macros.
C API: 8-bit Unicode handling macros.
C API: Deprecated macros for Unicode string handling.