|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * Copyright (C) 2010-2012, International Business Machines 00006 * Corporation and others. All Rights Reserved. 00007 ******************************************************************************* 00008 * file name: idna.h 00009 * encoding: UTF-8 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 2010mar05 00014 * created by: Markus W. Scherer 00015 */ 00016 00017 #ifndef __IDNA_H__ 00018 #define __IDNA_H__ 00019 00025 #include "unicode/utypes.h" 00026 00027 #if U_SHOW_CPLUSPLUS_API 00028 00029 #if !UCONFIG_NO_IDNA 00030 00031 #include "unicode/bytestream.h" 00032 #include "unicode/stringpiece.h" 00033 #include "unicode/uidna.h" 00034 #include "unicode/unistr.h" 00035 00036 U_NAMESPACE_BEGIN 00037 00038 class IDNAInfo; 00039 00052 class U_COMMON_API IDNA : public UObject { 00053 public: 00058 ~IDNA(); 00059 00093 static IDNA * 00094 createUTS46Instance(uint32_t options, UErrorCode &errorCode); 00095 00116 virtual UnicodeString & 00117 labelToASCII(const UnicodeString &label, UnicodeString &dest, 00118 IDNAInfo &info, UErrorCode &errorCode) const = 0; 00119 00138 virtual UnicodeString & 00139 labelToUnicode(const UnicodeString &label, UnicodeString &dest, 00140 IDNAInfo &info, UErrorCode &errorCode) const = 0; 00141 00162 virtual UnicodeString & 00163 nameToASCII(const UnicodeString &name, UnicodeString &dest, 00164 IDNAInfo &info, UErrorCode &errorCode) const = 0; 00165 00184 virtual UnicodeString & 00185 nameToUnicode(const UnicodeString &name, UnicodeString &dest, 00186 IDNAInfo &info, UErrorCode &errorCode) const = 0; 00187 00188 // UTF-8 versions of the processing methods ---------------------------- *** 00189 00204 virtual void 00205 labelToASCII_UTF8(StringPiece label, ByteSink &dest, 00206 IDNAInfo &info, UErrorCode &errorCode) const; 00207 00222 virtual void 00223 labelToUnicodeUTF8(StringPiece label, ByteSink &dest, 00224 IDNAInfo &info, UErrorCode &errorCode) const; 00225 00240 virtual void 00241 nameToASCII_UTF8(StringPiece name, ByteSink &dest, 00242 IDNAInfo &info, UErrorCode &errorCode) const; 00243 00258 virtual void 00259 nameToUnicodeUTF8(StringPiece name, ByteSink &dest, 00260 IDNAInfo &info, UErrorCode &errorCode) const; 00261 }; 00262 00263 class UTS46; 00264 00270 class U_COMMON_API IDNAInfo : public UMemory { 00271 public: 00276 IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {} 00282 UBool hasErrors() const { return errors!=0; } 00289 uint32_t getErrors() const { return errors; } 00303 UBool isTransitionalDifferent() const { return isTransDiff; } 00304 00305 private: 00306 friend class UTS46; 00307 00308 IDNAInfo(const IDNAInfo &other) = delete; // no copying 00309 IDNAInfo &operator=(const IDNAInfo &other) = delete; // no copying 00310 00311 void reset() { 00312 errors=labelErrors=0; 00313 isTransDiff=false; 00314 isBiDi=false; 00315 isOkBiDi=true; 00316 } 00317 00318 uint32_t errors, labelErrors; 00319 UBool isTransDiff; 00320 UBool isBiDi; 00321 UBool isOkBiDi; 00322 }; 00323 00324 U_NAMESPACE_END 00325 00326 #endif // UCONFIG_NO_IDNA 00327 00328 #endif /* U_SHOW_CPLUSPLUS_API */ 00329 00330 #endif // __IDNA_H__
1.7.6.1