Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: source/i18n/unicode/uspoof.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/unicode/usearch.h ('k') | source/i18n/unicode/utrans.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 *************************************************************************** 2 ***************************************************************************
3 * Copyright (C) 2008-2013, International Business Machines Corporation 3 * Copyright (C) 2008-2014, International Business Machines Corporation
4 * and others. All Rights Reserved. 4 * and others. All Rights Reserved.
5 *************************************************************************** 5 ***************************************************************************
6 * file name: uspoof.h 6 * file name: uspoof.h
7 * encoding: US-ASCII 7 * encoding: US-ASCII
8 * tab size: 8 (not used) 8 * tab size: 8 (not used)
9 * indentation:4 9 * indentation:4
10 * 10 *
11 * created on: 2008Feb13 11 * created on: 2008Feb13
12 * created by: Andy Heninger 12 * created by: Andy Heninger
13 * 13 *
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 * for conformance to any particular syntax for identifiers. 219 * for conformance to any particular syntax for identifiers.
220 */ 220 */
221 USPOOF_INVISIBLE = 32, 221 USPOOF_INVISIBLE = 32,
222 222
223 /** Check that an identifier contains only characters from a specified set 223 /** Check that an identifier contains only characters from a specified set
224 * of acceptable characters. See uspoof_setAllowedChars() and 224 * of acceptable characters. See uspoof_setAllowedChars() and
225 * uspoof_setAllowedLocales(). 225 * uspoof_setAllowedLocales().
226 */ 226 */
227 USPOOF_CHAR_LIMIT = 64, 227 USPOOF_CHAR_LIMIT = 64,
228 228
229 #ifndef U_HIDE_DRAFT_API
230 /** 229 /**
231 * Check that an identifier does not include decimal digits from 230 * Check that an identifier does not include decimal digits from
232 * more than one numbering system. 231 * more than one numbering system.
233 * 232 *
234 * @draft ICU 51 233 * @stable ICU 51
235 */ 234 */
236 USPOOF_MIXED_NUMBERS = 128, 235 USPOOF_MIXED_NUMBERS = 128,
237 #endif /* U_HIDE_DRAFT_API */
238 236
239 /** 237 /**
240 * Enable all spoof checks. 238 * Enable all spoof checks.
241 * 239 *
242 * @stable ICU 4.6 240 * @stable ICU 4.6
243 */ 241 */
244 USPOOF_ALL_CHECKS = 0xFFFF, 242 USPOOF_ALL_CHECKS = 0xFFFF,
245 243
246 #ifndef U_HIDE_DRAFT_API
247 /** 244 /**
248 * Enable the return of auxillary (non-error) information in the 245 * Enable the return of auxillary (non-error) information in the
249 * upper bits of the check results value. 246 * upper bits of the check results value.
250 * 247 *
251 * If this "check" is not enabled, the results of uspoof_check() will be ze ro when an 248 * If this "check" is not enabled, the results of uspoof_check() will be ze ro when an
252 * identifier passes all of the enabled checks. 249 * identifier passes all of the enabled checks.
253 * 250 *
254 * If this "check" is enabled, (uspoof_check() & USPOOF_ALL_CHECKS) will be zero 251 * If this "check" is enabled, (uspoof_check() & USPOOF_ALL_CHECKS) will be zero
255 * when an identifier passes all checks. 252 * when an identifier passes all checks.
256 * 253 *
257 * @draft ICU 51 254 * @stable ICU 51
258 */ 255 */
259 USPOOF_AUX_INFO = 0x40000000 256 USPOOF_AUX_INFO = 0x40000000
260 #endif /* U_HIDE_DRAFT_API */
261 257
262 } USpoofChecks; 258 } USpoofChecks;
263 259
264 260
265 #ifndef U_HIDE_DRAFT_API
266 /** 261 /**
267 * Constants from UAX #39 for use in setRestrictionLevel(), and 262 * Constants from UAX #39 for use in setRestrictionLevel(), and
268 * for returned identifier restriction levels in check results. 263 * for returned identifier restriction levels in check results.
269 * @draft ICU 51 264 * @stable ICU 51
270 */ 265 */
271 typedef enum URestrictionLevel { 266 typedef enum URestrictionLevel {
272 /** 267 /**
273 * Only ASCII characters: U+0000..U+007F 268 * Only ASCII characters: U+0000..U+007F
274 * 269 *
275 * @draft ICU 51 270 * @stable ICU 51
276 */ 271 */
277 USPOOF_ASCII = 0x10000000, 272 USPOOF_ASCII = 0x10000000,
273 #ifndef U_HIDE_DRAFT_API
274 /**
275 * All characters in each identifier must be from a single script.
276 *
277 * @draft ICU 53
278 */
279 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
280 #endif /* U_HIDE_DRAFT_API */
278 /** 281 /**
279 * All characters in each identifier must be from a single script, or fr om the combinations: Latin + Han + 282 * All characters in each identifier must be from a single script, or fr om the combinations: Latin + Han +
280 * Hiragana + Katakana; Latin + Han + Bopomofo; or Latin + Han + Hangul. Note that this level will satisfy the 283 * Hiragana + Katakana; Latin + Han + Bopomofo; or Latin + Han + Hangul. Note that this level will satisfy the
281 * vast majority of Latin-script users; also that TR36 has ASCII instead of Latin. 284 * vast majority of Latin-script users; also that TR36 has ASCII instead of Latin.
282 * 285 *
283 * @draft ICU 51 286 * @stable ICU 51
284 */ 287 */
285 USPOOF_HIGHLY_RESTRICTIVE = 0x20000000, 288 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
286 /** 289 /**
287 * Allow Latin with other scripts except Cyrillic, Greek, Cherokee Other wise, the same as Highly Restrictive 290 * Allow Latin with other scripts except Cyrillic, Greek, Cherokee Other wise, the same as Highly Restrictive
288 * 291 *
289 * @draft ICU 51 292 * @stable ICU 51
290 */ 293 */
291 USPOOF_MODERATELY_RESTRICTIVE = 0x30000000, 294 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
292 /** 295 /**
293 * Allow arbitrary mixtures of scripts. Otherwise, the same as Moderatel y Restrictive. 296 * Allow arbitrary mixtures of scripts. Otherwise, the same as Moderatel y Restrictive.
294 * 297 *
295 * @draft ICU 51 298 * @stable ICU 51
296 */ 299 */
297 USPOOF_MINIMALLY_RESTRICTIVE = 0x40000000, 300 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
298 /** 301 /**
299 * Any valid identifiers, including characters outside of the Identifier Profile. 302 * Any valid identifiers, including characters outside of the Identifier Profile.
300 * 303 *
301 * @draft ICU 51 304 * @stable ICU 51
302 */ 305 */
303 USPOOF_UNRESTRICTIVE = 0x50000000 306 USPOOF_UNRESTRICTIVE = 0x60000000,
307 #ifndef U_HIDE_DRAFT_API
308 /**
309 * Mask for selecting the Restriction Level bits from the return value of uspoof_check().
310 *
311 * @draft ICU 53
312 */
313 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000
314 #endif /* U_HIDE_DRAFT_API */
304 } URestrictionLevel; 315 } URestrictionLevel;
305 #endif /* U_HIDE_DRAFT_API */
306 316
307 /** 317 /**
308 * Create a Unicode Spoof Checker, configured to perform all 318 * Create a Unicode Spoof Checker, configured to perform all
309 * checks except for USPOOF_LOCALE_LIMIT and USPOOF_CHAR_LIMIT. 319 * checks except for USPOOF_LOCALE_LIMIT and USPOOF_CHAR_LIMIT.
310 * Note that additional checks may be added in the future, 320 * Note that additional checks may be added in the future,
311 * resulting in the changes to the default checking behavior. 321 * resulting in the changes to the default checking behavior.
312 * 322 *
313 * @param status The error code, set if this function encounters a problem. 323 * @param status The error code, set if this function encounters a problem.
314 * @return the newly created Spoof Checker 324 * @return the newly created Spoof Checker
315 * @stable ICU 4.2 325 * @stable ICU 4.2
316 */ 326 */
317 U_STABLE USpoofChecker * U_EXPORT2 327 U_STABLE USpoofChecker * U_EXPORT2
318 uspoof_open(UErrorCode *status); 328 uspoof_open(UErrorCode *status);
319 329
320 330
321 /** 331 /**
322 * Open a Spoof checker from its serialized from, stored in 32-bit-aligned memor y. 332 * Open a Spoof checker from its serialized form, stored in 32-bit-aligned memor y.
323 * Inverse of uspoof_serialize(). 333 * Inverse of uspoof_serialize().
324 * The memory containing the serialized data must remain valid and unchanged 334 * The memory containing the serialized data must remain valid and unchanged
325 * as long as the spoof checker, or any cloned copies of the spoof checker, 335 * as long as the spoof checker, or any cloned copies of the spoof checker,
326 * are in use. Ownership of the memory remains with the caller. 336 * are in use. Ownership of the memory remains with the caller.
327 * The spoof checker (and any clones) must be closed prior to deleting the 337 * The spoof checker (and any clones) must be closed prior to deleting the
328 * serialized data. 338 * serialized data.
329 * 339 *
330 * @param data a pointer to 32-bit-aligned memory containing the serialized form of spoof data 340 * @param data a pointer to 32-bit-aligned memory containing the serialized form of spoof data
331 * @param length the number of bytes available at data; 341 * @param length the number of bytes available at data;
332 * can be more than necessary 342 * can be more than necessary
333 * @param pActualLength receives the actual number of bytes at data taken up by the data; 343 * @param pActualLength receives the actual number of bytes at data taken up by the data;
334 * can be NULL 344 * can be NULL
335 * @param pErrorCode ICU error code 345 * @param pErrorCode ICU error code
336 * @return the spoof checker. 346 * @return the spoof checker.
337 * 347 *
338 * @see uspoof_open 348 * @see uspoof_open
339 * @see uspoof_serialize 349 * @see uspoof_serialize
340 * @stable ICU 4.2 350 * @stable ICU 4.2
341 */ 351 */
342 U_STABLE USpoofChecker * U_EXPORT2 352 U_STABLE USpoofChecker * U_EXPORT2
343 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng th, 353 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng th,
344 UErrorCode *pErrorCode); 354 UErrorCode *pErrorCode);
345 355
346 /** 356 /**
347 * Open a Spoof Checker from the source form of the spoof data. 357 * Open a Spoof Checker from the source form of the spoof data.
348 * The Three inputs correspond to the Unicode data files confusables.txt 358 * The two inputs correspond to the Unicode data files confusables.txt
349 * confusablesWholeScript.txt and xidmdifications.txt as described in 359 * and confusablesWholeScript.txt as described in Unicode UAX #39.
350 * Unicode UAX #39. The syntax of the source data is as described in UAX #39 f or 360 * The syntax of the source data is as described in UAX #39 for
351 * these files, and the content of these files is acceptable input. 361 * these files, and the content of these files is acceptable input.
352 * 362 *
353 * The character encoding of the (char *) input text is UTF-8. 363 * The character encoding of the (char *) input text is UTF-8.
354 * 364 *
355 * @param confusables a pointer to the confusable characters definitions, 365 * @param confusables a pointer to the confusable characters definitions,
356 * as found in file confusables.txt from unicode.org. 366 * as found in file confusables.txt from unicode.org.
357 * @param confusablesLen The length of the confusables text, or -1 if the 367 * @param confusablesLen The length of the confusables text, or -1 if the
358 * input string is zero terminated. 368 * input string is zero terminated.
359 * @param confusablesWholeScript 369 * @param confusablesWholeScript
360 * a pointer to the whole script confusables definitions, 370 * a pointer to the whole script confusables definitions,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 * @param status The error code, set if this function encounters a problem. 452 * @param status The error code, set if this function encounters a problem.
443 * @return The set of checks that this spoof checker will perform. 453 * @return The set of checks that this spoof checker will perform.
444 * The value is a bit set, obtained by OR-ing together 454 * The value is a bit set, obtained by OR-ing together
445 * values from enum USpoofChecks. 455 * values from enum USpoofChecks.
446 * @stable ICU 4.2 456 * @stable ICU 4.2
447 * 457 *
448 */ 458 */
449 U_STABLE int32_t U_EXPORT2 459 U_STABLE int32_t U_EXPORT2
450 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status); 460 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
451 461
452 #ifndef U_HIDE_DRAFT_API
453 /** 462 /**
454 * Set the loosest restriction level allowed. The default if this function 463 * Set the loosest restriction level allowed. The default if this function
455 * is not called is HIGHLY_RESTRICTIVE. 464 * is not called is HIGHLY_RESTRICTIVE.
456 * Calling this function also enables the RESTRICTION_LEVEL check. 465 * Calling this function also enables the RESTRICTION_LEVEL check.
457 * @param restrictionLevel The loosest restriction level allowed. 466 * @param restrictionLevel The loosest restriction level allowed.
458 * @see URestrictionLevel 467 * @see URestrictionLevel
459 * @draft ICU 51 468 * @stable ICU 51
460 */ 469 */
461 U_DRAFT void U_EXPORT2 470 U_STABLE void U_EXPORT2
462 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel ); 471 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel );
463 472
464 473
465 /** 474 /**
466 * Get the Restriction Level that will be tested if the checks include RESTRICT ION_LEVEL. 475 * Get the Restriction Level that will be tested if the checks include RESTRICT ION_LEVEL.
467 * 476 *
468 * @return The restriction level 477 * @return The restriction level
469 * @see URestrictionLevel 478 * @see URestrictionLevel
470 * @draft ICU 51 479 * @stable ICU 51
471 */ 480 */
472 U_DRAFT URestrictionLevel U_EXPORT2 481 U_STABLE URestrictionLevel U_EXPORT2
473 uspoof_getRestrictionLevel(const USpoofChecker *sc); 482 uspoof_getRestrictionLevel(const USpoofChecker *sc);
474 #endif /* U_HIDE_DRAFT_API */
475 483
476 /** 484 /**
477 * Limit characters that are acceptable in identifiers being checked to those 485 * Limit characters that are acceptable in identifiers being checked to those
478 * normally used with the languages associated with the specified locales. 486 * normally used with the languages associated with the specified locales.
479 * Any previously specified list of locales is replaced by the new settings. 487 * Any previously specified list of locales is replaced by the new settings.
480 * 488 *
481 * A set of languages is determined from the locale(s), and 489 * A set of languages is determined from the locale(s), and
482 * from those a set of acceptable Unicode scripts is determined. 490 * from those a set of acceptable Unicode scripts is determined.
483 * Characters from this set of scripts, along with characters from 491 * Characters from this set of scripts, along with characters from
484 * the "common" and "inherited" Unicode Script categories 492 * the "common" and "inherited" Unicode Script categories
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 * @stable ICU 4.2 964 * @stable ICU 4.2
957 */ 965 */
958 U_I18N_API icu::UnicodeString & U_EXPORT2 966 U_I18N_API icu::UnicodeString & U_EXPORT2
959 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, 967 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
960 uint32_t type, 968 uint32_t type,
961 const icu::UnicodeString &id, 969 const icu::UnicodeString &id,
962 icu::UnicodeString &dest, 970 icu::UnicodeString &dest,
963 UErrorCode *status); 971 UErrorCode *status);
964 #endif /* U_SHOW_CPLUSPLUS_API */ 972 #endif /* U_SHOW_CPLUSPLUS_API */
965 973
966
967 #ifndef U_HIDE_DRAFT_API
968 /** 974 /**
969 * Get the set of Candidate Characters for Inclusion in Identifiers, as defined 975 * Get the set of Candidate Characters for Inclusion in Identifiers, as defined
970 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Cha racters_for_Inclusion_in_Identifiers 976 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Cha racters_for_Inclusion_in_Identifiers
971 * 977 *
972 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not 978 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not
973 * be deleted by the caller. 979 * be deleted by the caller.
974 * 980 *
975 * @param status The error code, set if a problem occurs while creating the set . 981 * @param status The error code, set if a problem occurs while creating the set .
976 * 982 *
977 * @draft ICU 51 983 * @stable ICU 51
978 */ 984 */
979 U_DRAFT const USet * U_EXPORT2 985 U_STABLE const USet * U_EXPORT2
980 uspoof_getInclusionSet(UErrorCode *status); 986 uspoof_getInclusionSet(UErrorCode *status);
981 987
982 /** 988 /**
983 * Get the set of characters from Recommended Scripts for Inclusion in Identifi ers, as defined 989 * Get the set of characters from Recommended Scripts for Inclusion in Identifi ers, as defined
984 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_S cripts 990 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_S cripts
985 * 991 *
986 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not 992 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not
987 * be deleted by the caller. 993 * be deleted by the caller.
988 * 994 *
989 * @param status The error code, set if a problem occurs while creating the set . 995 * @param status The error code, set if a problem occurs while creating the set .
990 * 996 *
991 * @draft ICU 51 997 * @stable ICU 51
992 */ 998 */
993 U_DRAFT const USet * U_EXPORT2 999 U_STABLE const USet * U_EXPORT2
994 uspoof_getRecommendedSet(UErrorCode *status); 1000 uspoof_getRecommendedSet(UErrorCode *status);
995 1001
996 #if U_SHOW_CPLUSPLUS_API 1002 #if U_SHOW_CPLUSPLUS_API
997 1003
998 /** 1004 /**
999 * Get the set of Candidate Characters for Inclusion in Identifiers, as defined 1005 * Get the set of Candidate Characters for Inclusion in Identifiers, as defined
1000 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Cha racters_for_Inclusion_in_Identifiers 1006 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Cha racters_for_Inclusion_in_Identifiers
1001 * 1007 *
1002 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not 1008 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not
1003 * be deleted by the caller. 1009 * be deleted by the caller.
1004 * 1010 *
1005 * @param status The error code, set if a problem occurs while creating the set . 1011 * @param status The error code, set if a problem occurs while creating the set .
1006 * 1012 *
1007 * @draft ICU 51 1013 * @stable ICU 51
1008 */ 1014 */
1009 U_DRAFT const icu::UnicodeSet * U_EXPORT2 1015 U_STABLE const icu::UnicodeSet * U_EXPORT2
1010 uspoof_getInclusionUnicodeSet(UErrorCode *status); 1016 uspoof_getInclusionUnicodeSet(UErrorCode *status);
1011 1017
1012 /** 1018 /**
1013 * Get the set of characters from Recommended Scripts for Inclusion in Identifi ers, as defined 1019 * Get the set of characters from Recommended Scripts for Inclusion in Identifi ers, as defined
1014 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_S cripts 1020 * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_S cripts
1015 * 1021 *
1016 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not 1022 * The returned set is frozen. Ownership of the set remains with the ICU librar y; it must not
1017 * be deleted by the caller. 1023 * be deleted by the caller.
1018 * 1024 *
1019 * @param status The error code, set if a problem occurs while creating the set . 1025 * @param status The error code, set if a problem occurs while creating the set .
1020 * 1026 *
1021 * @draft ICU 51 1027 * @stable ICU 51
1022 */ 1028 */
1023 U_DRAFT const icu::UnicodeSet * U_EXPORT2 1029 U_STABLE const icu::UnicodeSet * U_EXPORT2
1024 uspoof_getRecommendedUnicodeSet(UErrorCode *status); 1030 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
1025 1031
1026 #endif /* U_SHOW_CPLUSPLUS_API */ 1032 #endif /* U_SHOW_CPLUSPLUS_API */
1027 #endif /* U_HIDE_DRAFT_API */
1028 1033
1029 /** 1034 /**
1030 * Serialize the data for a spoof detector into a chunk of memory. 1035 * Serialize the data for a spoof detector into a chunk of memory.
1031 * The flattened spoof detection tables can later be used to efficiently 1036 * The flattened spoof detection tables can later be used to efficiently
1032 * instantiate a new Spoof Detector. 1037 * instantiate a new Spoof Detector.
1033 * 1038 *
1034 * The serialized spoof checker includes only the data compiled from the 1039 * The serialized spoof checker includes only the data compiled from the
1035 * Unicode data tables by uspoof_openFromSource(); it does not include 1040 * Unicode data tables by uspoof_openFromSource(); it does not include
1036 * include any other state or configuration that may have been set. 1041 * include any other state or configuration that may have been set.
1037 * 1042 *
(...skipping 12 matching lines...) Expand all
1050 */ 1055 */
1051 U_STABLE int32_t U_EXPORT2 1056 U_STABLE int32_t U_EXPORT2
1052 uspoof_serialize(USpoofChecker *sc, 1057 uspoof_serialize(USpoofChecker *sc,
1053 void *data, int32_t capacity, 1058 void *data, int32_t capacity,
1054 UErrorCode *status); 1059 UErrorCode *status);
1055 1060
1056 1061
1057 #endif 1062 #endif
1058 1063
1059 #endif /* USPOOF_H */ 1064 #endif /* USPOOF_H */
OLDNEW
« no previous file with comments | « source/i18n/unicode/usearch.h ('k') | source/i18n/unicode/utrans.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698