intl/icu/source/common/uinvchar.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/uinvchar.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1999-2010, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  uinvchar.h
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:2
    1.15 +*
    1.16 +*   created on: 2004sep14
    1.17 +*   created by: Markus W. Scherer
    1.18 +*
    1.19 +*   Definitions for handling invariant characters, moved here from putil.c
    1.20 +*   for better modularization.
    1.21 +*/
    1.22 +
    1.23 +#ifndef __UINVCHAR_H__
    1.24 +#define __UINVCHAR_H__
    1.25 +
    1.26 +#include "unicode/utypes.h"
    1.27 +
    1.28 +/**
    1.29 + * Check if a char string only contains invariant characters.
    1.30 + * See utypes.h for details.
    1.31 + *
    1.32 + * @param s Input string pointer.
    1.33 + * @param length Length of the string, can be -1 if NUL-terminated.
    1.34 + * @return TRUE if s contains only invariant characters.
    1.35 + *
    1.36 + * @internal (ICU 2.8)
    1.37 + */
    1.38 +U_INTERNAL UBool U_EXPORT2
    1.39 +uprv_isInvariantString(const char *s, int32_t length);
    1.40 +
    1.41 +/**
    1.42 + * Check if a Unicode string only contains invariant characters.
    1.43 + * See utypes.h for details.
    1.44 + *
    1.45 + * @param s Input string pointer.
    1.46 + * @param length Length of the string, can be -1 if NUL-terminated.
    1.47 + * @return TRUE if s contains only invariant characters.
    1.48 + *
    1.49 + * @internal (ICU 2.8)
    1.50 + */
    1.51 +U_INTERNAL UBool U_EXPORT2
    1.52 +uprv_isInvariantUString(const UChar *s, int32_t length);
    1.53 +
    1.54 +/**
    1.55 + * \def U_UPPER_ORDINAL
    1.56 + * Get the ordinal number of an uppercase invariant character
    1.57 + * @internal
    1.58 + */
    1.59 +#if U_CHARSET_FAMILY==U_ASCII_FAMILY
    1.60 +#   define U_UPPER_ORDINAL(x) ((x)-'A')
    1.61 +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
    1.62 +#   define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
    1.63 +                              (((x) < 'S') ? ((x)-'J'+9) : \
    1.64 +                               ((x)-'S'+18)))
    1.65 +#else
    1.66 +#   error Unknown charset family!
    1.67 +#endif
    1.68 +
    1.69 +/**
    1.70 + * Compare two EBCDIC invariant-character strings in ASCII order.
    1.71 + * @internal
    1.72 + */
    1.73 +U_INTERNAL int32_t U_EXPORT2
    1.74 +uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
    1.75 +
    1.76 +/**
    1.77 + * \def uprv_compareInvCharsAsAscii
    1.78 + * Compare two invariant-character strings in ASCII order.
    1.79 + * @internal
    1.80 + */
    1.81 +#if U_CHARSET_FAMILY==U_ASCII_FAMILY
    1.82 +#   define uprv_compareInvCharsAsAscii(s1, s2) uprv_strcmp(s1, s2)
    1.83 +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
    1.84 +#   define uprv_compareInvCharsAsAscii(s1, s2) uprv_compareInvEbcdicAsAscii(s1, s2)
    1.85 +#else
    1.86 +#   error Unknown charset family!
    1.87 +#endif
    1.88 +
    1.89 +/**
    1.90 + * Converts an EBCDIC invariant character to lowercase ASCII.
    1.91 + * @internal
    1.92 + */
    1.93 +U_INTERNAL char U_EXPORT2
    1.94 +uprv_ebcdicToLowercaseAscii(char c);
    1.95 +
    1.96 +/**
    1.97 + * \def uprv_invCharToLowercaseAscii
    1.98 + * Converts an invariant character to lowercase ASCII.
    1.99 + * @internal
   1.100 + */
   1.101 +#if U_CHARSET_FAMILY==U_ASCII_FAMILY
   1.102 +#   define uprv_invCharToLowercaseAscii uprv_asciitolower
   1.103 +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
   1.104 +#   define uprv_invCharToLowercaseAscii uprv_ebcdicToLowercaseAscii
   1.105 +#else
   1.106 +#   error Unknown charset family!
   1.107 +#endif
   1.108 +
   1.109 +/**
   1.110 + * Copy EBCDIC to ASCII
   1.111 + * @internal
   1.112 + * @see uprv_strncpy
   1.113 + */
   1.114 +U_INTERNAL uint8_t* U_EXPORT2
   1.115 +uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
   1.116 +
   1.117 +
   1.118 +/**
   1.119 + * Copy ASCII to EBCDIC
   1.120 + * @internal
   1.121 + * @see uprv_strncpy
   1.122 + */
   1.123 +U_INTERNAL uint8_t* U_EXPORT2
   1.124 +uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
   1.125 +
   1.126 +
   1.127 +
   1.128 +#endif

mercurial