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
00356 struct USpoofChecker;
00360 typedef struct USpoofChecker USpoofChecker;
00362 struct USpoofCheckResult;
00367 typedef struct USpoofCheckResult USpoofCheckResult;
00368
00376 typedef enum USpoofChecks {
00385 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
00386
00395 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
00396
00405 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
00406
00416 USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE,
00417
00418 #ifndef U_HIDE_DEPRECATED_API
00419
00424 USPOOF_ANY_CASE = 8,
00425 #endif
00426
00440 USPOOF_RESTRICTION_LEVEL = 16,
00441
00442 #ifndef U_HIDE_DEPRECATED_API
00443
00448 USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL,
00449 #endif
00450
00457 USPOOF_INVISIBLE = 32,
00458
00464 USPOOF_CHAR_LIMIT = 64,
00465
00472 USPOOF_MIXED_NUMBERS = 128,
00473
00474 #ifndef U_HIDE_DRAFT_API
00475
00494 USPOOF_HIDDEN_OVERLAY = 256,
00495 #endif
00496
00502 USPOOF_ALL_CHECKS = 0xFFFF,
00503
00516 USPOOF_AUX_INFO = 0x40000000
00517
00518 } USpoofChecks;
00519
00520
00530 typedef enum URestrictionLevel {
00537 USPOOF_ASCII = 0x10000000,
00544 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
00558 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
00566 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
00572 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
00578 USPOOF_UNRESTRICTIVE = 0x60000000,
00584 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000,
00585 #ifndef U_HIDE_INTERNAL_API
00586
00590 USPOOF_UNDEFINED_RESTRICTIVE = -1
00591 #endif
00592 } URestrictionLevel;
00593
00604 U_STABLE USpoofChecker * U_EXPORT2
00605 uspoof_open(UErrorCode *status);
00606
00607
00629 U_STABLE USpoofChecker * U_EXPORT2
00630 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
00631 UErrorCode *pErrorCode);
00632
00663 U_STABLE USpoofChecker * U_EXPORT2
00664 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
00665 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
00666 int32_t *errType, UParseError *pe, UErrorCode *status);
00667
00668
00674 U_STABLE void U_EXPORT2
00675 uspoof_close(USpoofChecker *sc);
00676
00677 #if U_SHOW_CPLUSPLUS_API
00678
00679 U_NAMESPACE_BEGIN
00680
00690 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
00691
00692 U_NAMESPACE_END
00693
00694 #endif
00695
00705 U_STABLE USpoofChecker * U_EXPORT2
00706 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
00707
00708
00746 U_STABLE void U_EXPORT2
00747 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
00748
00760 U_STABLE int32_t U_EXPORT2
00761 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
00762
00774 U_STABLE void U_EXPORT2
00775 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
00776
00777
00785 U_STABLE URestrictionLevel U_EXPORT2
00786 uspoof_getRestrictionLevel(const USpoofChecker *sc);
00787
00830 U_STABLE void U_EXPORT2
00831 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
00832
00854 U_STABLE const char * U_EXPORT2
00855 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
00856
00857
00876 U_STABLE void U_EXPORT2
00877 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
00878
00879
00900 U_STABLE const USet * U_EXPORT2
00901 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
00902
00903
00904 #if U_SHOW_CPLUSPLUS_API
00905
00923 U_STABLE void U_EXPORT2
00924 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
00925
00926
00947 U_STABLE const icu::UnicodeSet * U_EXPORT2
00948 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
00949 #endif
00950
00951
00984 U_STABLE int32_t U_EXPORT2
00985 uspoof_check(const USpoofChecker *sc,
00986 const UChar *id, int32_t length,
00987 int32_t *position,
00988 UErrorCode *status);
00989
00990
01023 U_STABLE int32_t U_EXPORT2
01024 uspoof_checkUTF8(const USpoofChecker *sc,
01025 const char *id, int32_t length,
01026 int32_t *position,
01027 UErrorCode *status);
01028
01029
01030 #if U_SHOW_CPLUSPLUS_API
01031
01059 U_STABLE int32_t U_EXPORT2
01060 uspoof_checkUnicodeString(const USpoofChecker *sc,
01061 const icu::UnicodeString &id,
01062 int32_t *position,
01063 UErrorCode *status);
01064 #endif
01065
01066
01095 U_STABLE int32_t U_EXPORT2
01096 uspoof_check2(const USpoofChecker *sc,
01097 const UChar* id, int32_t length,
01098 USpoofCheckResult* checkResult,
01099 UErrorCode *status);
01100
01132 U_STABLE int32_t U_EXPORT2
01133 uspoof_check2UTF8(const USpoofChecker *sc,
01134 const char *id, int32_t length,
01135 USpoofCheckResult* checkResult,
01136 UErrorCode *status);
01137
01138 #if U_SHOW_CPLUSPLUS_API
01139
01164 U_STABLE int32_t U_EXPORT2
01165 uspoof_check2UnicodeString(const USpoofChecker *sc,
01166 const icu::UnicodeString &id,
01167 USpoofCheckResult* checkResult,
01168 UErrorCode *status);
01169 #endif
01170
01189 U_STABLE USpoofCheckResult* U_EXPORT2
01190 uspoof_openCheckResult(UErrorCode *status);
01191
01199 U_STABLE void U_EXPORT2
01200 uspoof_closeCheckResult(USpoofCheckResult *checkResult);
01201
01202 #if U_SHOW_CPLUSPLUS_API
01203
01204 U_NAMESPACE_BEGIN
01205
01221 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult);
01224 U_NAMESPACE_END
01225
01226 #endif
01227
01242 U_STABLE int32_t U_EXPORT2
01243 uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status);
01244
01255 U_STABLE URestrictionLevel U_EXPORT2
01256 uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status);
01257
01269 U_STABLE const USet* U_EXPORT2
01270 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status);
01271
01272
01316 U_STABLE int32_t U_EXPORT2
01317 uspoof_areConfusable(const USpoofChecker *sc,
01318 const UChar *id1, int32_t length1,
01319 const UChar *id2, int32_t length2,
01320 UErrorCode *status);
01321
01322
01323
01349 U_STABLE int32_t U_EXPORT2
01350 uspoof_areConfusableUTF8(const USpoofChecker *sc,
01351 const char *id1, int32_t length1,
01352 const char *id2, int32_t length2,
01353 UErrorCode *status);
01354
01355
01356
01357
01358 #if U_SHOW_CPLUSPLUS_API
01359
01380 U_STABLE int32_t U_EXPORT2
01381 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
01382 const icu::UnicodeString &s1,
01383 const icu::UnicodeString &s2,
01384 UErrorCode *status);
01385 #endif
01386
01387
01419 U_STABLE int32_t U_EXPORT2
01420 uspoof_getSkeleton(const USpoofChecker *sc,
01421 uint32_t type,
01422 const UChar *id, int32_t length,
01423 UChar *dest, int32_t destCapacity,
01424 UErrorCode *status);
01425
01459 U_STABLE int32_t U_EXPORT2
01460 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
01461 uint32_t type,
01462 const char *id, int32_t length,
01463 char *dest, int32_t destCapacity,
01464 UErrorCode *status);
01465
01466 #if U_SHOW_CPLUSPLUS_API
01467
01490 U_I18N_API icu::UnicodeString & U_EXPORT2
01491 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
01492 uint32_t type,
01493 const icu::UnicodeString &id,
01494 icu::UnicodeString &dest,
01495 UErrorCode *status);
01496 #endif
01497
01510 U_STABLE const USet * U_EXPORT2
01511 uspoof_getInclusionSet(UErrorCode *status);
01512
01525 U_STABLE const USet * U_EXPORT2
01526 uspoof_getRecommendedSet(UErrorCode *status);
01527
01528 #if U_SHOW_CPLUSPLUS_API
01529
01542 U_STABLE const icu::UnicodeSet * U_EXPORT2
01543 uspoof_getInclusionUnicodeSet(UErrorCode *status);
01544
01557 U_STABLE const icu::UnicodeSet * U_EXPORT2
01558 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
01559
01560 #endif
01561
01584 U_STABLE int32_t U_EXPORT2
01585 uspoof_serialize(USpoofChecker *sc,
01586 void *data, int32_t capacity,
01587 UErrorCode *status);
01588
01589
01590 #endif
01591
01592 #endif