text: C API: Code point macros. More...
  #include "unicode/umachine.h"
  #include "unicode/utf8.h"
  #include "unicode/utf16.h"
  #include "unicode/utf_old.h"
  Go to the source code of this file.
  C API: Code point macros.
  This file defines macros for checking whether a code point is a surrogate or a non-character etc.
  If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some common definitions. If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 1 then each of these headers must be included explicitly if their definitions are used.
  utf8.h and utf16.h define macros for efficiently getting code points in and out of UTF-8/16 strings. utf16.h macros have "U16_" prefixes. utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling.
  ICU mostly.
  umachine.h defines UChar to be an unsigned 16-bit integer. Since ICU 59, ICU uses char16_t in C++, UChar only in C, and defines UChar=char16_t by default. See the UChar API docs for details.
  UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as the definition of UChar. For details see the documentation for UChar32 itself.
  utf.h or UTF-8.
  The U16_ macros detect if a surrogate code unit is unpaired (lead unit without trail unit or vice versa) and just return the unit itself as the code point.
  The U8_ macros detect illegal byte sequences and return a negative value. Starting with ICU 60, the observable length of a single illegal byte sequence skipped by one of these macros follows the Unicode 6+ recommendation which is consistent with the W3C Encoding Standard.
  There are ..._OR_FFFD versions of both U16_ and U8_ macros that return U+FFFD for illegal code unit sequences.
  The regular "safe" macros require that the initial, passed-in string index is within bounds. They only check the index when they read more than one code unit. This is usually done with code similar to the following loop:
  while(i<length) { U16_NEXT(s, i, length, c); // use c } some complicated cases.
  Unlike with UTF-16, malformed sequences cannot be expressed with distinct code point values (0..U+10ffff). They are indicated with negative values instead.
  For more information see.h.
  Assuming c is a surrogate code point (U_IS_SURROGATE(c)), is it a lead surrogate?
  Definition at line 202 of file utf.h.
  Assuming c is a surrogate code point (U_IS_SURROGATE(c)), is it a trail surrogate?
  Definition at line 211 of file utf.h.
  Is c a Unicode code point value (0..U+10ffff) that can be assigned a character?
  Code points that are not characters include:
  This means that all code points below U+d800 are character code points, and that boundary is tested first for performance.
  Definition at line 151 of file utf.h.