ICU 55.1 55.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
idna.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2010-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: idna.h
7 * encoding: US-ASCII
8 * tab size: 8 (not used)
9 * indentation:4
10 *
11 * created on: 2010mar05
12 * created by: Markus W. Scherer
13 */
14
15 #ifndef __IDNA_H__
16 #define __IDNA_H__
17
23 #include "unicode/utypes.h"
24
25 #if !UCONFIG_NO_IDNA
26
27 #include "unicode/bytestream.h"
28 #include "unicode/stringpiece.h"
29 #include "unicode/uidna.h"
30 #include "unicode/unistr.h"
31
32 U_NAMESPACE_BEGIN
33
34 class IDNAInfo;
35
48 class U_COMMON_API IDNA : public UObject {
49 public:
54 ~IDNA();
55
89 static IDNA *
90 createUTS46Instance(uint32_t options, UErrorCode &errorCode);
91
112 virtual UnicodeString &
113 labelToASCII(const UnicodeString &label, UnicodeString &dest,
114 IDNAInfo &info, UErrorCode &errorCode) const = 0;
115
134 virtual UnicodeString &
135 labelToUnicode(const UnicodeString &label, UnicodeString &dest,
136 IDNAInfo &info, UErrorCode &errorCode) const = 0;
137
158 virtual UnicodeString &
159 nameToASCII(const UnicodeString &name, UnicodeString &dest,
160 IDNAInfo &info, UErrorCode &errorCode) const = 0;
161
180 virtual UnicodeString &
181 nameToUnicode(const UnicodeString &name, UnicodeString &dest,
182 IDNAInfo &info, UErrorCode &errorCode) const = 0;
183
184 // UTF-8 versions of the processing methods ---------------------------- ***
185
200 virtual void
201 labelToASCII_UTF8(const StringPiece &label, ByteSink &dest,
202 IDNAInfo &info, UErrorCode &errorCode) const;
203
218 virtual void
219 labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest,
220 IDNAInfo &info, UErrorCode &errorCode) const;
221
236 virtual void
237 nameToASCII_UTF8(const StringPiece &name, ByteSink &dest,
238 IDNAInfo &info, UErrorCode &errorCode) const;
239
254 virtual void
255 nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest,
256 IDNAInfo &info, UErrorCode &errorCode) const;
257 };
258
259 class UTS46;
260
266 class U_COMMON_API IDNAInfo : public UMemory {
267 public:
272 IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {}
278 UBool hasErrors() const { return errors!=0; }
285 uint32_t getErrors() const { return errors; }
299 UBool isTransitionalDifferent() const { return isTransDiff; }
300
301 private:
302 friend class UTS46;
303
304 IDNAInfo(const IDNAInfo &other); // no copying
305 IDNAInfo &operator=(const IDNAInfo &other); // no copying
306
307 void reset() {
308 errors=labelErrors=0;
309 isTransDiff=FALSE;
310 isBiDi=FALSE;
311 isOkBiDi=TRUE;
312 }
313
314 uint32_t errors, labelErrors;
315 UBool isTransDiff;
316 UBool isBiDi;
317 UBool isOkBiDi;
318 };
319
320 U_NAMESPACE_END
321
322 #endif // UCONFIG_NO_IDNA
323 #endif // __IDNA_H__