18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project******************************************************************************* 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project* Copyright (c) 1996-2005, International Business Machines Corporation and others. 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project* All Rights Reserved. 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project******************************************************************************* 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/ 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef UCOL_H 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define UCOL_H 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "unicode/utypes.h" 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if !UCONFIG_NO_COLLATION 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "unicode/unorm.h" 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "unicode/parseerr.h" 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "unicode/uloc.h" 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "unicode/uset.h" 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * \file 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * \brief C API: Collator 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <h2> Collator C API </h2> 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The C API for Collator performs locale-sensitive 278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * string comparison. You use this service to build 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * searching and sorting routines for natural language text. 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <em>Important: </em>The ICU collation service has been reimplemented 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * in order to achieve better performance and UCA compliance. 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * For details, see the 328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <a href="http://icu.sourceforge.net/cvs/icu/~checkout~/icuhtml/design/collation/ICU_collation_design.htm"> 338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation design document</a>. 348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <p> 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * For more information about the collation service see 368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <a href="http://icu.sourceforge.net/icu/userguide/Collate_Intro.html">the users guide</a>. 378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <p> 388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Collation service provides correct sorting orders for most locales supported in ICU. 398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If specific data for a locale is not available, the orders eventually falls back 408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>. 418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <p> 428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Sort ordering may be customized by providing your own set of rules. For more on 438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * this subject see the 448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <a href="http://icu.sourceforge.net/icu/userguide/Collate_Customization.html"> 458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Collation customization</a> section of the users guide. 468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <p> 478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UCollationResult 488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UNormalizationMode 498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UCollationStrength 508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UCollationElements 518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** A collation element iterator. 548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project* For usage in C programs. 558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/ 568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectstruct collIterate; 578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** structure representing collation element iterator instance 588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct collIterate collIterate; 618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** A collator. 638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project* For usage in C programs. 648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project*/ 658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectstruct UCollator; 668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** structure representing a collator object instance 678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct UCollator UCollator; 708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_LESS is returned if source string is compared to be less than target 748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * string in the u_strcoll() method. 758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_EQUAL is returned if source string is compared to be equal to target 768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * string in the u_strcoll() method. 778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_GREATER is returned if source string is compared to be greater than 788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * target string in the u_strcoll() method. 798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see u_strcoll() 808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * <p> 818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Possible values for a comparison result 828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum { 858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** string a == string b */ 868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_EQUAL = 0, 878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** string a > string b */ 888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_GREATER = 1, 898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** string a < string b */ 908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_LESS = -1 918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} UCollationResult ; 928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Enum containing attribute values for controling collation behavior. 958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Here are all the allowable values. Not every attribute can take every value. The only 968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined 978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * value for that locale 988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 1008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum { 1018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** accepted by most attributes */ 1028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_DEFAULT = -1, 1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Primary collation strength */ 1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_PRIMARY = 0, 1068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Secondary collation strength */ 1078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_SECONDARY = 1, 1088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Tertiary collation strength */ 1098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_TERTIARY = 2, 1108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Default collation strength */ 1118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY, 1128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_CE_STRENGTH_LIMIT, 1138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Quaternary collation strength */ 1148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_QUATERNARY=3, 1158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Identical collation strength */ 1168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_IDENTICAL=15, 1178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_STRENGTH_LIMIT, 1188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Turn the feature off - works for UCOL_FRENCH_COLLATION, 1208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE 1218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project & UCOL_DECOMPOSITION_MODE*/ 1228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_OFF = 16, 1238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Turn the feature on - works for UCOL_FRENCH_COLLATION, 1248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE 1258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project & UCOL_DECOMPOSITION_MODE*/ 1268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_ON = 17, 1278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */ 1298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_SHIFTED = 20, 1308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */ 1318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_NON_IGNORABLE = 21, 1328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Valid for UCOL_CASE_FIRST - 1348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project lower case sorts before upper case */ 1358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_LOWER_FIRST = 24, 1368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** upper case sorts before lower case */ 1378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_UPPER_FIRST = 25, 1388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_ATTRIBUTE_VALUE_COUNT 1408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} UColAttributeValue; 1428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 1448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Base letter represents a primary difference. Set comparison 1458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * level to UCOL_PRIMARY to ignore secondary and tertiary differences. 1468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Use this to set the strength of a Collator object. 1478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Example of primary difference, "abc" < "abd" 1488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Diacritical differences on the same base letter represent a secondary 1508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * difference. Set comparison level to UCOL_SECONDARY to ignore tertiary 1518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * differences. Use this to set the strength of a Collator object. 1528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Example of secondary difference, "�" >> "a". 1538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Uppercase and lowercase versions of the same character represents a 1558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * tertiary difference. Set comparison level to UCOL_TERTIARY to include 1568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * all comparison differences. Use this to set the strength of a Collator 1578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * object. 1588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Example of tertiary difference, "abc" <<< "ABC". 1598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Two characters are considered "identical" when they have the same 1618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * unicode spellings. UCOL_IDENTICAL. 1628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * For example, "�" == "�". 1638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCollationStrength is also used to determine the strength of sort keys 1658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * generated from UCollator objects 1668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * These values can be now found in the UColAttributeValue enum. 1678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 1688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project **/ 1698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef UColAttributeValue UCollationStrength; 1708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT 1728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * value, as well as the values specific to each one. 1738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 1748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 1758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum { 1768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Attribute for direction of secondary weights - used in French.\ 1778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Acceptable values are UCOL_ON, which results in secondary weights 1788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * being considered backwards and UCOL_OFF which treats secondary 1798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * weights in the order they appear.*/ 1808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_FRENCH_COLLATION, 1818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Attribute for handling variable elements.\ 1828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Acceptable values are UCOL_NON_IGNORABLE (default) 1838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * which treats all the codepoints with non-ignorable 1848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * primary weights in the same way, 1858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * and UCOL_SHIFTED which causes codepoints with primary 1868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * weights that are equal or below the variable top value 1878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to be ignored on primary level and moved to the quaternary 1888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * level.*/ 1898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_ALTERNATE_HANDLING, 1908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Controls the ordering of upper and lower case letters.\ 1918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Acceptable values are UCOL_OFF (default), which orders 1928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * upper and lower case letters in accordance to their tertiary 1938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * weights, UCOL_UPPER_FIRST which forces upper case letters to 1948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * sort before lower case letters, and UCOL_LOWER_FIRST which does 1958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the opposite. */ 1968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_CASE_FIRST, 1978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Controls whether an extra case level (positioned before the third 1988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * level) is generated or not.\ Acceptable values are UCOL_OFF (default), 1998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * when case level is not generated, and UCOL_ON which causes the case 2008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * level to be generated.\ Contents of the case level are affected by 2018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the value of UCOL_CASE_FIRST attribute.\ A simple way to ignore 2028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * accent differences in a string is to set the strength to UCOL_PRIMARY 2038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * and enable case level. */ 2048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_CASE_LEVEL, 2058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Controls whether the normalization check and necessary normalizations 2068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are performed.\ When set to UCOL_OFF (default) no normalization check 2078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is performed.\ The correctness of the result is guaranteed only if the 2088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * input data is in so-called FCD form (see users manual for more info).\ 2098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * When set to UCOL_ON, an incremental check is performed to see whether the input data 2108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is in the FCD form.\ If the data is not in the FCD form, incremental 2118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NFD normalization is performed. */ 2128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_NORMALIZATION_MODE, 2138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** An alias for UCOL_NORMALIZATION_MODE attribute */ 2148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE, 2158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** The strength attribute.\ Can be either UCOL_PRIMARY, UCOL_SECONDARY, 2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL.\ The usual strength 2178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * for most locales (except Japanese) is tertiary.\ Quaternary strength 2188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is useful when combined with shifted setting for alternate handling 2198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * attribute and for JIS x 4061 collation, when it is used to distinguish 2208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * between Katakana and Hiragana (this is achieved by setting the 2218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_HIRAGANA_QUATERNARY mode to on.\ Otherwise, quaternary level 2228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is affected only by the number of non ignorable code points in 2238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the string.\ Identical strength is rarely useful, as it amounts 2248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to codepoints of the NFD form of the string. */ 2258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_STRENGTH, 2268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** when turned on, this attribute 2278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * positions Hiragana before all 2288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * non-ignorables on quaternary level 2298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This is a sneaky way to produce JIS 2308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * sort order */ 2318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_HIRAGANA_QUATERNARY_MODE, 2328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** when turned on, this attribute 2338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * generates a collation key 2348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * for the numeric value of substrings 2358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * of digits. This is a way to get '100' 2368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to sort AFTER '2'.*/ 2378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_NUMERIC_COLLATION, 2388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_ATTRIBUTE_COUNT 2398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} UColAttribute; 2408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Options for retrieving the rule string 2428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 2438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 2448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum { 2458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Retrieve tailoring only */ 2468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_TAILORING_ONLY, 2478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** Retrieve UCA rules and tailoring */ 2488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_FULL_RULES 2498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} UColRuleOption ; 2508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 2528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Open a UCollator for comparing strings. 2538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The UCollator pointer is used in all the calls to the Collation 2548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * service. After finished, collator must be disposed of by calling 2558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * {@link #ucol_close }. 2568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param loc The locale containing the required collation rules. 2578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Special values for locales can be passed in - 2588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * if NULL is passed for the locale, the default locale 2598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation rules will be used. If empty string ("") or 2608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * "root" are passed, UCA rules will be used. 2618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status A pointer to an UErrorCode to receive any errors 2628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return A pointer to a UCollator, or 0 if an error occurred. 2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openRules 2648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_safeClone 2658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_close 2668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 2678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 2688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollator* U_EXPORT2 2698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_open(const char *loc, UErrorCode *status); 2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 2728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Produce an UCollator instance according to the rules supplied. 2738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The rules are used to change the default ordering, defined in the 2748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCA in a process called tailoring. The resulting UCollator pointer 2758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * can be used in the same way as the one obtained by {@link #ucol_strcoll }. 2768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param rules A string describing the collation rules. For the syntax 2778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * of the rules please see users guide. 2788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param rulesLength The length of rules, or -1 if null-terminated. 2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param normalizationMode The normalization mode: One of 2808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_OFF (expect the text to not need normalization), 2818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_ON (normalize), or 2828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_DEFAULT (set the mode according to the rules) 2838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY, 2848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules. 2858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param parseError A pointer to UParseError to recieve information about errors 2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * occurred during parsing. This argument can currently be set 2878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to NULL, but at users own risk. Please provide a real structure. 2888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status A pointer to an UErrorCode to receive any errors 2898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return A pointer to a UCollator.\ It is not guaranteed that NULL be returned in case 2908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * of error - please use status argument to check for errors. 2918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_open 2928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_safeClone 2938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_close 2948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollator* U_EXPORT2 2978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_openRules( const UChar *rules, 2988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t rulesLength, 2998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UColAttributeValue normalizationMode, 3008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCollationStrength strength, 3018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UParseError *parseError, 3028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 3038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Open a collator defined by a short form string. 3068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The structure and the syntax of the string is defined in the "Naming collators" 3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * section of the users guide: 3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * http://icu.sourceforge.net/icu/userguide/Collate_Concepts.html#Naming_Collators 3098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final 3108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * strength will be 3. 3066bis locale overrides individual locale parts. 3118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The call to this function is equivalent to a call to ucol_open, followed by a 3128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * series of calls to ucol_setAttribute and ucol_setVariableTop. 3138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param definition A short string containing a locale and a set of attributes. 3148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Attributes not explicitly mentioned are left at the default 3158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * state for a locale. 3168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param parseError if not NULL, structure that will get filled with error's pre 3178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * and post context in case of error. 3188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param forceDefaults if FALSE, the settings that are the same as the collator 3198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * default settings will not be applied (for example, setting 3208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * French secondary on a French collator would not be executed). 3218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If TRUE, all the settings will be applied regardless of the 3228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collator default value. If the definition 3238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * strings are to be cached, should be set to FALSE. 3248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status Error code. Apart from regular error conditions connected to 3258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * instantiating collators (like out of memory or similar), this 3268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * API will return an error if an invalid attribute or attribute/value 3278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * combination is specified. 3288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return A pointer to a UCollator or 0 if an error occured (including an 3298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * invalid attribute). 3308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_open 3318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setAttribute 3328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setVariableTop 3338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getShortDefinitionString 3348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_normalizeShortDefinitionString 3358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 3368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 3378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 3388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_CAPI UCollator* U_EXPORT2 3398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_openFromShortString( const char *definition, 3408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool forceDefaults, 3418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UParseError *parseError, 3428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 3438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 3458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get a set containing the contractions defined by the collator. The set includes 3468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * both the UCA contractions and the contractions defined by the collator. This set 3478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * will contain only strings. If a tailoring explicitly suppresses contractions from 3488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the UCA (like Russian), removed contractions will not be in the resulting set. 3498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator 3508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param conts the set to hold the result. It gets emptied before 3518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * contractions are added. 3528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status to hold the error code 3538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return the size of the contraction set 3548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 3558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 3568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 3578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_CAPI int32_t U_EXPORT2 3588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getContractions( const UCollator *coll, 3598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project USet *conts, 3608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 3618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 3648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Close a UCollator. 3658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Once closed, a UCollator should not be used.\ Every open collator should 3668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * be closed.\ Otherwise, a memory leak will result. 3678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to close. 3688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_open 3698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openRules 3708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_safeClone 3718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 3728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 3738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE void U_EXPORT2 3748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_close(UCollator *coll); 3758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 3778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Compare two strings. 3788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The strings will be compared using the options already specified. 3798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the comparison rules. 3808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The source string. 3818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 3828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param target The target string. 3838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param targetLength The length of target, or -1 if null-terminated. 3848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The result of comparing the strings; one of UCOL_EQUAL, 3858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_GREATER, UCOL_LESS 3868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greater 3878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greaterOrEqual 3888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_equal 3898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 3908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 3918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollationResult U_EXPORT2 3928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_strcoll( const UCollator *coll, 3938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *source, 3948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t sourceLength, 3958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *target, 3968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t targetLength); 3978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 3998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Determine if one string is greater than another. 4008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER 4018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the comparison rules. 4028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The source string. 4038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 4048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param target The target string. 4058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param targetLength The length of target, or -1 if null-terminated. 4068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return TRUE if source is greater than target, FALSE otherwise. 4078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_strcoll 4088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greaterOrEqual 4098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_equal 4108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 4118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UBool U_EXPORT2 4138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_greater(const UCollator *coll, 4148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *source, int32_t sourceLength, 4158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *target, int32_t targetLength); 4168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Determine if one string is greater than or equal to another. 4198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS 4208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the comparison rules. 4218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The source string. 4228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 4238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param target The target string. 4248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param targetLength The length of target, or -1 if null-terminated. 4258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return TRUE if source is greater than or equal to target, FALSE otherwise. 4268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_strcoll 4278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greater 4288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_equal 4298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 4308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UBool U_EXPORT2 4328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_greaterOrEqual(const UCollator *coll, 4338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *source, int32_t sourceLength, 4348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *target, int32_t targetLength); 4358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Compare two strings for equality. 4388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL 4398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the comparison rules. 4408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The source string. 4418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 4428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param target The target string. 4438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param targetLength The length of target, or -1 if null-terminated. 4448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return TRUE if source is equal to target, FALSE otherwise 4458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_strcoll 4468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greater 4478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_greaterOrEqual 4488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 4498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UBool U_EXPORT2 4518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_equal(const UCollator *coll, 4528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *source, int32_t sourceLength, 4538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *target, int32_t targetLength); 4548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Compare two UTF-8 encoded trings. 4578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The strings will be compared using the options already specified. 4588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the comparison rules. 4598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sIter The source string iterator. 4608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param tIter The target string iterator. 4618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The result of comparing the strings; one of UCOL_EQUAL, 4628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_GREATER, UCOL_LESS 4638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status A pointer to an UErrorCode to receive any errors 4648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_strcoll 4658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.6 4668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollationResult U_EXPORT2 4688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_strcollIter( const UCollator *coll, 4698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCharIterator *sIter, 4708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCharIterator *tIter, 4718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 4728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get the collation strength used in a UCollator. 4758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The strength influences how strings are compared. 4768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to query. 4778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY, 4788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL 4798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setStrength 4808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 4818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollationStrength U_EXPORT2 4838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getStrength(const UCollator *coll); 4848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Set the collation strength used in a UCollator. 4878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The strength influences how strings are compared. 4888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to set. 4898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param strength The desired collation strength; one of UCOL_PRIMARY, 4908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT 4918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getStrength 4928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 4938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 4948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE void U_EXPORT2 4958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_setStrength(UCollator *coll, 4968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCollationStrength strength); 4978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 4998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get the display name for a UCollator. 5008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The display name is suitable for presentation to a user. 5018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param objLoc The locale of the collator in question. 5028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param dispLoc The locale for display. 5038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param result A pointer to a buffer to receive the attribute. 5048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param resultLength The maximum size of result. 5058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status A pointer to an UErrorCode to receive any errors 5068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The total buffer size needed; if greater than resultLength, 5078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the output was truncated. 5088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 5098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 5118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getDisplayName( const char *objLoc, 5128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const char *dispLoc, 5138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UChar *result, 5148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t resultLength, 5158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 5168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get a locale for which collation rules are available. 5198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * A UCollator in a locale returned by this function will perform the correct 5208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation for the locale. 5218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param index The index of the desired locale. 5228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return A locale for which collation rules are available, or 0 if none. 5238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_countAvailable 5248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 5258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE const char* U_EXPORT2 5278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getAvailable(int32_t index); 5288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Determine how many locales have collation rules available. 5318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This function is most useful as determining the loop ending condition for 5328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * calls to {@link #ucol_getAvailable }. 5338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The number of locales for which collation rules are available. 5348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getAvailable 5358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 5368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 5388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_countAvailable(void); 5398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if !UCONFIG_NO_SERVICE 5418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Create a string enumerator of all locales for which a valid 5438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collator may be opened. 5448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status input-output error code 5458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return a string enumeration over locale strings. The caller is 5468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * responsible for closing the result. 5478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 5488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT UEnumeration* U_EXPORT2 5508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_openAvailableLocales(UErrorCode *status); 5518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif 5528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Create a string enumerator of all possible keywords that are relevant to 5558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation. At this point, the only recognized keyword for this 5568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * service is "collation". 5578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status input-output error code 5588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return a string enumeration over locale strings. The caller is 5598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * responsible for closing the result. 5608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 5618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT UEnumeration* U_EXPORT2 5638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getKeywords(UErrorCode *status); 5648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Given a keyword, create a string enumeration of all values 5678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * for that keyword that are currently in use. 5688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param keyword a particular keyword as enumerated by 5698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ucol_getKeywords. If any other keyword is passed in, *status is set 5708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to U_ILLEGAL_ARGUMENT_ERROR. 5718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status input-output error code 5728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return a string enumeration over collation keyword values, or NULL 5738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * upon error. The caller is responsible for closing the result. 5748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 5758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 5768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT UEnumeration* U_EXPORT2 5778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getKeywordValues(const char *keyword, UErrorCode *status); 5788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 5808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Return the functionally equivalent locale for the given 5818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * requested locale, with respect to given keyword, for the 5828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation service. If two locales return the same result, then 5838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collators instantiated for these locales will behave 5848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * equivalently. The converse is not always true; two collators 5858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * may in fact be equivalent, but return different results, due to 5868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * internal details. The return result has no other meaning than 5878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * that stated above, and implies nothing as to the relationship 5888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * between the two locales. This is intended for use by 5898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * applications who wish to cache collators, or otherwise reuse 5908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collators when possible. The functional equivalent may change 5918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * over time. For more information, please see the <a 5928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * href="http://icu.sourceforge.net/icu/userguide/locale.html#services"> 5938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Locales and Services</a> section of the ICU User Guide. 5948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param result fillin for the functionally equivalent locale 5958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param resultCapacity capacity of the fillin buffer 5968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param keyword a particular keyword as enumerated by 5978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ucol_getKeywords. 5988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param locale the requested locale 5998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param isAvailable if non-NULL, pointer to a fillin parameter that 6008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * indicates whether the requested locale was 'available' to the 6018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collation service. A locale is defined as 'available' if it 6028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * physically exists within the collation locale data. 6038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status pointer to input-output error code 6048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return the actual buffer size needed for the locale. If greater 6058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * than resultCapacity, the returned full name will be truncated and 6068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * an error code will be returned. 6078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 6088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 6098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT int32_t U_EXPORT2 6108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getFunctionalEquivalent(char* result, int32_t resultCapacity, 6118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const char* keyword, const char* locale, 6128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool* isAvailable, UErrorCode* status); 6138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 6158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get the collation rules from a UCollator. 6168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The rules will follow the rule syntax. 6178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to query. 6188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param length 6198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The collation rules. 6208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 6218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 6228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE const UChar* U_EXPORT2 6238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getRules( const UCollator *coll, 6248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t *length); 6258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Get the short definition string for a collator. This API harvests the collator's 6278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * locale and the attribute set and produces a string that can be used for opening 6288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * a collator with the same properties using the ucol_openFromShortString API. 6298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This string will be normalized. 6308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The structure and the syntax of the string is defined in the "Naming collators" 6318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * section of the users guide: 6328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * http://icu.sourceforge.net/icu/userguide/Collate_Concepts.html#Naming_Collators 6338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This API supports preflighting. 6348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll a collator 6358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param locale a locale that will appear as a collators locale in the resulting 6368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * short string definition. If NULL, the locale will be harvested 6378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * from the collator. 6388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param buffer space to hold the resulting string 6398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param capacity capacity of the buffer 6408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for returning errors. All the preflighting errors are featured 6418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return length of the resulting string 6428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromShortString 6438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_normalizeShortDefinitionString 6448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 6458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 6468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_CAPI int32_t U_EXPORT2 6478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getShortDefinitionString(const UCollator *coll, 6488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const char *locale, 6498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project char *buffer, 6508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t capacity, 6518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 6528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Verifies and normalizes short definition string. 6548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Normalized short definition string has all the option sorted by the argument name, 6558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * so that equivalent definition strings are the same. 6568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This API supports preflighting. 6578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source definition string 6588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param destination space to hold the resulting string 6598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param capacity capacity of the buffer 6608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param parseError if not NULL, structure that will get filled with error's pre 6618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * and post context in case of error. 6628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status Error code. This API will return an error if an invalid attribute 6638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * or attribute/value combination is specified. All the preflighting 6648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * errors are also featured 6658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return length of the resulting normalized string. 6668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 6678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromShortString 6688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getShortDefinitionString 6698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 6708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.0 6718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 6728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_CAPI int32_t U_EXPORT2 6748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_normalizeShortDefinitionString(const char *source, 6758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project char *destination, 6768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t capacity, 6778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UParseError *parseError, 6788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 6798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 6818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 6828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get a sort key for a string from a UCollator. 6838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Sort keys may be compared using <TT>strcmp</TT>. 6848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the collation rules. 6858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The string to transform. 6868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 6878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param result A pointer to a buffer to receive the attribute. 6888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param resultLength The maximum size of result. 6898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The size needed to fully store the sort key.. 6908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_keyHashCode 6918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 6928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 6938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 6948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getSortKey(const UCollator *coll, 6958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *source, 6968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t sourceLength, 6978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint8_t *result, 6988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t resultLength); 6998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 7008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 7018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Gets the next count bytes of a sort key. Caller needs 7028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to preserve state array between calls and to provide 7038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the same type of UCharIterator set with the same string. 7048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * The destination buffer provided must be big enough to store 7058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the number of requested bytes. Generated sortkey is not 7068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * compatible with sortkeys generated using ucol_getSortKey 7078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * API, since we don't do any compression. If uncompressed 7088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * sortkeys are required, this API can be used. 7098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator containing the collation rules. 7108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param iter UCharIterator containing the string we need 7118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the sort key to be calculated for. 7128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param state Opaque state of sortkey iteration. 7138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param dest Buffer to hold the resulting sortkey part 7148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param count number of sort key bytes required. 7158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code indicator. 7168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return the actual number of bytes of a sortkey. It can be 7178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * smaller than count if we have reached the end of 7188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the sort key. 7198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.6 7208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 7218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 7228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_nextSortKeyPart(const UCollator *coll, 7238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCharIterator *iter, 7248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint32_t state[2], 7258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint8_t *dest, int32_t count, 7268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 7278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 7288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** enum that is taken by ucol_getBound API 7298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * See below for explanation 7308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * do not change the values assigned to the 7318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * members of this enum. Underlying code 7328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * depends on them having these numbers 7338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 7348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 7358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef enum { 7368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** lower bound */ 7378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_BOUND_LOWER = 0, 7388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** upper bound that will match strings of exact size */ 7398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_BOUND_UPPER = 1, 7408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project /** upper bound that will match all the strings that have the same initial substring as the given string */ 7418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_BOUND_UPPER_LONG = 2, 7428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UCOL_BOUND_VALUE_COUNT 7438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} UColBoundMode; 7448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 7458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 7468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Produce a bound for a given sortkey and a number of levels. 7478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Return value is always the number of bytes needed, regardless of 7488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * whether the result buffer was big enough or even valid.<br> 7498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Resulting bounds can be used to produce a range of strings that are 7508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * between upper and lower bounds. For example, if bounds are produced 7518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * for a sortkey of string "smith", strings between upper and lower 7528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * bounds with one level would include "Smith", "SMITH", "sMiTh".<br> 7538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER 7548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is produced, strings matched would be as above. However, if bound 7558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * produced using UCOL_BOUND_UPPER_LONG is used, the above example will 7568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * also match "Smithsonian" and similar.<br> 7578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * For more on usage, see example in cintltst/capitst.c in procedure 7588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * TestBounds. 7598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Sort keys may be compared using <TT>strcmp</TT>. 7608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source The source sortkey. 7618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param sourceLength The length of source, or -1 if null-terminated. 7628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (If an unmodified sortkey is passed, it is always null 7638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * terminated). 7648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which 7658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * produces a lower inclusive bound, UCOL_BOUND_UPPER, that 7668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * produces upper bound that matches strings of the same length 7678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * or UCOL_BOUND_UPPER_LONG that matches strings that have the 7688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * same starting substring as the source string. 7698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param noOfLevels Number of levels required in the resulting bound (for most 7708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * uses, the recommended value is 1). See users guide for 7718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * explanation on number of levels a sortkey can have. 7728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param result A pointer to a buffer to receive the resulting sortkey. 7738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param resultLength The maximum size of result. 7748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status Used for returning error code if something went wrong. If the 7758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * number of levels requested is higher than the number of levels 7768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is 7778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * issued. 7788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return The size needed to fully store the bound. 7798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_keyHashCode 7808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.1 7818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 7828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 7838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getBound(const uint8_t *source, 7848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t sourceLength, 7858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UColBoundMode boundType, 7868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint32_t noOfLevels, 7878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint8_t *result, 7888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t resultLength, 7898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 7908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 7918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 7928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Gets the version information for a Collator. Version is currently 7938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * an opaque 32-bit number which depends, among other things, on major 7948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * versions of the collator tailoring and UCA. 7958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to query. 7968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param info the version # information, the result will be filled in 7978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 7988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 7998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE void U_EXPORT2 8008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getVersion(const UCollator* coll, UVersionInfo info); 8018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 8038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Gets the UCA version information for a Collator. Version is the 8048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * UCA version number (3.1.1, 4.0). 8058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator to query. 8068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param info the version # information, the result will be filled in 8078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 2.8 8088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 8098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT void U_EXPORT2 8108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getUCAVersion(const UCollator* coll, UVersionInfo info); 8118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 8138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Merge two sort keys. The levels are merged with their corresponding counterparts 8148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (primaries with primaries, secondaries with secondaries etc.). Between the values 8158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * from the same level a separator is inserted. 8168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * example (uncompressed): 8178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00 8188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * will be merged as 8198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00 8208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This allows for concatenating of first and last names for sorting, among other things. 8218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If the destination buffer is not big enough, the results are undefined. 8228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If any of source lengths are zero or any of source pointers are NULL/undefined, 8238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * result is of size zero. 8248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param src1 pointer to the first sortkey 8258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param src1Length length of the first sortkey 8268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param src2 pointer to the second sortkey 8278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param src2Length length of the second sortkey 8288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param dest buffer to hold the result 8298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param destCapacity size of the buffer for the result 8308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return size of the result. If the buffer is big enough size is always 8318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * src1Length+src2Length-1 8328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 8338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 8348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 8358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, 8368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const uint8_t *src2, int32_t src2Length, 8378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint8_t *dest, int32_t destCapacity); 8388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 8408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Universal attribute setter 8418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which attributes are to be changed 8428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param attr attribute type 8438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param value attribute value 8448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status to indicate whether the operation went on smoothly or there were errors 8458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttribute 8468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttributeValue 8478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getAttribute 8488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 8498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 8508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE void U_EXPORT2 8518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status); 8528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 8548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Universal attribute getter 8558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which attributes are to be changed 8568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param attr attribute type 8578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return attribute value 8588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status to indicate whether the operation went on smoothly or there were errors 8598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttribute 8608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttributeValue 8618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setAttribute 8628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 8638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 8648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UColAttributeValue U_EXPORT2 8658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status); 8668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Variable top 8688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is a two byte primary value which causes all the codepoints with primary values that 8698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are less or equal than the variable top to be shifted when alternate handling is set 8708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to UCOL_SHIFTED. 8718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Sets the variable top to a collation element value of a string supplied. 8728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which variable top needs to be changed 8738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param varTop one or more (if contraction) UChars to which the variable top should be set 8748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param len length of variable top string. If -1 it is considered to be zero terminated. 8758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code. If error code is set, the return value is undefined. 8768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Errors set by this function are: <br> 8778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such 8788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * a contraction<br> 8798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes 8808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return a 32 bit value containing the value of the variable top in upper 16 bits. 8818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Lower 16 bits are undefined 8828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getVariableTop 8838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_restoreVariableTop 8848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 8858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 8868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE uint32_t U_EXPORT2 8878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_setVariableTop(UCollator *coll, 8888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UChar *varTop, int32_t len, 8898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 8908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 8918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 8928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Gets the variable top value of a Collator. 8938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Lower 16 bits are undefined and should be ignored. 8948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which variable top needs to be retrieved 8958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code (not changed by function). If error code is set, 8968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the return value is undefined. 8978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return the variable top value of a Collator. 8988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setVariableTop 8998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_restoreVariableTop 9008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 9018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status); 9038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 9058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Sets the variable top to a collation element value supplied. Variable top is 9068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * set to the upper 16 bits. 9078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Lower 16 bits are ignored. 9088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which variable top needs to be changed 9098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop 9108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code (not changed by function) 9118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_getVariableTop 9128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setVariableTop 9138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 9148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE void U_EXPORT2 9168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status); 9178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 9198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Thread safe cloning operation. The result is a clone of a given collator. 9208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator to be cloned 9218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param stackBuffer user allocated space for the new clone. 9228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If NULL new memory will be allocated. 9238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If buffer is not large enough, new memory will be allocated. 9248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Clients can use the U_COL_SAFECLONE_BUFFERSIZE. 9258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This will probably be enough to avoid memory allocations. 9268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param pBufferSize pointer to size of allocated space. 9278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If *pBufferSize == 0, a sufficient size for use in cloning will 9288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * be returned ('pre-flighting') 9298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If *pBufferSize is not enough for a stack-based safe clone, 9308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * new memory will be allocated. 9318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status to indicate whether the operation went on smoothly or there were errors 9328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any 9338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * allocations were necessary. 9348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return pointer to the new clone 9358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_open 9368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openRules 9378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_close 9388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 9398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE UCollator* U_EXPORT2 9418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_safeClone(const UCollator *coll, 9428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void *stackBuffer, 9438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t *pBufferSize, 9448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 9458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** default memory size for the new clone. It needs to be this large for os/400 large pointers 9478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 9488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define U_COL_SAFECLONE_BUFFERSIZE 512 9508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 9528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Returns current rules. Delta defines whether full rules are returned or just the tailoring. 9538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough 9548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * to store rules, will store up to available space. 9558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator to get the rules from 9568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. 9578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param buffer buffer to store the result in. If NULL, you'll get no rules. 9588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in. 9598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return current rules 9608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.0 9618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE int32_t U_EXPORT2 9638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen); 9648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 9668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * gets the locale name of the collator. If the collator 9678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is instantiated from the rules, then this function returns 9688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NULL. 9698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator for which the locale is needed 9708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param type You can choose between requested, valid and actual 9718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * locale. For description see the definition of 9728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ULocDataLocaleType in uloc.h 9738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code of the operation 9748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return real locale name from which the collation data comes. 9758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If the collator was instantiated from rules, returns 9768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NULL. 9778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @deprecated ICU 2.8 Use ucol_getLocaleByType instead 9788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DEPRECATED const char * U_EXPORT2 9808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status); 9818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 9838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 9848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * gets the locale name of the collator. If the collator 9858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * is instantiated from the rules, then this function returns 9868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NULL. 9878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator for which the locale is needed 9888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param type You can choose between requested, valid and actual 9898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * locale. For description see the definition of 9908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ULocDataLocaleType in uloc.h 9918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code of the operation 9928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return real locale name from which the collation data comes. 9938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If the collator was instantiated from rules, returns 9948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * NULL. 9958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 2.8 likely to change in ICU 3.0, based on feedback 9968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 9978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT const char * U_EXPORT2 9988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status); 9998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get an Unicode set that contains all the characters and sequences tailored in 10028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * this collator. The result must be disposed of by using uset_close. 10038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll The UCollator for which we want to get tailored chars 10048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status error code of the operation 10058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return a pointer to newly created USet. Must be be disposed by using uset_close 10068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openRules 10078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see uset_close 10088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @stable ICU 2.4 10098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_STABLE USet * U_EXPORT2 10118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getTailoredSet(const UCollator *coll, UErrorCode *status); 10128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Returned by ucol_collatorToIdentifier to signify that collator is 10158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * not encodable as an identifier. 10168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 10178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000 10198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Get a 31-bit identifier given a collator. 10228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll UCollator 10238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param locale a locale that will appear as a collators locale in the resulting 10248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * short string definition. If NULL, the locale will be harvested 10258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * from the collator. 10268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status holds error messages 10278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return 31-bit identifier. MSB is used if the collator cannot be encoded. In that 10288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * case UCOL_SIT_COLLATOR_NOT_ENCODABLE is returned 10298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromIdentifier 10308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_identifierToShortString 10318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 10328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL uint32_t U_EXPORT2 10348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_collatorToIdentifier(const UCollator *coll, 10358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const char *locale, 10368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 10378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Open a collator given a 31-bit identifier 10408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier 10418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param forceDefaults if FALSE, the settings that are the same as the collator 10428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * default settings will not be applied (for example, setting 10438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * French secondary on a French collator would not be executed). 10448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If TRUE, all the settings will be applied regardless of the 10458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collator default value. If the definition 10468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * strings that can be produced from a collator instantiated by 10478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * calling this API are to be cached, should be set to FALSE. 10488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for returning errors 10498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return UCollator object 10508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_collatorToIdentifier 10518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_identifierToShortString 10528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 10538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL UCollator* U_EXPORT2 10558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_openFromIdentifier(uint32_t identifier, 10568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool forceDefaults, 10578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 10588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Calculate the short definition string given an identifier. Supports preflighting. 10628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier 10638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param buffer buffer to store the result 10648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param capacity buffer capacity 10658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param forceDefaults whether the settings that are the same as the default setting 10668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * should be forced anyway. Setting this argument to FALSE reduces 10678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the number of different configurations, but decreases performace 10688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * as a collator has to be instantiated. 10698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for returning errors 10708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return length of the short definition string 10718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_collatorToIdentifier 10728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromIdentifier 10738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_shortStringToIdentifier 10748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 10758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL int32_t U_EXPORT2 10778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_identifierToShortString(uint32_t identifier, 10788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project char *buffer, 10798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int32_t capacity, 10808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool forceDefaults, 10818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 10828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 10838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 10848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Calculate the identifier given a short definition string. Supports preflighting. 10858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param definition short string definition 10868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param forceDefaults whether the settings that are the same as the default setting 10878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * should be forced anyway. Setting this argument to FALSE reduces 10888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the number of different configurations, but decreases performace 10898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * as a collator has to be instantiated. 10908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for returning errors 10918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return identifier 10928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_collatorToIdentifier 10938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromIdentifier 10948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_identifierToShortString 10958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 10968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 10978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL uint32_t U_EXPORT2 10988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_shortStringToIdentifier(const char *definition, 10998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool forceDefaults, 11008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 11018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** 11058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Universal attribute getter that returns UCOL_DEFAULT if the value is default 11068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll collator which attributes are to be changed 11078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param attr attribute type 11088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return attribute value or UCOL_DEFAULT if the value is default 11098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status to indicate whether the operation went on smoothly or there were errors 11108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttribute 11118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see UColAttributeValue 11128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_setAttribute 11138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 11148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL UColAttributeValue U_EXPORT2 11168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status); 11178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Check whether two collators are equal. Collators are considered equal if they 11198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * will sort strings the same. This means that both the current attributes and the 11208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * rules must be equivalent. Currently used for RuleBasedCollator::operator==. 11218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param source first collator 11228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param target second collator 11238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return TRUE or FALSE 11248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 11258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL UBool U_EXPORT2 11278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_equals(const UCollator *source, const UCollator *target); 11288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Calculates the set of unsafe code points, given a collator. 11308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * A character is unsafe if you could append any character and cause the ordering to alter significantly. 11318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Collation sorts in normalized order, so anything that rearranges in normalization can cause this. 11328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Thus if you have a character like a_umlaut, and you add a lower_dot to it, 11338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * then it normalizes to a_lower_dot + umlaut, and sorts differently. 11348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll Collator 11358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param unsafe a fill-in set to receive the unsafe points 11368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for catching errors 11378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return number of elements in the set 11388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.0 11398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL int32_t U_EXPORT2 11418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_getUnsafeSet( const UCollator *coll, 11428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project USet *unsafe, 11438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 11448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Reset UCA's static pointers. You don't want to use this, unless your static memory can go away. 11468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.2.1 11478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL void U_EXPORT2 11498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_forgetUCA(void); 11508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Touches all resources needed for instantiating a collator from a short string definition, 11528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * thus filling up the cache. 11538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param definition A short string containing a locale and a set of attributes. 11548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Attributes not explicitly mentioned are left at the default 11558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * state for a locale. 11568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param parseError if not NULL, structure that will get filled with error's pre 11578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * and post context in case of error. 11588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param forceDefaults if FALSE, the settings that are the same as the collator 11598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * default settings will not be applied (for example, setting 11608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * French secondary on a French collator would not be executed). 11618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If TRUE, all the settings will be applied regardless of the 11628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collator default value. If the definition 11638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * strings are to be cached, should be set to FALSE. 11648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status Error code. Apart from regular error conditions connected to 11658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * instantiating collators (like out of memory or similar), this 11668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * API will return an error if an invalid attribute or attribute/value 11678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * combination is specified. 11688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openFromShortString 11698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @internal ICU 3.2.1 11708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_INTERNAL void U_EXPORT2 11728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_prepareShortStringOpen( const char *definition, 11738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UBool forceDefaults, 11748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UParseError *parseError, 11758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 11768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Creates a binary image of a collator. This binary image can be stored and 11788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * later used to instantiate a collator using ucol_openBinary. 11798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This API supports preflighting. 11808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param coll Collator 11818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param buffer a fill-in buffer to receive the binary image 11828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param capacity capacity of the destination buffer 11838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for catching errors 11848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return size of the image 11858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_openBinary 11868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.2 11878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 11888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT int32_t U_EXPORT2 11898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_cloneBinary(const UCollator *coll, 11908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project uint8_t *buffer, int32_t capacity, 11918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 11928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 11938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/** Opens a collator from a collator binary image created using 11948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ucol_cloneBinary. Binary image used in instantiation of the 11958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * collator remains owned by the user and should stay around for 11968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the lifetime of the collator. The API also takes a base collator 11978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * which usualy should be UCA. 11988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param bin binary image owned by the user and required through the 11998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * lifetime of the collator 12008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param length size of the image. If negative, the API will try to 12018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * figure out the length of the image 12028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param base fallback collator, usually UCA. Base is required to be 12038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * present through the lifetime of the collator. Currently 12048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * it cannot be NULL. 12058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @param status for catching errors 12068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @return newly created collator 12078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @see ucol_cloneBinary 12088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * @draft ICU 3.2 12098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 12108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectU_DRAFT UCollator* U_EXPORT2 12118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectucol_openBinary(const uint8_t *bin, int32_t length, 12128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const UCollator *base, 12138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project UErrorCode *status); 12148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 12158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 12168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif /* #if !UCONFIG_NO_COLLATION */ 12178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 12188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif 12198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1220