1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others. 2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html 3*0e209d39SAndroid Build Coastguard Worker /* 4*0e209d39SAndroid Build Coastguard Worker ******************************************************************************* 5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 2010-2012, International Business Machines 6*0e209d39SAndroid Build Coastguard Worker * Corporation and others. All Rights Reserved. 7*0e209d39SAndroid Build Coastguard Worker ******************************************************************************* 8*0e209d39SAndroid Build Coastguard Worker * file name: idna.h 9*0e209d39SAndroid Build Coastguard Worker * encoding: UTF-8 10*0e209d39SAndroid Build Coastguard Worker * tab size: 8 (not used) 11*0e209d39SAndroid Build Coastguard Worker * indentation:4 12*0e209d39SAndroid Build Coastguard Worker * 13*0e209d39SAndroid Build Coastguard Worker * created on: 2010mar05 14*0e209d39SAndroid Build Coastguard Worker * created by: Markus W. Scherer 15*0e209d39SAndroid Build Coastguard Worker */ 16*0e209d39SAndroid Build Coastguard Worker 17*0e209d39SAndroid Build Coastguard Worker #ifndef __IDNA_H__ 18*0e209d39SAndroid Build Coastguard Worker #define __IDNA_H__ 19*0e209d39SAndroid Build Coastguard Worker 20*0e209d39SAndroid Build Coastguard Worker /** 21*0e209d39SAndroid Build Coastguard Worker * \file 22*0e209d39SAndroid Build Coastguard Worker * \brief C++ API: Internationalizing Domain Names in Applications (IDNA) 23*0e209d39SAndroid Build Coastguard Worker */ 24*0e209d39SAndroid Build Coastguard Worker 25*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h" 26*0e209d39SAndroid Build Coastguard Worker 27*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API 28*0e209d39SAndroid Build Coastguard Worker 29*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_IDNA 30*0e209d39SAndroid Build Coastguard Worker 31*0e209d39SAndroid Build Coastguard Worker #include "unicode/bytestream.h" 32*0e209d39SAndroid Build Coastguard Worker #include "unicode/stringpiece.h" 33*0e209d39SAndroid Build Coastguard Worker #include "unicode/uidna.h" 34*0e209d39SAndroid Build Coastguard Worker #include "unicode/unistr.h" 35*0e209d39SAndroid Build Coastguard Worker 36*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN 37*0e209d39SAndroid Build Coastguard Worker 38*0e209d39SAndroid Build Coastguard Worker class IDNAInfo; 39*0e209d39SAndroid Build Coastguard Worker 40*0e209d39SAndroid Build Coastguard Worker /** 41*0e209d39SAndroid Build Coastguard Worker * Abstract base class for IDNA processing. 42*0e209d39SAndroid Build Coastguard Worker * See http://www.unicode.org/reports/tr46/ 43*0e209d39SAndroid Build Coastguard Worker * and http://www.ietf.org/rfc/rfc3490.txt 44*0e209d39SAndroid Build Coastguard Worker * 45*0e209d39SAndroid Build Coastguard Worker * The IDNA class is not intended for public subclassing. 46*0e209d39SAndroid Build Coastguard Worker * 47*0e209d39SAndroid Build Coastguard Worker * This C++ API currently only implements UTS #46. 48*0e209d39SAndroid Build Coastguard Worker * The uidna.h C API implements both UTS #46 (functions using UIDNA service object) 49*0e209d39SAndroid Build Coastguard Worker * and IDNA2003 (functions that do not use a service object). 50*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 51*0e209d39SAndroid Build Coastguard Worker */ 52*0e209d39SAndroid Build Coastguard Worker class U_COMMON_API IDNA : public UObject { 53*0e209d39SAndroid Build Coastguard Worker public: 54*0e209d39SAndroid Build Coastguard Worker /** 55*0e209d39SAndroid Build Coastguard Worker * Destructor. 56*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 57*0e209d39SAndroid Build Coastguard Worker */ 58*0e209d39SAndroid Build Coastguard Worker ~IDNA(); 59*0e209d39SAndroid Build Coastguard Worker 60*0e209d39SAndroid Build Coastguard Worker /** 61*0e209d39SAndroid Build Coastguard Worker * Returns an IDNA instance which implements UTS #46. 62*0e209d39SAndroid Build Coastguard Worker * Returns an unmodifiable instance, owned by the caller. 63*0e209d39SAndroid Build Coastguard Worker * Cache it for multiple operations, and delete it when done. 64*0e209d39SAndroid Build Coastguard Worker * The instance is thread-safe, that is, it can be used concurrently. 65*0e209d39SAndroid Build Coastguard Worker * 66*0e209d39SAndroid Build Coastguard Worker * UTS #46 defines Unicode IDNA Compatibility Processing, 67*0e209d39SAndroid Build Coastguard Worker * updated to the latest version of Unicode and compatible with both 68*0e209d39SAndroid Build Coastguard Worker * IDNA2003 and IDNA2008. 69*0e209d39SAndroid Build Coastguard Worker * 70*0e209d39SAndroid Build Coastguard Worker * The worker functions use transitional processing, including deviation mappings, 71*0e209d39SAndroid Build Coastguard Worker * unless UIDNA_NONTRANSITIONAL_TO_ASCII or UIDNA_NONTRANSITIONAL_TO_UNICODE 72*0e209d39SAndroid Build Coastguard Worker * is used in which case the deviation characters are passed through without change. 73*0e209d39SAndroid Build Coastguard Worker * 74*0e209d39SAndroid Build Coastguard Worker * Disallowed characters are mapped to U+FFFD. 75*0e209d39SAndroid Build Coastguard Worker * 76*0e209d39SAndroid Build Coastguard Worker * For available options see the uidna.h header. 77*0e209d39SAndroid Build Coastguard Worker * Operations with the UTS #46 instance do not support the 78*0e209d39SAndroid Build Coastguard Worker * UIDNA_ALLOW_UNASSIGNED option. 79*0e209d39SAndroid Build Coastguard Worker * 80*0e209d39SAndroid Build Coastguard Worker * By default, the UTS #46 implementation allows all ASCII characters (as valid or mapped). 81*0e209d39SAndroid Build Coastguard Worker * When the UIDNA_USE_STD3_RULES option is used, ASCII characters other than 82*0e209d39SAndroid Build Coastguard Worker * letters, digits, hyphen (LDH) and dot/full stop are disallowed and mapped to U+FFFD. 83*0e209d39SAndroid Build Coastguard Worker * 84*0e209d39SAndroid Build Coastguard Worker * @param options Bit set to modify the processing and error checking. 85*0e209d39SAndroid Build Coastguard Worker * See option bit set values in uidna.h. 86*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 87*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 88*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 89*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 90*0e209d39SAndroid Build Coastguard Worker * @return the UTS #46 IDNA instance, if successful 91*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 92*0e209d39SAndroid Build Coastguard Worker */ 93*0e209d39SAndroid Build Coastguard Worker static IDNA * 94*0e209d39SAndroid Build Coastguard Worker createUTS46Instance(uint32_t options, UErrorCode &errorCode); 95*0e209d39SAndroid Build Coastguard Worker 96*0e209d39SAndroid Build Coastguard Worker /** 97*0e209d39SAndroid Build Coastguard Worker * Converts a single domain name label into its ASCII form for DNS lookup. 98*0e209d39SAndroid Build Coastguard Worker * If any processing step fails, then info.hasErrors() will be true and 99*0e209d39SAndroid Build Coastguard Worker * the result might not be an ASCII string. 100*0e209d39SAndroid Build Coastguard Worker * The label might be modified according to the types of errors. 101*0e209d39SAndroid Build Coastguard Worker * Labels with severe errors will be left in (or turned into) their Unicode form. 102*0e209d39SAndroid Build Coastguard Worker * 103*0e209d39SAndroid Build Coastguard Worker * The UErrorCode indicates an error only in exceptional cases, 104*0e209d39SAndroid Build Coastguard Worker * such as a U_MEMORY_ALLOCATION_ERROR. 105*0e209d39SAndroid Build Coastguard Worker * 106*0e209d39SAndroid Build Coastguard Worker * @param label Input domain name label 107*0e209d39SAndroid Build Coastguard Worker * @param dest Destination string object 108*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 109*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 110*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 111*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 112*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 113*0e209d39SAndroid Build Coastguard Worker * @return dest 114*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 115*0e209d39SAndroid Build Coastguard Worker */ 116*0e209d39SAndroid Build Coastguard Worker virtual UnicodeString & 117*0e209d39SAndroid Build Coastguard Worker labelToASCII(const UnicodeString &label, UnicodeString &dest, 118*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const = 0; 119*0e209d39SAndroid Build Coastguard Worker 120*0e209d39SAndroid Build Coastguard Worker /** 121*0e209d39SAndroid Build Coastguard Worker * Converts a single domain name label into its Unicode form for human-readable display. 122*0e209d39SAndroid Build Coastguard Worker * If any processing step fails, then info.hasErrors() will be true. 123*0e209d39SAndroid Build Coastguard Worker * The label might be modified according to the types of errors. 124*0e209d39SAndroid Build Coastguard Worker * 125*0e209d39SAndroid Build Coastguard Worker * The UErrorCode indicates an error only in exceptional cases, 126*0e209d39SAndroid Build Coastguard Worker * such as a U_MEMORY_ALLOCATION_ERROR. 127*0e209d39SAndroid Build Coastguard Worker * 128*0e209d39SAndroid Build Coastguard Worker * @param label Input domain name label 129*0e209d39SAndroid Build Coastguard Worker * @param dest Destination string object 130*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 131*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 132*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 133*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 134*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 135*0e209d39SAndroid Build Coastguard Worker * @return dest 136*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 137*0e209d39SAndroid Build Coastguard Worker */ 138*0e209d39SAndroid Build Coastguard Worker virtual UnicodeString & 139*0e209d39SAndroid Build Coastguard Worker labelToUnicode(const UnicodeString &label, UnicodeString &dest, 140*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const = 0; 141*0e209d39SAndroid Build Coastguard Worker 142*0e209d39SAndroid Build Coastguard Worker /** 143*0e209d39SAndroid Build Coastguard Worker * Converts a whole domain name into its ASCII form for DNS lookup. 144*0e209d39SAndroid Build Coastguard Worker * If any processing step fails, then info.hasErrors() will be true and 145*0e209d39SAndroid Build Coastguard Worker * the result might not be an ASCII string. 146*0e209d39SAndroid Build Coastguard Worker * The domain name might be modified according to the types of errors. 147*0e209d39SAndroid Build Coastguard Worker * Labels with severe errors will be left in (or turned into) their Unicode form. 148*0e209d39SAndroid Build Coastguard Worker * 149*0e209d39SAndroid Build Coastguard Worker * The UErrorCode indicates an error only in exceptional cases, 150*0e209d39SAndroid Build Coastguard Worker * such as a U_MEMORY_ALLOCATION_ERROR. 151*0e209d39SAndroid Build Coastguard Worker * 152*0e209d39SAndroid Build Coastguard Worker * @param name Input domain name 153*0e209d39SAndroid Build Coastguard Worker * @param dest Destination string object 154*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 155*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 156*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 157*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 158*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 159*0e209d39SAndroid Build Coastguard Worker * @return dest 160*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 161*0e209d39SAndroid Build Coastguard Worker */ 162*0e209d39SAndroid Build Coastguard Worker virtual UnicodeString & 163*0e209d39SAndroid Build Coastguard Worker nameToASCII(const UnicodeString &name, UnicodeString &dest, 164*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const = 0; 165*0e209d39SAndroid Build Coastguard Worker 166*0e209d39SAndroid Build Coastguard Worker /** 167*0e209d39SAndroid Build Coastguard Worker * Converts a whole domain name into its Unicode form for human-readable display. 168*0e209d39SAndroid Build Coastguard Worker * If any processing step fails, then info.hasErrors() will be true. 169*0e209d39SAndroid Build Coastguard Worker * The domain name might be modified according to the types of errors. 170*0e209d39SAndroid Build Coastguard Worker * 171*0e209d39SAndroid Build Coastguard Worker * The UErrorCode indicates an error only in exceptional cases, 172*0e209d39SAndroid Build Coastguard Worker * such as a U_MEMORY_ALLOCATION_ERROR. 173*0e209d39SAndroid Build Coastguard Worker * 174*0e209d39SAndroid Build Coastguard Worker * @param name Input domain name 175*0e209d39SAndroid Build Coastguard Worker * @param dest Destination string object 176*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 177*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 178*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 179*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 180*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 181*0e209d39SAndroid Build Coastguard Worker * @return dest 182*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 183*0e209d39SAndroid Build Coastguard Worker */ 184*0e209d39SAndroid Build Coastguard Worker virtual UnicodeString & 185*0e209d39SAndroid Build Coastguard Worker nameToUnicode(const UnicodeString &name, UnicodeString &dest, 186*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const = 0; 187*0e209d39SAndroid Build Coastguard Worker 188*0e209d39SAndroid Build Coastguard Worker // UTF-8 versions of the processing methods ---------------------------- *** 189*0e209d39SAndroid Build Coastguard Worker 190*0e209d39SAndroid Build Coastguard Worker /** 191*0e209d39SAndroid Build Coastguard Worker * Converts a single domain name label into its ASCII form for DNS lookup. 192*0e209d39SAndroid Build Coastguard Worker * UTF-8 version of labelToASCII(), same behavior. 193*0e209d39SAndroid Build Coastguard Worker * 194*0e209d39SAndroid Build Coastguard Worker * @param label Input domain name label 195*0e209d39SAndroid Build Coastguard Worker * @param dest Destination byte sink; Flush()ed if successful 196*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 197*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 198*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 199*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 200*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 201*0e209d39SAndroid Build Coastguard Worker * @return dest 202*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 203*0e209d39SAndroid Build Coastguard Worker */ 204*0e209d39SAndroid Build Coastguard Worker virtual void 205*0e209d39SAndroid Build Coastguard Worker labelToASCII_UTF8(StringPiece label, ByteSink &dest, 206*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const; 207*0e209d39SAndroid Build Coastguard Worker 208*0e209d39SAndroid Build Coastguard Worker /** 209*0e209d39SAndroid Build Coastguard Worker * Converts a single domain name label into its Unicode form for human-readable display. 210*0e209d39SAndroid Build Coastguard Worker * UTF-8 version of labelToUnicode(), same behavior. 211*0e209d39SAndroid Build Coastguard Worker * 212*0e209d39SAndroid Build Coastguard Worker * @param label Input domain name label 213*0e209d39SAndroid Build Coastguard Worker * @param dest Destination byte sink; Flush()ed if successful 214*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 215*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 216*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 217*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 218*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 219*0e209d39SAndroid Build Coastguard Worker * @return dest 220*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 221*0e209d39SAndroid Build Coastguard Worker */ 222*0e209d39SAndroid Build Coastguard Worker virtual void 223*0e209d39SAndroid Build Coastguard Worker labelToUnicodeUTF8(StringPiece label, ByteSink &dest, 224*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const; 225*0e209d39SAndroid Build Coastguard Worker 226*0e209d39SAndroid Build Coastguard Worker /** 227*0e209d39SAndroid Build Coastguard Worker * Converts a whole domain name into its ASCII form for DNS lookup. 228*0e209d39SAndroid Build Coastguard Worker * UTF-8 version of nameToASCII(), same behavior. 229*0e209d39SAndroid Build Coastguard Worker * 230*0e209d39SAndroid Build Coastguard Worker * @param name Input domain name 231*0e209d39SAndroid Build Coastguard Worker * @param dest Destination byte sink; Flush()ed if successful 232*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 233*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 234*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 235*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 236*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 237*0e209d39SAndroid Build Coastguard Worker * @return dest 238*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 239*0e209d39SAndroid Build Coastguard Worker */ 240*0e209d39SAndroid Build Coastguard Worker virtual void 241*0e209d39SAndroid Build Coastguard Worker nameToASCII_UTF8(StringPiece name, ByteSink &dest, 242*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const; 243*0e209d39SAndroid Build Coastguard Worker 244*0e209d39SAndroid Build Coastguard Worker /** 245*0e209d39SAndroid Build Coastguard Worker * Converts a whole domain name into its Unicode form for human-readable display. 246*0e209d39SAndroid Build Coastguard Worker * UTF-8 version of nameToUnicode(), same behavior. 247*0e209d39SAndroid Build Coastguard Worker * 248*0e209d39SAndroid Build Coastguard Worker * @param name Input domain name 249*0e209d39SAndroid Build Coastguard Worker * @param dest Destination byte sink; Flush()ed if successful 250*0e209d39SAndroid Build Coastguard Worker * @param info Output container of IDNA processing details. 251*0e209d39SAndroid Build Coastguard Worker * @param errorCode Standard ICU error code. Its input value must 252*0e209d39SAndroid Build Coastguard Worker * pass the U_SUCCESS() test, or else the function returns 253*0e209d39SAndroid Build Coastguard Worker * immediately. Check for U_FAILURE() on output or use with 254*0e209d39SAndroid Build Coastguard Worker * function chaining. (See User Guide for details.) 255*0e209d39SAndroid Build Coastguard Worker * @return dest 256*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 257*0e209d39SAndroid Build Coastguard Worker */ 258*0e209d39SAndroid Build Coastguard Worker virtual void 259*0e209d39SAndroid Build Coastguard Worker nameToUnicodeUTF8(StringPiece name, ByteSink &dest, 260*0e209d39SAndroid Build Coastguard Worker IDNAInfo &info, UErrorCode &errorCode) const; 261*0e209d39SAndroid Build Coastguard Worker }; 262*0e209d39SAndroid Build Coastguard Worker 263*0e209d39SAndroid Build Coastguard Worker class UTS46; 264*0e209d39SAndroid Build Coastguard Worker 265*0e209d39SAndroid Build Coastguard Worker /** 266*0e209d39SAndroid Build Coastguard Worker * Output container for IDNA processing errors. 267*0e209d39SAndroid Build Coastguard Worker * The IDNAInfo class is not suitable for subclassing. 268*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 269*0e209d39SAndroid Build Coastguard Worker */ 270*0e209d39SAndroid Build Coastguard Worker class U_COMMON_API IDNAInfo : public UMemory { 271*0e209d39SAndroid Build Coastguard Worker public: 272*0e209d39SAndroid Build Coastguard Worker /** 273*0e209d39SAndroid Build Coastguard Worker * Constructor for stack allocation. 274*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 275*0e209d39SAndroid Build Coastguard Worker */ IDNAInfo()276*0e209d39SAndroid Build Coastguard Worker IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {} 277*0e209d39SAndroid Build Coastguard Worker /** 278*0e209d39SAndroid Build Coastguard Worker * Were there IDNA processing errors? 279*0e209d39SAndroid Build Coastguard Worker * @return true if there were processing errors 280*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 281*0e209d39SAndroid Build Coastguard Worker */ hasErrors()282*0e209d39SAndroid Build Coastguard Worker UBool hasErrors() const { return errors!=0; } 283*0e209d39SAndroid Build Coastguard Worker /** 284*0e209d39SAndroid Build Coastguard Worker * Returns a bit set indicating IDNA processing errors. 285*0e209d39SAndroid Build Coastguard Worker * See UIDNA_ERROR_... constants in uidna.h. 286*0e209d39SAndroid Build Coastguard Worker * @return bit set of processing errors 287*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 288*0e209d39SAndroid Build Coastguard Worker */ getErrors()289*0e209d39SAndroid Build Coastguard Worker uint32_t getErrors() const { return errors; } 290*0e209d39SAndroid Build Coastguard Worker /** 291*0e209d39SAndroid Build Coastguard Worker * Returns true if transitional and nontransitional processing produce different results. 292*0e209d39SAndroid Build Coastguard Worker * This is the case when the input label or domain name contains 293*0e209d39SAndroid Build Coastguard Worker * one or more deviation characters outside a Punycode label (see UTS #46). 294*0e209d39SAndroid Build Coastguard Worker * <ul> 295*0e209d39SAndroid Build Coastguard Worker * <li>With nontransitional processing, such characters are 296*0e209d39SAndroid Build Coastguard Worker * copied to the destination string. 297*0e209d39SAndroid Build Coastguard Worker * <li>With transitional processing, such characters are 298*0e209d39SAndroid Build Coastguard Worker * mapped (sharp s/sigma) or removed (joiner/nonjoiner). 299*0e209d39SAndroid Build Coastguard Worker * </ul> 300*0e209d39SAndroid Build Coastguard Worker * @return true if transitional and nontransitional processing produce different results 301*0e209d39SAndroid Build Coastguard Worker * @stable ICU 4.6 302*0e209d39SAndroid Build Coastguard Worker */ isTransitionalDifferent()303*0e209d39SAndroid Build Coastguard Worker UBool isTransitionalDifferent() const { return isTransDiff; } 304*0e209d39SAndroid Build Coastguard Worker 305*0e209d39SAndroid Build Coastguard Worker private: 306*0e209d39SAndroid Build Coastguard Worker friend class UTS46; 307*0e209d39SAndroid Build Coastguard Worker 308*0e209d39SAndroid Build Coastguard Worker IDNAInfo(const IDNAInfo &other) = delete; // no copying 309*0e209d39SAndroid Build Coastguard Worker IDNAInfo &operator=(const IDNAInfo &other) = delete; // no copying 310*0e209d39SAndroid Build Coastguard Worker reset()311*0e209d39SAndroid Build Coastguard Worker void reset() { 312*0e209d39SAndroid Build Coastguard Worker errors=labelErrors=0; 313*0e209d39SAndroid Build Coastguard Worker isTransDiff=false; 314*0e209d39SAndroid Build Coastguard Worker isBiDi=false; 315*0e209d39SAndroid Build Coastguard Worker isOkBiDi=true; 316*0e209d39SAndroid Build Coastguard Worker } 317*0e209d39SAndroid Build Coastguard Worker 318*0e209d39SAndroid Build Coastguard Worker uint32_t errors, labelErrors; 319*0e209d39SAndroid Build Coastguard Worker UBool isTransDiff; 320*0e209d39SAndroid Build Coastguard Worker UBool isBiDi; 321*0e209d39SAndroid Build Coastguard Worker UBool isOkBiDi; 322*0e209d39SAndroid Build Coastguard Worker }; 323*0e209d39SAndroid Build Coastguard Worker 324*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END 325*0e209d39SAndroid Build Coastguard Worker 326*0e209d39SAndroid Build Coastguard Worker #endif // UCONFIG_NO_IDNA 327*0e209d39SAndroid Build Coastguard Worker 328*0e209d39SAndroid Build Coastguard Worker #endif /* U_SHOW_CPLUSPLUS_API */ 329*0e209d39SAndroid Build Coastguard Worker 330*0e209d39SAndroid Build Coastguard Worker #endif // __IDNA_H__ 331