00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef USPOOF_H
00020 #define USPOOF_H
00021
00022 #include "unicode/utypes.h"
00023 #include "unicode/uset.h"
00024 #include "unicode/parseerr.h"
00025 #include "unicode/localpointer.h"
00026
00027 #if !UCONFIG_NO_NORMALIZATION
00028
00029
00030 #if U_SHOW_CPLUSPLUS_API
00031 #include "unicode/unistr.h"
00032 #include "unicode/uniset.h"
00033 #endif
00034
00035
00370 struct USpoofChecker;
00374 typedef struct USpoofChecker USpoofChecker;
00376 struct USpoofCheckResult;
00381 typedef struct USpoofCheckResult USpoofCheckResult;
00382
00390 typedef enum USpoofChecks {
00399 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
00400
00409 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
00410
00419 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
00420
00430 USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE,
00431
00432 #ifndef U_HIDE_DEPRECATED_API
00433
00438 USPOOF_ANY_CASE = 8,
00439 #endif
00440
00454 USPOOF_RESTRICTION_LEVEL = 16,
00455
00456 #ifndef U_HIDE_DEPRECATED_API
00457
00462 USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL,
00463 #endif
00464
00471 USPOOF_INVISIBLE = 32,
00472
00478 USPOOF_CHAR_LIMIT = 64,
00479
00486 USPOOF_MIXED_NUMBERS = 128,
00487
00493 USPOOF_ALL_CHECKS = 0xFFFF,
00494
00507 USPOOF_AUX_INFO = 0x40000000
00508
00509 } USpoofChecks;
00510
00511
00521 typedef enum URestrictionLevel {
00528 USPOOF_ASCII = 0x10000000,
00535 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
00549 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
00557 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
00563 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
00569 USPOOF_UNRESTRICTIVE = 0x60000000,
00575 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000,
00576 #ifndef U_HIDE_INTERNAL_API
00577
00581 USPOOF_UNDEFINED_RESTRICTIVE = -1
00582 #endif
00583 } URestrictionLevel;
00584
00595 U_STABLE USpoofChecker * U_EXPORT2
00596 uspoof_open(UErrorCode *status);
00597
00598
00620 U_STABLE USpoofChecker * U_EXPORT2
00621 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
00622 UErrorCode *pErrorCode);
00623
00654 U_STABLE USpoofChecker * U_EXPORT2
00655 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
00656 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
00657 int32_t *errType, UParseError *pe, UErrorCode *status);
00658
00659
00665 U_STABLE void U_EXPORT2
00666 uspoof_close(USpoofChecker *sc);
00667
00668 #if U_SHOW_CPLUSPLUS_API
00669
00670 U_NAMESPACE_BEGIN
00671
00681 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
00682
00683 U_NAMESPACE_END
00684
00685 #endif
00686
00696 U_STABLE USpoofChecker * U_EXPORT2
00697 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
00698
00699
00737 U_STABLE void U_EXPORT2
00738 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
00739
00751 U_STABLE int32_t U_EXPORT2
00752 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
00753
00765 U_STABLE void U_EXPORT2
00766 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
00767
00768
00776 U_STABLE URestrictionLevel U_EXPORT2
00777 uspoof_getRestrictionLevel(const USpoofChecker *sc);
00778
00821 U_STABLE void U_EXPORT2
00822 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
00823
00845 U_STABLE const char * U_EXPORT2
00846 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
00847
00848
00867 U_STABLE void U_EXPORT2
00868 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
00869
00870
00891 U_STABLE const USet * U_EXPORT2
00892 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
00893
00894
00895 #if U_SHOW_CPLUSPLUS_API
00896
00914 U_STABLE void U_EXPORT2
00915 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
00916
00917
00938 U_STABLE const icu::UnicodeSet * U_EXPORT2
00939 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
00940 #endif
00941
00942
00975 U_STABLE int32_t U_EXPORT2
00976 uspoof_check(const USpoofChecker *sc,
00977 const UChar *id, int32_t length,
00978 int32_t *position,
00979 UErrorCode *status);
00980
00981
01014 U_STABLE int32_t U_EXPORT2
01015 uspoof_checkUTF8(const USpoofChecker *sc,
01016 const char *id, int32_t length,
01017 int32_t *position,
01018 UErrorCode *status);
01019
01020
01021 #if U_SHOW_CPLUSPLUS_API
01022
01050 U_STABLE int32_t U_EXPORT2
01051 uspoof_checkUnicodeString(const USpoofChecker *sc,
01052 const icu::UnicodeString &id,
01053 int32_t *position,
01054 UErrorCode *status);
01055 #endif
01056
01057
01086 U_STABLE int32_t U_EXPORT2
01087 uspoof_check2(const USpoofChecker *sc,
01088 const UChar* id, int32_t length,
01089 USpoofCheckResult* checkResult,
01090 UErrorCode *status);
01091
01123 U_STABLE int32_t U_EXPORT2
01124 uspoof_check2UTF8(const USpoofChecker *sc,
01125 const char *id, int32_t length,
01126 USpoofCheckResult* checkResult,
01127 UErrorCode *status);
01128
01129 #if U_SHOW_CPLUSPLUS_API
01130
01155 U_STABLE int32_t U_EXPORT2
01156 uspoof_check2UnicodeString(const USpoofChecker *sc,
01157 const icu::UnicodeString &id,
01158 USpoofCheckResult* checkResult,
01159 UErrorCode *status);
01160 #endif
01161
01180 U_STABLE USpoofCheckResult* U_EXPORT2
01181 uspoof_openCheckResult(UErrorCode *status);
01182
01190 U_STABLE void U_EXPORT2
01191 uspoof_closeCheckResult(USpoofCheckResult *checkResult);
01192
01193 #if U_SHOW_CPLUSPLUS_API
01194
01195 U_NAMESPACE_BEGIN
01196
01206 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult);
01207
01208 U_NAMESPACE_END
01209
01210 #endif
01211
01226 U_STABLE int32_t U_EXPORT2
01227 uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status);
01228
01239 U_STABLE URestrictionLevel U_EXPORT2
01240 uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status);
01241
01253 U_STABLE const USet* U_EXPORT2
01254 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status);
01255
01256
01300 U_STABLE int32_t U_EXPORT2
01301 uspoof_areConfusable(const USpoofChecker *sc,
01302 const UChar *id1, int32_t length1,
01303 const UChar *id2, int32_t length2,
01304 UErrorCode *status);
01305
01306
01307
01333 U_STABLE int32_t U_EXPORT2
01334 uspoof_areConfusableUTF8(const USpoofChecker *sc,
01335 const char *id1, int32_t length1,
01336 const char *id2, int32_t length2,
01337 UErrorCode *status);
01338
01339
01340
01341
01342 #if U_SHOW_CPLUSPLUS_API
01343
01364 U_STABLE int32_t U_EXPORT2
01365 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
01366 const icu::UnicodeString &s1,
01367 const icu::UnicodeString &s2,
01368 UErrorCode *status);
01369 #endif
01370
01371
01403 U_STABLE int32_t U_EXPORT2
01404 uspoof_getSkeleton(const USpoofChecker *sc,
01405 uint32_t type,
01406 const UChar *id, int32_t length,
01407 UChar *dest, int32_t destCapacity,
01408 UErrorCode *status);
01409
01443 U_STABLE int32_t U_EXPORT2
01444 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
01445 uint32_t type,
01446 const char *id, int32_t length,
01447 char *dest, int32_t destCapacity,
01448 UErrorCode *status);
01449
01450 #if U_SHOW_CPLUSPLUS_API
01451
01474 U_I18N_API icu::UnicodeString & U_EXPORT2
01475 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
01476 uint32_t type,
01477 const icu::UnicodeString &id,
01478 icu::UnicodeString &dest,
01479 UErrorCode *status);
01480 #endif
01481
01494 U_STABLE const USet * U_EXPORT2
01495 uspoof_getInclusionSet(UErrorCode *status);
01496
01509 U_STABLE const USet * U_EXPORT2
01510 uspoof_getRecommendedSet(UErrorCode *status);
01511
01512 #if U_SHOW_CPLUSPLUS_API
01513
01526 U_STABLE const icu::UnicodeSet * U_EXPORT2
01527 uspoof_getInclusionUnicodeSet(UErrorCode *status);
01528
01541 U_STABLE const icu::UnicodeSet * U_EXPORT2
01542 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
01543
01544 #endif
01545
01568 U_STABLE int32_t U_EXPORT2
01569 uspoof_serialize(USpoofChecker *sc,
01570 void *data, int32_t capacity,
01571 UErrorCode *status);
01572
01573
01574 #endif
01575
01576 #endif