intl/icu/source/common/punycode.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/punycode.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,118 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 2002-2003, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  punycode.h
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 2002jan31
    1.17 +*   created by: Markus W. Scherer
    1.18 +*/
    1.19 +
    1.20 +/* This ICU code derived from: */
    1.21 +/*
    1.22 +punycode.c 0.4.0 (2001-Nov-17-Sat)
    1.23 +http://www.cs.berkeley.edu/~amc/idn/
    1.24 +Adam M. Costello
    1.25 +http://www.nicemice.net/amc/
    1.26 +*/
    1.27 +
    1.28 +#ifndef __PUNYCODE_H__
    1.29 +#define __PUNYCODE_H__
    1.30 +
    1.31 +#include "unicode/utypes.h"
    1.32 +
    1.33 +#if !UCONFIG_NO_IDNA
    1.34 +
    1.35 +/**
    1.36 + * u_strToPunycode() converts Unicode to Punycode.
    1.37 + *
    1.38 + * The input string must not contain single, unpaired surrogates.
    1.39 + * The output will be represented as an array of ASCII code points.
    1.40 + *
    1.41 + * The output string is NUL-terminated according to normal ICU
    1.42 + * string output rules.
    1.43 + *
    1.44 + * @param src Input Unicode string.
    1.45 + *            This function handles a limited amount of code points
    1.46 + *            (the limit is >=64).
    1.47 + *            U_INDEX_OUTOFBOUNDS_ERROR is set if the limit is exceeded.
    1.48 + * @param srcLength Number of UChars in src, or -1 if NUL-terminated.
    1.49 + * @param dest Output Punycode array.
    1.50 + * @param destCapacity Size of dest.
    1.51 + * @param caseFlags Vector of boolean values, one per input UChar,
    1.52 + *                  indicating that the corresponding character is to be
    1.53 + *                  marked for the decoder optionally
    1.54 + *                  uppercasing (TRUE) or lowercasing (FALSE)
    1.55 + *                  the character.
    1.56 + *                  ASCII characters are output directly in the case as marked.
    1.57 + *                  Flags corresponding to trail surrogates are ignored.
    1.58 + *                  If caseFlags==NULL then input characters are not
    1.59 + *                  case-mapped.
    1.60 + * @param pErrorCode ICU in/out error code parameter.
    1.61 + *                   U_INVALID_CHAR_FOUND if src contains
    1.62 + *                   unmatched single surrogates.
    1.63 + *                   U_INDEX_OUTOFBOUNDS_ERROR if src contains
    1.64 + *                   too many code points.
    1.65 + * @return Number of ASCII characters in puny.
    1.66 + *
    1.67 + * @see u_strFromPunycode
    1.68 + */
    1.69 +U_CFUNC int32_t
    1.70 +u_strToPunycode(const UChar *src, int32_t srcLength,
    1.71 +                UChar *dest, int32_t destCapacity,
    1.72 +                const UBool *caseFlags,
    1.73 +                UErrorCode *pErrorCode);
    1.74 +
    1.75 +/**
    1.76 + * u_strFromPunycode() converts Punycode to Unicode.
    1.77 + * The Unicode string will be at most as long (in UChars)
    1.78 + * than the Punycode string (in chars).
    1.79 + *
    1.80 + * @param src Input Punycode string.
    1.81 + * @param srcLength Length of puny, or -1 if NUL-terminated
    1.82 + * @param dest Output Unicode string buffer.
    1.83 + * @param destCapacity Size of dest in number of UChars,
    1.84 + *                     and of caseFlags in numbers of UBools.
    1.85 + * @param caseFlags Output array for case flags as
    1.86 + *                  defined by the Punycode string.
    1.87 + *                  The caller should uppercase (TRUE) or lowercase (FASLE)
    1.88 + *                  the corresponding character in dest.
    1.89 + *                  For supplementary characters, only the lead surrogate
    1.90 + *                  is marked, and FALSE is stored for the trail surrogate.
    1.91 + *                  This is redundant and not necessary for ASCII characters
    1.92 + *                  because they are already in the case indicated.
    1.93 + *                  Can be NULL if the case flags are not needed.
    1.94 + * @param pErrorCode ICU in/out error code parameter.
    1.95 + *                   U_INVALID_CHAR_FOUND if a non-ASCII character
    1.96 + *                   precedes the last delimiter ('-'),
    1.97 + *                   or if an invalid character (not a-zA-Z0-9) is found
    1.98 + *                   after the last delimiter.
    1.99 + *                   U_ILLEGAL_CHAR_FOUND if the delta sequence is ill-formed.
   1.100 + * @return Number of UChars written to dest.
   1.101 + *
   1.102 + * @see u_strToPunycode
   1.103 + */
   1.104 +U_CFUNC int32_t
   1.105 +u_strFromPunycode(const UChar *src, int32_t srcLength,
   1.106 +                  UChar *dest, int32_t destCapacity,
   1.107 +                  UBool *caseFlags,
   1.108 +                  UErrorCode *pErrorCode);
   1.109 +
   1.110 +#endif /* #if !UCONFIG_NO_IDNA */
   1.111 +
   1.112 +#endif
   1.113 +
   1.114 +/*
   1.115 + * Hey, Emacs, please set the following:
   1.116 + *
   1.117 + * Local Variables:
   1.118 + * indent-tabs-mode: nil
   1.119 + * End:
   1.120 + *
   1.121 + */

mercurial