00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00022 #ifndef USPOOF_H
00023 #define USPOOF_H
00024
00025 #include "unicode/utypes.h"
00026 #include "unicode/uset.h"
00027 #include "unicode/parseerr.h"
00028
00029
00030 #if !UCONFIG_NO_NORMALIZATION
00031
00032
00033 #ifdef XP_CPLUSPLUS
00034 #include "unicode/unistr.h"
00035 #include "unicode/uniset.h"
00036
00037 U_NAMESPACE_USE
00038 #endif
00039
00040
00138 struct USpoofChecker;
00139 typedef struct USpoofChecker USpoofChecker;
00148 typedef enum USpoofChecks {
00154 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
00155
00164 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
00165
00175 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
00176
00183 USPOOF_ANY_CASE = 8,
00184
00189 USPOOF_SINGLE_SCRIPT = 16,
00190
00197 USPOOF_INVISIBLE = 32,
00198
00203 USPOOF_CHAR_LIMIT = 64,
00204
00205 USPOOF_ALL_CHECKS = 0x7f
00206 } USpoofChecks;
00207
00208
00219 U_DRAFT USpoofChecker * U_EXPORT2
00220 uspoof_open(UErrorCode *status);
00221
00222
00244 U_CAPI USpoofChecker * U_EXPORT2
00245 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
00246 UErrorCode *pErrorCode);
00247
00279 U_CAPI USpoofChecker * U_EXPORT2
00280 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
00281 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
00282 int32_t *errType, UParseError *pe, UErrorCode *status);
00283
00284
00290 U_DRAFT void U_EXPORT2
00291 uspoof_close(USpoofChecker *sc);
00292
00302 U_DRAFT USpoofChecker * U_EXPORT2
00303 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
00304
00305
00318 U_DRAFT void U_EXPORT2
00319 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
00320
00332 U_DRAFT int32_t U_EXPORT2
00333 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
00334
00377 U_DRAFT void U_EXPORT2
00378 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
00379
00401 U_DRAFT const char * U_EXPORT2
00402 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
00403
00404
00423 U_DRAFT void U_EXPORT2
00424 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
00425
00426
00447 U_DRAFT const USet * U_EXPORT2
00448 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
00449
00450
00451 #ifdef XP_CPLUSPLUS
00452
00470 U_DRAFT void U_EXPORT2
00471 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status);
00472
00473
00494 U_DRAFT const UnicodeSet * U_EXPORT2
00495 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
00496 #endif
00497
00498
00527 U_DRAFT int32_t U_EXPORT2
00528 uspoof_check(const USpoofChecker *sc,
00529 const UChar *text, int32_t length,
00530 int32_t *position,
00531 UErrorCode *status);
00532
00533
00562 U_DRAFT int32_t U_EXPORT2
00563 uspoof_checkUTF8(const USpoofChecker *sc,
00564 const char *text, int32_t length,
00565 int32_t *position,
00566 UErrorCode *status);
00567
00568
00569 #ifdef XP_CPLUSPLUS
00570
00595 U_DRAFT int32_t U_EXPORT2
00596 uspoof_checkUnicodeString(const USpoofChecker *sc,
00597 const U_NAMESPACE_QUALIFIER UnicodeString &text,
00598 int32_t *position,
00599 UErrorCode *status);
00600
00601 #endif
00602
00603
00643 U_DRAFT int32_t U_EXPORT2
00644 uspoof_areConfusable(const USpoofChecker *sc,
00645 const UChar *s1, int32_t length1,
00646 const UChar *s2, int32_t length2,
00647 UErrorCode *status);
00648
00649
00650
00676 U_DRAFT int32_t U_EXPORT2
00677 uspoof_areConfusableUTF8(const USpoofChecker *sc,
00678 const char *s1, int32_t length1,
00679 const char *s2, int32_t length2,
00680 UErrorCode *status);
00681
00682
00683
00684
00685 #ifdef XP_CPLUSPLUS
00686
00707 U_DRAFT int32_t U_EXPORT2
00708 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
00709 const U_NAMESPACE_QUALIFIER UnicodeString &s1,
00710 const U_NAMESPACE_QUALIFIER UnicodeString &s2,
00711 UErrorCode *status);
00712 #endif
00713
00714
00747 U_DRAFT int32_t U_EXPORT2
00748 uspoof_getSkeleton(const USpoofChecker *sc,
00749 uint32_t type,
00750 const UChar *s, int32_t length,
00751 UChar *dest, int32_t destCapacity,
00752 UErrorCode *status);
00753
00789 U_DRAFT int32_t U_EXPORT2
00790 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
00791 uint32_t type,
00792 const char *s, int32_t length,
00793 char *dest, int32_t destCapacity,
00794 UErrorCode *status);
00795
00796 #ifdef XP_CPLUSPLUS
00797
00825 U_DRAFT UnicodeString & U_EXPORT2
00826 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
00827 uint32_t type,
00828 const UnicodeString &s,
00829 UnicodeString &dest,
00830 UErrorCode *status);
00831 #endif
00832
00833
00852 U_CAPI int32_t U_EXPORT2
00853 uspoof_serialize(USpoofChecker *sc,
00854 void *data, int32_t capacity,
00855 UErrorCode *status);
00856
00857
00858 #endif
00859
00860 #endif