]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/uinvchar.h
ICU-400.42.tar.gz
[apple/icu.git] / icuSources / common / uinvchar.h
CommitLineData
374ca955
A
1/*
2*******************************************************************************
3*
4* Copyright (C) 1999-2004, International Business Machines
5* Corporation and others. All Rights Reserved.
6*
7*******************************************************************************
8* file name: uinvchar.h
9* encoding: US-ASCII
10* tab size: 8 (not used)
11* indentation:2
12*
13* created on: 2004sep14
14* created by: Markus W. Scherer
15*
16* Definitions for handling invariant characters, moved here from putil.c
17* for better modularization.
18*/
19
20#ifndef __UINVCHAR_H__
21#define __UINVCHAR_H__
22
23#include "unicode/utypes.h"
24
25/**
26 * Check if a char string only contains invariant characters.
27 * See utypes.h for details.
28 *
29 * @param s Input string pointer.
30 * @param length Length of the string, can be -1 if NUL-terminated.
31 * @return TRUE if s contains only invariant characters.
32 *
33 * @internal (ICU 2.8)
34 */
35U_INTERNAL UBool U_EXPORT2
36uprv_isInvariantString(const char *s, int32_t length);
37
38/**
39 * Check if a Unicode string only contains invariant characters.
40 * See utypes.h for details.
41 *
42 * @param s Input string pointer.
43 * @param length Length of the string, can be -1 if NUL-terminated.
44 * @return TRUE if s contains only invariant characters.
45 *
46 * @internal (ICU 2.8)
47 */
48U_INTERNAL UBool U_EXPORT2
49uprv_isInvariantUString(const UChar *s, int32_t length);
50
51/**
52 * \def U_UPPER_ORDINAL
53 * Get the ordinal number of an uppercase invariant character
54 * @internal
55 */
56#if U_CHARSET_FAMILY==U_ASCII_FAMILY
57# define U_UPPER_ORDINAL(x) ((x)-'A')
58#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
59# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
60 (((x) < 'S') ? ((x)-'J'+9) : \
61 ((x)-'S'+18)))
62#else
63# error Unknown charset family!
64#endif
65
66#endif