annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/coll.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 ******************************************************************************
jpayne@69 5 * Copyright (C) 1996-2016, International Business Machines
jpayne@69 6 * Corporation and others. All Rights Reserved.
jpayne@69 7 ******************************************************************************
jpayne@69 8 */
jpayne@69 9
jpayne@69 10 /**
jpayne@69 11 * \file
jpayne@69 12 * \brief C++ API: Collation Service.
jpayne@69 13 */
jpayne@69 14
jpayne@69 15 /**
jpayne@69 16 * File coll.h
jpayne@69 17 *
jpayne@69 18 * Created by: Helena Shih
jpayne@69 19 *
jpayne@69 20 * Modification History:
jpayne@69 21 *
jpayne@69 22 * Date Name Description
jpayne@69 23 * 02/5/97 aliu Modified createDefault to load collation data from
jpayne@69 24 * binary files when possible. Added related methods
jpayne@69 25 * createCollationFromFile, chopLocale, createPathName.
jpayne@69 26 * 02/11/97 aliu Added members addToCache, findInCache, and fgCache.
jpayne@69 27 * 02/12/97 aliu Modified to create objects from RuleBasedCollator cache.
jpayne@69 28 * Moved cache out of Collation class.
jpayne@69 29 * 02/13/97 aliu Moved several methods out of this class and into
jpayne@69 30 * RuleBasedCollator, with modifications. Modified
jpayne@69 31 * createDefault() to call new RuleBasedCollator(Locale&)
jpayne@69 32 * constructor. General clean up and documentation.
jpayne@69 33 * 02/20/97 helena Added clone, operator==, operator!=, operator=, copy
jpayne@69 34 * constructor and getDynamicClassID.
jpayne@69 35 * 03/25/97 helena Updated with platform independent data types.
jpayne@69 36 * 05/06/97 helena Added memory allocation error detection.
jpayne@69 37 * 06/20/97 helena Java class name change.
jpayne@69 38 * 09/03/97 helena Added createCollationKeyValues().
jpayne@69 39 * 02/10/98 damiba Added compare() with length as parameter.
jpayne@69 40 * 04/23/99 stephen Removed EDecompositionMode, merged with
jpayne@69 41 * Normalizer::EMode.
jpayne@69 42 * 11/02/99 helena Collator performance enhancements. Eliminates the
jpayne@69 43 * UnicodeString construction and special case for NO_OP.
jpayne@69 44 * 11/23/99 srl More performance enhancements. Inlining of
jpayne@69 45 * critical accessors.
jpayne@69 46 * 05/15/00 helena Added version information API.
jpayne@69 47 * 01/29/01 synwee Modified into a C++ wrapper which calls C apis
jpayne@69 48 * (ucol.h).
jpayne@69 49 * 2012-2014 markus Rewritten in C++ again.
jpayne@69 50 */
jpayne@69 51
jpayne@69 52 #ifndef COLL_H
jpayne@69 53 #define COLL_H
jpayne@69 54
jpayne@69 55 #include "unicode/utypes.h"
jpayne@69 56
jpayne@69 57 #if U_SHOW_CPLUSPLUS_API
jpayne@69 58
jpayne@69 59 #if !UCONFIG_NO_COLLATION
jpayne@69 60
jpayne@69 61 #include "unicode/uobject.h"
jpayne@69 62 #include "unicode/ucol.h"
jpayne@69 63 #include "unicode/unorm.h"
jpayne@69 64 #include "unicode/locid.h"
jpayne@69 65 #include "unicode/uniset.h"
jpayne@69 66 #include "unicode/umisc.h"
jpayne@69 67 #include "unicode/uiter.h"
jpayne@69 68 #include "unicode/stringpiece.h"
jpayne@69 69
jpayne@69 70 U_NAMESPACE_BEGIN
jpayne@69 71
jpayne@69 72 class StringEnumeration;
jpayne@69 73
jpayne@69 74 #if !UCONFIG_NO_SERVICE
jpayne@69 75 /**
jpayne@69 76 * @stable ICU 2.6
jpayne@69 77 */
jpayne@69 78 class CollatorFactory;
jpayne@69 79 #endif
jpayne@69 80
jpayne@69 81 /**
jpayne@69 82 * @stable ICU 2.0
jpayne@69 83 */
jpayne@69 84 class CollationKey;
jpayne@69 85
jpayne@69 86 /**
jpayne@69 87 * The <code>Collator</code> class performs locale-sensitive string
jpayne@69 88 * comparison.<br>
jpayne@69 89 * You use this class to build searching and sorting routines for natural
jpayne@69 90 * language text.
jpayne@69 91 * <p>
jpayne@69 92 * <code>Collator</code> is an abstract base class. Subclasses implement
jpayne@69 93 * specific collation strategies. One subclass,
jpayne@69 94 * <code>RuleBasedCollator</code>, is currently provided and is applicable
jpayne@69 95 * to a wide set of languages. Other subclasses may be created to handle more
jpayne@69 96 * specialized needs.
jpayne@69 97 * <p>
jpayne@69 98 * Like other locale-sensitive classes, you can use the static factory method,
jpayne@69 99 * <code>createInstance</code>, to obtain the appropriate
jpayne@69 100 * <code>Collator</code> object for a given locale. You will only need to
jpayne@69 101 * look at the subclasses of <code>Collator</code> if you need to
jpayne@69 102 * understand the details of a particular collation strategy or if you need to
jpayne@69 103 * modify that strategy.
jpayne@69 104 * <p>
jpayne@69 105 * The following example shows how to compare two strings using the
jpayne@69 106 * <code>Collator</code> for the default locale.
jpayne@69 107 * \htmlonly<blockquote>\endhtmlonly
jpayne@69 108 * <pre>
jpayne@69 109 * \code
jpayne@69 110 * // Compare two strings in the default locale
jpayne@69 111 * UErrorCode success = U_ZERO_ERROR;
jpayne@69 112 * Collator* myCollator = Collator::createInstance(success);
jpayne@69 113 * if (myCollator->compare("abc", "ABC") < 0)
jpayne@69 114 * cout << "abc is less than ABC" << endl;
jpayne@69 115 * else
jpayne@69 116 * cout << "abc is greater than or equal to ABC" << endl;
jpayne@69 117 * \endcode
jpayne@69 118 * </pre>
jpayne@69 119 * \htmlonly</blockquote>\endhtmlonly
jpayne@69 120 * <p>
jpayne@69 121 * You can set a <code>Collator</code>'s <em>strength</em> attribute to
jpayne@69 122 * determine the level of difference considered significant in comparisons.
jpayne@69 123 * Five strengths are provided: <code>PRIMARY</code>, <code>SECONDARY</code>,
jpayne@69 124 * <code>TERTIARY</code>, <code>QUATERNARY</code> and <code>IDENTICAL</code>.
jpayne@69 125 * The exact assignment of strengths to language features is locale dependent.
jpayne@69 126 * For example, in Czech, "e" and "f" are considered primary differences,
jpayne@69 127 * while "e" and "\u00EA" are secondary differences, "e" and "E" are tertiary
jpayne@69 128 * differences and "e" and "e" are identical. The following shows how both case
jpayne@69 129 * and accents could be ignored for US English.
jpayne@69 130 * \htmlonly<blockquote>\endhtmlonly
jpayne@69 131 * <pre>
jpayne@69 132 * \code
jpayne@69 133 * //Get the Collator for US English and set its strength to PRIMARY
jpayne@69 134 * UErrorCode success = U_ZERO_ERROR;
jpayne@69 135 * Collator* usCollator = Collator::createInstance(Locale::getUS(), success);
jpayne@69 136 * usCollator->setStrength(Collator::PRIMARY);
jpayne@69 137 * if (usCollator->compare("abc", "ABC") == 0)
jpayne@69 138 * cout << "'abc' and 'ABC' strings are equivalent with strength PRIMARY" << endl;
jpayne@69 139 * \endcode
jpayne@69 140 * </pre>
jpayne@69 141 * \htmlonly</blockquote>\endhtmlonly
jpayne@69 142 *
jpayne@69 143 * The <code>getSortKey</code> methods
jpayne@69 144 * convert a string to a series of bytes that can be compared bitwise against
jpayne@69 145 * other sort keys using <code>strcmp()</code>. Sort keys are written as
jpayne@69 146 * zero-terminated byte strings.
jpayne@69 147 *
jpayne@69 148 * Another set of APIs returns a <code>CollationKey</code> object that wraps
jpayne@69 149 * the sort key bytes instead of returning the bytes themselves.
jpayne@69 150 * </p>
jpayne@69 151 * <p>
jpayne@69 152 * <strong>Note:</strong> <code>Collator</code>s with different Locale,
jpayne@69 153 * and CollationStrength settings will return different sort
jpayne@69 154 * orders for the same set of strings. Locales have specific collation rules,
jpayne@69 155 * and the way in which secondary and tertiary differences are taken into
jpayne@69 156 * account, for example, will result in a different sorting order for same
jpayne@69 157 * strings.
jpayne@69 158 * </p>
jpayne@69 159 * @see RuleBasedCollator
jpayne@69 160 * @see CollationKey
jpayne@69 161 * @see CollationElementIterator
jpayne@69 162 * @see Locale
jpayne@69 163 * @see Normalizer2
jpayne@69 164 * @version 2.0 11/15/01
jpayne@69 165 */
jpayne@69 166
jpayne@69 167 class U_I18N_API Collator : public UObject {
jpayne@69 168 public:
jpayne@69 169
jpayne@69 170 // Collator public enums -----------------------------------------------
jpayne@69 171
jpayne@69 172 /**
jpayne@69 173 * Base letter represents a primary difference. Set comparison level to
jpayne@69 174 * PRIMARY to ignore secondary and tertiary differences.<br>
jpayne@69 175 * Use this to set the strength of a Collator object.<br>
jpayne@69 176 * Example of primary difference, "abc" &lt; "abd"
jpayne@69 177 *
jpayne@69 178 * Diacritical differences on the same base letter represent a secondary
jpayne@69 179 * difference. Set comparison level to SECONDARY to ignore tertiary
jpayne@69 180 * differences. Use this to set the strength of a Collator object.<br>
jpayne@69 181 * Example of secondary difference, "&auml;" >> "a".
jpayne@69 182 *
jpayne@69 183 * Uppercase and lowercase versions of the same character represents a
jpayne@69 184 * tertiary difference. Set comparison level to TERTIARY to include all
jpayne@69 185 * comparison differences. Use this to set the strength of a Collator
jpayne@69 186 * object.<br>
jpayne@69 187 * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
jpayne@69 188 *
jpayne@69 189 * Two characters are considered "identical" when they have the same unicode
jpayne@69 190 * spellings.<br>
jpayne@69 191 * For example, "&auml;" == "&auml;".
jpayne@69 192 *
jpayne@69 193 * UCollationStrength is also used to determine the strength of sort keys
jpayne@69 194 * generated from Collator objects.
jpayne@69 195 * @stable ICU 2.0
jpayne@69 196 */
jpayne@69 197 enum ECollationStrength
jpayne@69 198 {
jpayne@69 199 PRIMARY = UCOL_PRIMARY, // 0
jpayne@69 200 SECONDARY = UCOL_SECONDARY, // 1
jpayne@69 201 TERTIARY = UCOL_TERTIARY, // 2
jpayne@69 202 QUATERNARY = UCOL_QUATERNARY, // 3
jpayne@69 203 IDENTICAL = UCOL_IDENTICAL // 15
jpayne@69 204 };
jpayne@69 205
jpayne@69 206
jpayne@69 207 // Cannot use #ifndef U_HIDE_DEPRECATED_API for the following, it is
jpayne@69 208 // used by virtual methods that cannot have that conditional.
jpayne@69 209 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 210 /**
jpayne@69 211 * LESS is returned if source string is compared to be less than target
jpayne@69 212 * string in the compare() method.
jpayne@69 213 * EQUAL is returned if source string is compared to be equal to target
jpayne@69 214 * string in the compare() method.
jpayne@69 215 * GREATER is returned if source string is compared to be greater than
jpayne@69 216 * target string in the compare() method.
jpayne@69 217 * @see Collator#compare
jpayne@69 218 * @deprecated ICU 2.6. Use C enum UCollationResult defined in ucol.h
jpayne@69 219 */
jpayne@69 220 enum EComparisonResult
jpayne@69 221 {
jpayne@69 222 LESS = UCOL_LESS, // -1
jpayne@69 223 EQUAL = UCOL_EQUAL, // 0
jpayne@69 224 GREATER = UCOL_GREATER // 1
jpayne@69 225 };
jpayne@69 226 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 227
jpayne@69 228 // Collator public destructor -----------------------------------------
jpayne@69 229
jpayne@69 230 /**
jpayne@69 231 * Destructor
jpayne@69 232 * @stable ICU 2.0
jpayne@69 233 */
jpayne@69 234 virtual ~Collator();
jpayne@69 235
jpayne@69 236 // Collator public methods --------------------------------------------
jpayne@69 237
jpayne@69 238 /**
jpayne@69 239 * Returns TRUE if "other" is the same as "this".
jpayne@69 240 *
jpayne@69 241 * The base class implementation returns TRUE if "other" has the same type/class as "this":
jpayne@69 242 * `typeid(*this) == typeid(other)`.
jpayne@69 243 *
jpayne@69 244 * Subclass implementations should do something like the following:
jpayne@69 245 *
jpayne@69 246 * if (this == &other) { return TRUE; }
jpayne@69 247 * if (!Collator::operator==(other)) { return FALSE; } // not the same class
jpayne@69 248 *
jpayne@69 249 * const MyCollator &o = (const MyCollator&)other;
jpayne@69 250 * (compare this vs. o's subclass fields)
jpayne@69 251 *
jpayne@69 252 * @param other Collator object to be compared
jpayne@69 253 * @return TRUE if other is the same as this.
jpayne@69 254 * @stable ICU 2.0
jpayne@69 255 */
jpayne@69 256 virtual UBool operator==(const Collator& other) const;
jpayne@69 257
jpayne@69 258 /**
jpayne@69 259 * Returns true if "other" is not the same as "this".
jpayne@69 260 * Calls ! operator==(const Collator&) const which works for all subclasses.
jpayne@69 261 * @param other Collator object to be compared
jpayne@69 262 * @return TRUE if other is not the same as this.
jpayne@69 263 * @stable ICU 2.0
jpayne@69 264 */
jpayne@69 265 virtual UBool operator!=(const Collator& other) const;
jpayne@69 266
jpayne@69 267 /**
jpayne@69 268 * Makes a copy of this object.
jpayne@69 269 * @return a copy of this object, owned by the caller
jpayne@69 270 * @stable ICU 2.0
jpayne@69 271 */
jpayne@69 272 virtual Collator* clone() const = 0;
jpayne@69 273
jpayne@69 274 /**
jpayne@69 275 * Creates the Collator object for the current default locale.
jpayne@69 276 * The default locale is determined by Locale::getDefault.
jpayne@69 277 * The UErrorCode& err parameter is used to return status information to the user.
jpayne@69 278 * To check whether the construction succeeded or not, you should check the
jpayne@69 279 * value of U_SUCCESS(err). If you wish more detailed information, you can
jpayne@69 280 * check for informational error results which still indicate success.
jpayne@69 281 * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For
jpayne@69 282 * example, 'de_CH' was requested, but nothing was found there, so 'de' was
jpayne@69 283 * used. U_USING_DEFAULT_ERROR indicates that the default locale data was
jpayne@69 284 * used; neither the requested locale nor any of its fall back locales
jpayne@69 285 * could be found.
jpayne@69 286 * The caller owns the returned object and is responsible for deleting it.
jpayne@69 287 *
jpayne@69 288 * @param err the error code status.
jpayne@69 289 * @return the collation object of the default locale.(for example, en_US)
jpayne@69 290 * @see Locale#getDefault
jpayne@69 291 * @stable ICU 2.0
jpayne@69 292 */
jpayne@69 293 static Collator* U_EXPORT2 createInstance(UErrorCode& err);
jpayne@69 294
jpayne@69 295 /**
jpayne@69 296 * Gets the collation object for the desired locale. The
jpayne@69 297 * resource of the desired locale will be loaded.
jpayne@69 298 *
jpayne@69 299 * Locale::getRoot() is the base collation table and all other languages are
jpayne@69 300 * built on top of it with additional language-specific modifications.
jpayne@69 301 *
jpayne@69 302 * For some languages, multiple collation types are available;
jpayne@69 303 * for example, "de@collation=phonebook".
jpayne@69 304 * Starting with ICU 54, collation attributes can be specified via locale keywords as well,
jpayne@69 305 * in the old locale extension syntax ("el@colCaseFirst=upper")
jpayne@69 306 * or in language tag syntax ("el-u-kf-upper").
jpayne@69 307 * See <a href="http://userguide.icu-project.org/collation/api">User Guide: Collation API</a>.
jpayne@69 308 *
jpayne@69 309 * The UErrorCode& err parameter is used to return status information to the user.
jpayne@69 310 * To check whether the construction succeeded or not, you should check
jpayne@69 311 * the value of U_SUCCESS(err). If you wish more detailed information, you
jpayne@69 312 * can check for informational error results which still indicate success.
jpayne@69 313 * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For
jpayne@69 314 * example, 'de_CH' was requested, but nothing was found there, so 'de' was
jpayne@69 315 * used. U_USING_DEFAULT_ERROR indicates that the default locale data was
jpayne@69 316 * used; neither the requested locale nor any of its fall back locales
jpayne@69 317 * could be found.
jpayne@69 318 *
jpayne@69 319 * The caller owns the returned object and is responsible for deleting it.
jpayne@69 320 * @param loc The locale ID for which to open a collator.
jpayne@69 321 * @param err the error code status.
jpayne@69 322 * @return the created table-based collation object based on the desired
jpayne@69 323 * locale.
jpayne@69 324 * @see Locale
jpayne@69 325 * @see ResourceLoader
jpayne@69 326 * @stable ICU 2.2
jpayne@69 327 */
jpayne@69 328 static Collator* U_EXPORT2 createInstance(const Locale& loc, UErrorCode& err);
jpayne@69 329
jpayne@69 330 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 331 /**
jpayne@69 332 * The comparison function compares the character data stored in two
jpayne@69 333 * different strings. Returns information about whether a string is less
jpayne@69 334 * than, greater than or equal to another string.
jpayne@69 335 * @param source the source string to be compared with.
jpayne@69 336 * @param target the string that is to be compared with the source string.
jpayne@69 337 * @return Returns a byte value. GREATER if source is greater
jpayne@69 338 * than target; EQUAL if source is equal to target; LESS if source is less
jpayne@69 339 * than target
jpayne@69 340 * @deprecated ICU 2.6 use the overload with UErrorCode &
jpayne@69 341 */
jpayne@69 342 virtual EComparisonResult compare(const UnicodeString& source,
jpayne@69 343 const UnicodeString& target) const;
jpayne@69 344 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 345
jpayne@69 346 /**
jpayne@69 347 * The comparison function compares the character data stored in two
jpayne@69 348 * different strings. Returns information about whether a string is less
jpayne@69 349 * than, greater than or equal to another string.
jpayne@69 350 * @param source the source string to be compared with.
jpayne@69 351 * @param target the string that is to be compared with the source string.
jpayne@69 352 * @param status possible error code
jpayne@69 353 * @return Returns an enum value. UCOL_GREATER if source is greater
jpayne@69 354 * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
jpayne@69 355 * than target
jpayne@69 356 * @stable ICU 2.6
jpayne@69 357 */
jpayne@69 358 virtual UCollationResult compare(const UnicodeString& source,
jpayne@69 359 const UnicodeString& target,
jpayne@69 360 UErrorCode &status) const = 0;
jpayne@69 361
jpayne@69 362 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 363 /**
jpayne@69 364 * Does the same thing as compare but limits the comparison to a specified
jpayne@69 365 * length
jpayne@69 366 * @param source the source string to be compared with.
jpayne@69 367 * @param target the string that is to be compared with the source string.
jpayne@69 368 * @param length the length the comparison is limited to
jpayne@69 369 * @return Returns a byte value. GREATER if source (up to the specified
jpayne@69 370 * length) is greater than target; EQUAL if source (up to specified
jpayne@69 371 * length) is equal to target; LESS if source (up to the specified
jpayne@69 372 * length) is less than target.
jpayne@69 373 * @deprecated ICU 2.6 use the overload with UErrorCode &
jpayne@69 374 */
jpayne@69 375 virtual EComparisonResult compare(const UnicodeString& source,
jpayne@69 376 const UnicodeString& target,
jpayne@69 377 int32_t length) const;
jpayne@69 378 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 379
jpayne@69 380 /**
jpayne@69 381 * Does the same thing as compare but limits the comparison to a specified
jpayne@69 382 * length
jpayne@69 383 * @param source the source string to be compared with.
jpayne@69 384 * @param target the string that is to be compared with the source string.
jpayne@69 385 * @param length the length the comparison is limited to
jpayne@69 386 * @param status possible error code
jpayne@69 387 * @return Returns an enum value. UCOL_GREATER if source (up to the specified
jpayne@69 388 * length) is greater than target; UCOL_EQUAL if source (up to specified
jpayne@69 389 * length) is equal to target; UCOL_LESS if source (up to the specified
jpayne@69 390 * length) is less than target.
jpayne@69 391 * @stable ICU 2.6
jpayne@69 392 */
jpayne@69 393 virtual UCollationResult compare(const UnicodeString& source,
jpayne@69 394 const UnicodeString& target,
jpayne@69 395 int32_t length,
jpayne@69 396 UErrorCode &status) const = 0;
jpayne@69 397
jpayne@69 398 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 399 /**
jpayne@69 400 * The comparison function compares the character data stored in two
jpayne@69 401 * different string arrays. Returns information about whether a string array
jpayne@69 402 * is less than, greater than or equal to another string array.
jpayne@69 403 * <p>Example of use:
jpayne@69 404 * <pre>
jpayne@69 405 * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC"
jpayne@69 406 * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc"
jpayne@69 407 * . UErrorCode status = U_ZERO_ERROR;
jpayne@69 408 * . Collator *myCollation =
jpayne@69 409 * . Collator::createInstance(Locale::getUS(), status);
jpayne@69 410 * . if (U_FAILURE(status)) return;
jpayne@69 411 * . myCollation->setStrength(Collator::PRIMARY);
jpayne@69 412 * . // result would be Collator::EQUAL ("abc" == "ABC")
jpayne@69 413 * . // (no primary difference between "abc" and "ABC")
jpayne@69 414 * . Collator::EComparisonResult result =
jpayne@69 415 * . myCollation->compare(abc, 3, ABC, 3);
jpayne@69 416 * . myCollation->setStrength(Collator::TERTIARY);
jpayne@69 417 * . // result would be Collator::LESS ("abc" &lt;&lt;&lt; "ABC")
jpayne@69 418 * . // (with tertiary difference between "abc" and "ABC")
jpayne@69 419 * . result = myCollation->compare(abc, 3, ABC, 3);
jpayne@69 420 * </pre>
jpayne@69 421 * @param source the source string array to be compared with.
jpayne@69 422 * @param sourceLength the length of the source string array. If this value
jpayne@69 423 * is equal to -1, the string array is null-terminated.
jpayne@69 424 * @param target the string that is to be compared with the source string.
jpayne@69 425 * @param targetLength the length of the target string array. If this value
jpayne@69 426 * is equal to -1, the string array is null-terminated.
jpayne@69 427 * @return Returns a byte value. GREATER if source is greater than target;
jpayne@69 428 * EQUAL if source is equal to target; LESS if source is less than
jpayne@69 429 * target
jpayne@69 430 * @deprecated ICU 2.6 use the overload with UErrorCode &
jpayne@69 431 */
jpayne@69 432 virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength,
jpayne@69 433 const char16_t* target, int32_t targetLength)
jpayne@69 434 const;
jpayne@69 435 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 436
jpayne@69 437 /**
jpayne@69 438 * The comparison function compares the character data stored in two
jpayne@69 439 * different string arrays. Returns information about whether a string array
jpayne@69 440 * is less than, greater than or equal to another string array.
jpayne@69 441 * @param source the source string array to be compared with.
jpayne@69 442 * @param sourceLength the length of the source string array. If this value
jpayne@69 443 * is equal to -1, the string array is null-terminated.
jpayne@69 444 * @param target the string that is to be compared with the source string.
jpayne@69 445 * @param targetLength the length of the target string array. If this value
jpayne@69 446 * is equal to -1, the string array is null-terminated.
jpayne@69 447 * @param status possible error code
jpayne@69 448 * @return Returns an enum value. UCOL_GREATER if source is greater
jpayne@69 449 * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
jpayne@69 450 * than target
jpayne@69 451 * @stable ICU 2.6
jpayne@69 452 */
jpayne@69 453 virtual UCollationResult compare(const char16_t* source, int32_t sourceLength,
jpayne@69 454 const char16_t* target, int32_t targetLength,
jpayne@69 455 UErrorCode &status) const = 0;
jpayne@69 456
jpayne@69 457 /**
jpayne@69 458 * Compares two strings using the Collator.
jpayne@69 459 * Returns whether the first one compares less than/equal to/greater than
jpayne@69 460 * the second one.
jpayne@69 461 * This version takes UCharIterator input.
jpayne@69 462 * @param sIter the first ("source") string iterator
jpayne@69 463 * @param tIter the second ("target") string iterator
jpayne@69 464 * @param status ICU status
jpayne@69 465 * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
jpayne@69 466 * @stable ICU 4.2
jpayne@69 467 */
jpayne@69 468 virtual UCollationResult compare(UCharIterator &sIter,
jpayne@69 469 UCharIterator &tIter,
jpayne@69 470 UErrorCode &status) const;
jpayne@69 471
jpayne@69 472 /**
jpayne@69 473 * Compares two UTF-8 strings using the Collator.
jpayne@69 474 * Returns whether the first one compares less than/equal to/greater than
jpayne@69 475 * the second one.
jpayne@69 476 * This version takes UTF-8 input.
jpayne@69 477 * Note that a StringPiece can be implicitly constructed
jpayne@69 478 * from a std::string or a NUL-terminated const char * string.
jpayne@69 479 * @param source the first UTF-8 string
jpayne@69 480 * @param target the second UTF-8 string
jpayne@69 481 * @param status ICU status
jpayne@69 482 * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
jpayne@69 483 * @stable ICU 4.2
jpayne@69 484 */
jpayne@69 485 virtual UCollationResult compareUTF8(const StringPiece &source,
jpayne@69 486 const StringPiece &target,
jpayne@69 487 UErrorCode &status) const;
jpayne@69 488
jpayne@69 489 /**
jpayne@69 490 * Transforms the string into a series of characters that can be compared
jpayne@69 491 * with CollationKey::compareTo. It is not possible to restore the original
jpayne@69 492 * string from the chars in the sort key.
jpayne@69 493 * <p>Use CollationKey::equals or CollationKey::compare to compare the
jpayne@69 494 * generated sort keys.
jpayne@69 495 * If the source string is null, a null collation key will be returned.
jpayne@69 496 *
jpayne@69 497 * Note that sort keys are often less efficient than simply doing comparison.
jpayne@69 498 * For more details, see the ICU User Guide.
jpayne@69 499 *
jpayne@69 500 * @param source the source string to be transformed into a sort key.
jpayne@69 501 * @param key the collation key to be filled in
jpayne@69 502 * @param status the error code status.
jpayne@69 503 * @return the collation key of the string based on the collation rules.
jpayne@69 504 * @see CollationKey#compare
jpayne@69 505 * @stable ICU 2.0
jpayne@69 506 */
jpayne@69 507 virtual CollationKey& getCollationKey(const UnicodeString& source,
jpayne@69 508 CollationKey& key,
jpayne@69 509 UErrorCode& status) const = 0;
jpayne@69 510
jpayne@69 511 /**
jpayne@69 512 * Transforms the string into a series of characters that can be compared
jpayne@69 513 * with CollationKey::compareTo. It is not possible to restore the original
jpayne@69 514 * string from the chars in the sort key.
jpayne@69 515 * <p>Use CollationKey::equals or CollationKey::compare to compare the
jpayne@69 516 * generated sort keys.
jpayne@69 517 * <p>If the source string is null, a null collation key will be returned.
jpayne@69 518 *
jpayne@69 519 * Note that sort keys are often less efficient than simply doing comparison.
jpayne@69 520 * For more details, see the ICU User Guide.
jpayne@69 521 *
jpayne@69 522 * @param source the source string to be transformed into a sort key.
jpayne@69 523 * @param sourceLength length of the collation key
jpayne@69 524 * @param key the collation key to be filled in
jpayne@69 525 * @param status the error code status.
jpayne@69 526 * @return the collation key of the string based on the collation rules.
jpayne@69 527 * @see CollationKey#compare
jpayne@69 528 * @stable ICU 2.0
jpayne@69 529 */
jpayne@69 530 virtual CollationKey& getCollationKey(const char16_t*source,
jpayne@69 531 int32_t sourceLength,
jpayne@69 532 CollationKey& key,
jpayne@69 533 UErrorCode& status) const = 0;
jpayne@69 534 /**
jpayne@69 535 * Generates the hash code for the collation object
jpayne@69 536 * @stable ICU 2.0
jpayne@69 537 */
jpayne@69 538 virtual int32_t hashCode(void) const = 0;
jpayne@69 539
jpayne@69 540 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 541 /**
jpayne@69 542 * Gets the locale of the Collator
jpayne@69 543 *
jpayne@69 544 * @param type can be either requested, valid or actual locale. For more
jpayne@69 545 * information see the definition of ULocDataLocaleType in
jpayne@69 546 * uloc.h
jpayne@69 547 * @param status the error code status.
jpayne@69 548 * @return locale where the collation data lives. If the collator
jpayne@69 549 * was instantiated from rules, locale is empty.
jpayne@69 550 * @deprecated ICU 2.8 This API is under consideration for revision
jpayne@69 551 * in ICU 3.0.
jpayne@69 552 */
jpayne@69 553 virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const = 0;
jpayne@69 554 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 555
jpayne@69 556 /**
jpayne@69 557 * Convenience method for comparing two strings based on the collation rules.
jpayne@69 558 * @param source the source string to be compared with.
jpayne@69 559 * @param target the target string to be compared with.
jpayne@69 560 * @return true if the first string is greater than the second one,
jpayne@69 561 * according to the collation rules. false, otherwise.
jpayne@69 562 * @see Collator#compare
jpayne@69 563 * @stable ICU 2.0
jpayne@69 564 */
jpayne@69 565 UBool greater(const UnicodeString& source, const UnicodeString& target)
jpayne@69 566 const;
jpayne@69 567
jpayne@69 568 /**
jpayne@69 569 * Convenience method for comparing two strings based on the collation rules.
jpayne@69 570 * @param source the source string to be compared with.
jpayne@69 571 * @param target the target string to be compared with.
jpayne@69 572 * @return true if the first string is greater than or equal to the second
jpayne@69 573 * one, according to the collation rules. false, otherwise.
jpayne@69 574 * @see Collator#compare
jpayne@69 575 * @stable ICU 2.0
jpayne@69 576 */
jpayne@69 577 UBool greaterOrEqual(const UnicodeString& source,
jpayne@69 578 const UnicodeString& target) const;
jpayne@69 579
jpayne@69 580 /**
jpayne@69 581 * Convenience method for comparing two strings based on the collation rules.
jpayne@69 582 * @param source the source string to be compared with.
jpayne@69 583 * @param target the target string to be compared with.
jpayne@69 584 * @return true if the strings are equal according to the collation rules.
jpayne@69 585 * false, otherwise.
jpayne@69 586 * @see Collator#compare
jpayne@69 587 * @stable ICU 2.0
jpayne@69 588 */
jpayne@69 589 UBool equals(const UnicodeString& source, const UnicodeString& target) const;
jpayne@69 590
jpayne@69 591 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 592 /**
jpayne@69 593 * Determines the minimum strength that will be used in comparison or
jpayne@69 594 * transformation.
jpayne@69 595 * <p>E.g. with strength == SECONDARY, the tertiary difference is ignored
jpayne@69 596 * <p>E.g. with strength == PRIMARY, the secondary and tertiary difference
jpayne@69 597 * are ignored.
jpayne@69 598 * @return the current comparison level.
jpayne@69 599 * @see Collator#setStrength
jpayne@69 600 * @deprecated ICU 2.6 Use getAttribute(UCOL_STRENGTH...) instead
jpayne@69 601 */
jpayne@69 602 virtual ECollationStrength getStrength(void) const;
jpayne@69 603
jpayne@69 604 /**
jpayne@69 605 * Sets the minimum strength to be used in comparison or transformation.
jpayne@69 606 * <p>Example of use:
jpayne@69 607 * <pre>
jpayne@69 608 * \code
jpayne@69 609 * UErrorCode status = U_ZERO_ERROR;
jpayne@69 610 * Collator*myCollation = Collator::createInstance(Locale::getUS(), status);
jpayne@69 611 * if (U_FAILURE(status)) return;
jpayne@69 612 * myCollation->setStrength(Collator::PRIMARY);
jpayne@69 613 * // result will be "abc" == "ABC"
jpayne@69 614 * // tertiary differences will be ignored
jpayne@69 615 * Collator::ComparisonResult result = myCollation->compare("abc", "ABC");
jpayne@69 616 * \endcode
jpayne@69 617 * </pre>
jpayne@69 618 * @see Collator#getStrength
jpayne@69 619 * @param newStrength the new comparison level.
jpayne@69 620 * @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead
jpayne@69 621 */
jpayne@69 622 virtual void setStrength(ECollationStrength newStrength);
jpayne@69 623 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 624
jpayne@69 625 /**
jpayne@69 626 * Retrieves the reordering codes for this collator.
jpayne@69 627 * @param dest The array to fill with the script ordering.
jpayne@69 628 * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
jpayne@69 629 * will only return the length of the result without writing any codes (pre-flighting).
jpayne@69 630 * @param status A reference to an error code value, which must not indicate
jpayne@69 631 * a failure before the function call.
jpayne@69 632 * @return The length of the script ordering array.
jpayne@69 633 * @see ucol_setReorderCodes
jpayne@69 634 * @see Collator#getEquivalentReorderCodes
jpayne@69 635 * @see Collator#setReorderCodes
jpayne@69 636 * @see UScriptCode
jpayne@69 637 * @see UColReorderCode
jpayne@69 638 * @stable ICU 4.8
jpayne@69 639 */
jpayne@69 640 virtual int32_t getReorderCodes(int32_t *dest,
jpayne@69 641 int32_t destCapacity,
jpayne@69 642 UErrorCode& status) const;
jpayne@69 643
jpayne@69 644 /**
jpayne@69 645 * Sets the ordering of scripts for this collator.
jpayne@69 646 *
jpayne@69 647 * <p>The reordering codes are a combination of script codes and reorder codes.
jpayne@69 648 * @param reorderCodes An array of script codes in the new order. This can be NULL if the
jpayne@69 649 * length is also set to 0. An empty array will clear any reordering codes on the collator.
jpayne@69 650 * @param reorderCodesLength The length of reorderCodes.
jpayne@69 651 * @param status error code
jpayne@69 652 * @see ucol_setReorderCodes
jpayne@69 653 * @see Collator#getReorderCodes
jpayne@69 654 * @see Collator#getEquivalentReorderCodes
jpayne@69 655 * @see UScriptCode
jpayne@69 656 * @see UColReorderCode
jpayne@69 657 * @stable ICU 4.8
jpayne@69 658 */
jpayne@69 659 virtual void setReorderCodes(const int32_t* reorderCodes,
jpayne@69 660 int32_t reorderCodesLength,
jpayne@69 661 UErrorCode& status) ;
jpayne@69 662
jpayne@69 663 /**
jpayne@69 664 * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder
jpayne@69 665 * codes will be grouped and must reorder together.
jpayne@69 666 * Beginning with ICU 55, scripts only reorder together if they are primary-equal,
jpayne@69 667 * for example Hiragana and Katakana.
jpayne@69 668 *
jpayne@69 669 * @param reorderCode The reorder code to determine equivalence for.
jpayne@69 670 * @param dest The array to fill with the script equivalence reordering codes.
jpayne@69 671 * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the
jpayne@69 672 * function will only return the length of the result without writing any codes (pre-flighting).
jpayne@69 673 * @param status A reference to an error code value, which must not indicate
jpayne@69 674 * a failure before the function call.
jpayne@69 675 * @return The length of the of the reordering code equivalence array.
jpayne@69 676 * @see ucol_setReorderCodes
jpayne@69 677 * @see Collator#getReorderCodes
jpayne@69 678 * @see Collator#setReorderCodes
jpayne@69 679 * @see UScriptCode
jpayne@69 680 * @see UColReorderCode
jpayne@69 681 * @stable ICU 4.8
jpayne@69 682 */
jpayne@69 683 static int32_t U_EXPORT2 getEquivalentReorderCodes(int32_t reorderCode,
jpayne@69 684 int32_t* dest,
jpayne@69 685 int32_t destCapacity,
jpayne@69 686 UErrorCode& status);
jpayne@69 687
jpayne@69 688 /**
jpayne@69 689 * Get name of the object for the desired Locale, in the desired language
jpayne@69 690 * @param objectLocale must be from getAvailableLocales
jpayne@69 691 * @param displayLocale specifies the desired locale for output
jpayne@69 692 * @param name the fill-in parameter of the return value
jpayne@69 693 * @return display-able name of the object for the object locale in the
jpayne@69 694 * desired language
jpayne@69 695 * @stable ICU 2.0
jpayne@69 696 */
jpayne@69 697 static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
jpayne@69 698 const Locale& displayLocale,
jpayne@69 699 UnicodeString& name);
jpayne@69 700
jpayne@69 701 /**
jpayne@69 702 * Get name of the object for the desired Locale, in the language of the
jpayne@69 703 * default locale.
jpayne@69 704 * @param objectLocale must be from getAvailableLocales
jpayne@69 705 * @param name the fill-in parameter of the return value
jpayne@69 706 * @return name of the object for the desired locale in the default language
jpayne@69 707 * @stable ICU 2.0
jpayne@69 708 */
jpayne@69 709 static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
jpayne@69 710 UnicodeString& name);
jpayne@69 711
jpayne@69 712 /**
jpayne@69 713 * Get the set of Locales for which Collations are installed.
jpayne@69 714 *
jpayne@69 715 * <p>Note this does not include locales supported by registered collators.
jpayne@69 716 * If collators might have been registered, use the overload of getAvailableLocales
jpayne@69 717 * that returns a StringEnumeration.</p>
jpayne@69 718 *
jpayne@69 719 * @param count the output parameter of number of elements in the locale list
jpayne@69 720 * @return the list of available locales for which collations are installed
jpayne@69 721 * @stable ICU 2.0
jpayne@69 722 */
jpayne@69 723 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
jpayne@69 724
jpayne@69 725 /**
jpayne@69 726 * Return a StringEnumeration over the locales available at the time of the call,
jpayne@69 727 * including registered locales. If a severe error occurs (such as out of memory
jpayne@69 728 * condition) this will return null. If there is no locale data, an empty enumeration
jpayne@69 729 * will be returned.
jpayne@69 730 * @return a StringEnumeration over the locales available at the time of the call
jpayne@69 731 * @stable ICU 2.6
jpayne@69 732 */
jpayne@69 733 static StringEnumeration* U_EXPORT2 getAvailableLocales(void);
jpayne@69 734
jpayne@69 735 /**
jpayne@69 736 * Create a string enumerator of all possible keywords that are relevant to
jpayne@69 737 * collation. At this point, the only recognized keyword for this
jpayne@69 738 * service is "collation".
jpayne@69 739 * @param status input-output error code
jpayne@69 740 * @return a string enumeration over locale strings. The caller is
jpayne@69 741 * responsible for closing the result.
jpayne@69 742 * @stable ICU 3.0
jpayne@69 743 */
jpayne@69 744 static StringEnumeration* U_EXPORT2 getKeywords(UErrorCode& status);
jpayne@69 745
jpayne@69 746 /**
jpayne@69 747 * Given a keyword, create a string enumeration of all values
jpayne@69 748 * for that keyword that are currently in use.
jpayne@69 749 * @param keyword a particular keyword as enumerated by
jpayne@69 750 * ucol_getKeywords. If any other keyword is passed in, status is set
jpayne@69 751 * to U_ILLEGAL_ARGUMENT_ERROR.
jpayne@69 752 * @param status input-output error code
jpayne@69 753 * @return a string enumeration over collation keyword values, or NULL
jpayne@69 754 * upon error. The caller is responsible for deleting the result.
jpayne@69 755 * @stable ICU 3.0
jpayne@69 756 */
jpayne@69 757 static StringEnumeration* U_EXPORT2 getKeywordValues(const char *keyword, UErrorCode& status);
jpayne@69 758
jpayne@69 759 /**
jpayne@69 760 * Given a key and a locale, returns an array of string values in a preferred
jpayne@69 761 * order that would make a difference. These are all and only those values where
jpayne@69 762 * the open (creation) of the service with the locale formed from the input locale
jpayne@69 763 * plus input keyword and that value has different behavior than creation with the
jpayne@69 764 * input locale alone.
jpayne@69 765 * @param keyword one of the keys supported by this service. For now, only
jpayne@69 766 * "collation" is supported.
jpayne@69 767 * @param locale the locale
jpayne@69 768 * @param commonlyUsed if set to true it will return only commonly used values
jpayne@69 769 * with the given locale in preferred order. Otherwise,
jpayne@69 770 * it will return all the available values for the locale.
jpayne@69 771 * @param status ICU status
jpayne@69 772 * @return a string enumeration over keyword values for the given key and the locale.
jpayne@69 773 * @stable ICU 4.2
jpayne@69 774 */
jpayne@69 775 static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* keyword, const Locale& locale,
jpayne@69 776 UBool commonlyUsed, UErrorCode& status);
jpayne@69 777
jpayne@69 778 /**
jpayne@69 779 * Return the functionally equivalent locale for the given
jpayne@69 780 * requested locale, with respect to given keyword, for the
jpayne@69 781 * collation service. If two locales return the same result, then
jpayne@69 782 * collators instantiated for these locales will behave
jpayne@69 783 * equivalently. The converse is not always true; two collators
jpayne@69 784 * may in fact be equivalent, but return different results, due to
jpayne@69 785 * internal details. The return result has no other meaning than
jpayne@69 786 * that stated above, and implies nothing as to the relationship
jpayne@69 787 * between the two locales. This is intended for use by
jpayne@69 788 * applications who wish to cache collators, or otherwise reuse
jpayne@69 789 * collators when possible. The functional equivalent may change
jpayne@69 790 * over time. For more information, please see the <a
jpayne@69 791 * href="http://userguide.icu-project.org/locale#TOC-Locales-and-Services">
jpayne@69 792 * Locales and Services</a> section of the ICU User Guide.
jpayne@69 793 * @param keyword a particular keyword as enumerated by
jpayne@69 794 * ucol_getKeywords.
jpayne@69 795 * @param locale the requested locale
jpayne@69 796 * @param isAvailable reference to a fillin parameter that
jpayne@69 797 * indicates whether the requested locale was 'available' to the
jpayne@69 798 * collation service. A locale is defined as 'available' if it
jpayne@69 799 * physically exists within the collation locale data.
jpayne@69 800 * @param status reference to input-output error code
jpayne@69 801 * @return the functionally equivalent collation locale, or the root
jpayne@69 802 * locale upon error.
jpayne@69 803 * @stable ICU 3.0
jpayne@69 804 */
jpayne@69 805 static Locale U_EXPORT2 getFunctionalEquivalent(const char* keyword, const Locale& locale,
jpayne@69 806 UBool& isAvailable, UErrorCode& status);
jpayne@69 807
jpayne@69 808 #if !UCONFIG_NO_SERVICE
jpayne@69 809 /**
jpayne@69 810 * Register a new Collator. The collator will be adopted.
jpayne@69 811 * Because ICU may choose to cache collators internally, this must be
jpayne@69 812 * called at application startup, prior to any calls to
jpayne@69 813 * Collator::createInstance to avoid undefined behavior.
jpayne@69 814 * @param toAdopt the Collator instance to be adopted
jpayne@69 815 * @param locale the locale with which the collator will be associated
jpayne@69 816 * @param status the in/out status code, no special meanings are assigned
jpayne@69 817 * @return a registry key that can be used to unregister this collator
jpayne@69 818 * @stable ICU 2.6
jpayne@69 819 */
jpayne@69 820 static URegistryKey U_EXPORT2 registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& status);
jpayne@69 821
jpayne@69 822 /**
jpayne@69 823 * Register a new CollatorFactory. The factory will be adopted.
jpayne@69 824 * Because ICU may choose to cache collators internally, this must be
jpayne@69 825 * called at application startup, prior to any calls to
jpayne@69 826 * Collator::createInstance to avoid undefined behavior.
jpayne@69 827 * @param toAdopt the CollatorFactory instance to be adopted
jpayne@69 828 * @param status the in/out status code, no special meanings are assigned
jpayne@69 829 * @return a registry key that can be used to unregister this collator
jpayne@69 830 * @stable ICU 2.6
jpayne@69 831 */
jpayne@69 832 static URegistryKey U_EXPORT2 registerFactory(CollatorFactory* toAdopt, UErrorCode& status);
jpayne@69 833
jpayne@69 834 /**
jpayne@69 835 * Unregister a previously-registered Collator or CollatorFactory
jpayne@69 836 * using the key returned from the register call. Key becomes
jpayne@69 837 * invalid after a successful call and should not be used again.
jpayne@69 838 * The object corresponding to the key will be deleted.
jpayne@69 839 * Because ICU may choose to cache collators internally, this should
jpayne@69 840 * be called during application shutdown, after all calls to
jpayne@69 841 * Collator::createInstance to avoid undefined behavior.
jpayne@69 842 * @param key the registry key returned by a previous call to registerInstance
jpayne@69 843 * @param status the in/out status code, no special meanings are assigned
jpayne@69 844 * @return TRUE if the collator for the key was successfully unregistered
jpayne@69 845 * @stable ICU 2.6
jpayne@69 846 */
jpayne@69 847 static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
jpayne@69 848 #endif /* UCONFIG_NO_SERVICE */
jpayne@69 849
jpayne@69 850 /**
jpayne@69 851 * Gets the version information for a Collator.
jpayne@69 852 * @param info the version # information, the result will be filled in
jpayne@69 853 * @stable ICU 2.0
jpayne@69 854 */
jpayne@69 855 virtual void getVersion(UVersionInfo info) const = 0;
jpayne@69 856
jpayne@69 857 /**
jpayne@69 858 * Returns a unique class ID POLYMORPHICALLY. Pure virtual method.
jpayne@69 859 * This method is to implement a simple version of RTTI, since not all C++
jpayne@69 860 * compilers support genuine RTTI. Polymorphic operator==() and clone()
jpayne@69 861 * methods call this method.
jpayne@69 862 * @return The class ID for this object. All objects of a given class have
jpayne@69 863 * the same class ID. Objects of other classes have different class
jpayne@69 864 * IDs.
jpayne@69 865 * @stable ICU 2.0
jpayne@69 866 */
jpayne@69 867 virtual UClassID getDynamicClassID(void) const = 0;
jpayne@69 868
jpayne@69 869 /**
jpayne@69 870 * Universal attribute setter
jpayne@69 871 * @param attr attribute type
jpayne@69 872 * @param value attribute value
jpayne@69 873 * @param status to indicate whether the operation went on smoothly or
jpayne@69 874 * there were errors
jpayne@69 875 * @stable ICU 2.2
jpayne@69 876 */
jpayne@69 877 virtual void setAttribute(UColAttribute attr, UColAttributeValue value,
jpayne@69 878 UErrorCode &status) = 0;
jpayne@69 879
jpayne@69 880 /**
jpayne@69 881 * Universal attribute getter
jpayne@69 882 * @param attr attribute type
jpayne@69 883 * @param status to indicate whether the operation went on smoothly or
jpayne@69 884 * there were errors
jpayne@69 885 * @return attribute value
jpayne@69 886 * @stable ICU 2.2
jpayne@69 887 */
jpayne@69 888 virtual UColAttributeValue getAttribute(UColAttribute attr,
jpayne@69 889 UErrorCode &status) const = 0;
jpayne@69 890
jpayne@69 891 /**
jpayne@69 892 * Sets the variable top to the top of the specified reordering group.
jpayne@69 893 * The variable top determines the highest-sorting character
jpayne@69 894 * which is affected by UCOL_ALTERNATE_HANDLING.
jpayne@69 895 * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect.
jpayne@69 896 *
jpayne@69 897 * The base class implementation sets U_UNSUPPORTED_ERROR.
jpayne@69 898 * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION,
jpayne@69 899 * UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY;
jpayne@69 900 * or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group
jpayne@69 901 * @param errorCode Standard ICU error code. Its input value must
jpayne@69 902 * pass the U_SUCCESS() test, or else the function returns
jpayne@69 903 * immediately. Check for U_FAILURE() on output or use with
jpayne@69 904 * function chaining. (See User Guide for details.)
jpayne@69 905 * @return *this
jpayne@69 906 * @see getMaxVariable
jpayne@69 907 * @stable ICU 53
jpayne@69 908 */
jpayne@69 909 virtual Collator &setMaxVariable(UColReorderCode group, UErrorCode &errorCode);
jpayne@69 910
jpayne@69 911 /**
jpayne@69 912 * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
jpayne@69 913 *
jpayne@69 914 * The base class implementation returns UCOL_REORDER_CODE_PUNCTUATION.
jpayne@69 915 * @return the maximum variable reordering group.
jpayne@69 916 * @see setMaxVariable
jpayne@69 917 * @stable ICU 53
jpayne@69 918 */
jpayne@69 919 virtual UColReorderCode getMaxVariable() const;
jpayne@69 920
jpayne@69 921 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 922 /**
jpayne@69 923 * Sets the variable top to the primary weight of the specified string.
jpayne@69 924 *
jpayne@69 925 * Beginning with ICU 53, the variable top is pinned to
jpayne@69 926 * the top of one of the supported reordering groups,
jpayne@69 927 * and it must not be beyond the last of those groups.
jpayne@69 928 * See setMaxVariable().
jpayne@69 929 * @param varTop one or more (if contraction) char16_ts to which the variable top should be set
jpayne@69 930 * @param len length of variable top string. If -1 it is considered to be zero terminated.
jpayne@69 931 * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
jpayne@69 932 * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
jpayne@69 933 * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
jpayne@69 934 * the last reordering group supported by setMaxVariable()
jpayne@69 935 * @return variable top primary weight
jpayne@69 936 * @deprecated ICU 53 Call setMaxVariable() instead.
jpayne@69 937 */
jpayne@69 938 virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0;
jpayne@69 939
jpayne@69 940 /**
jpayne@69 941 * Sets the variable top to the primary weight of the specified string.
jpayne@69 942 *
jpayne@69 943 * Beginning with ICU 53, the variable top is pinned to
jpayne@69 944 * the top of one of the supported reordering groups,
jpayne@69 945 * and it must not be beyond the last of those groups.
jpayne@69 946 * See setMaxVariable().
jpayne@69 947 * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set
jpayne@69 948 * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
jpayne@69 949 * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
jpayne@69 950 * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
jpayne@69 951 * the last reordering group supported by setMaxVariable()
jpayne@69 952 * @return variable top primary weight
jpayne@69 953 * @deprecated ICU 53 Call setMaxVariable() instead.
jpayne@69 954 */
jpayne@69 955 virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status) = 0;
jpayne@69 956
jpayne@69 957 /**
jpayne@69 958 * Sets the variable top to the specified primary weight.
jpayne@69 959 *
jpayne@69 960 * Beginning with ICU 53, the variable top is pinned to
jpayne@69 961 * the top of one of the supported reordering groups,
jpayne@69 962 * and it must not be beyond the last of those groups.
jpayne@69 963 * See setMaxVariable().
jpayne@69 964 * @param varTop primary weight, as returned by setVariableTop or ucol_getVariableTop
jpayne@69 965 * @param status error code
jpayne@69 966 * @deprecated ICU 53 Call setMaxVariable() instead.
jpayne@69 967 */
jpayne@69 968 virtual void setVariableTop(uint32_t varTop, UErrorCode &status) = 0;
jpayne@69 969 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 970
jpayne@69 971 /**
jpayne@69 972 * Gets the variable top value of a Collator.
jpayne@69 973 * @param status error code (not changed by function). If error code is set, the return value is undefined.
jpayne@69 974 * @return the variable top primary weight
jpayne@69 975 * @see getMaxVariable
jpayne@69 976 * @stable ICU 2.0
jpayne@69 977 */
jpayne@69 978 virtual uint32_t getVariableTop(UErrorCode &status) const = 0;
jpayne@69 979
jpayne@69 980 /**
jpayne@69 981 * Get a UnicodeSet that contains all the characters and sequences
jpayne@69 982 * tailored in this collator.
jpayne@69 983 * @param status error code of the operation
jpayne@69 984 * @return a pointer to a UnicodeSet object containing all the
jpayne@69 985 * code points and sequences that may sort differently than
jpayne@69 986 * in the root collator. The object must be disposed of by using delete
jpayne@69 987 * @stable ICU 2.4
jpayne@69 988 */
jpayne@69 989 virtual UnicodeSet *getTailoredSet(UErrorCode &status) const;
jpayne@69 990
jpayne@69 991 #ifndef U_FORCE_HIDE_DEPRECATED_API
jpayne@69 992 /**
jpayne@69 993 * Same as clone().
jpayne@69 994 * The base class implementation simply calls clone().
jpayne@69 995 * @return a copy of this object, owned by the caller
jpayne@69 996 * @see clone()
jpayne@69 997 * @deprecated ICU 50 no need to have two methods for cloning
jpayne@69 998 */
jpayne@69 999 virtual Collator* safeClone() const;
jpayne@69 1000 #endif // U_FORCE_HIDE_DEPRECATED_API
jpayne@69 1001
jpayne@69 1002 /**
jpayne@69 1003 * Get the sort key as an array of bytes from a UnicodeString.
jpayne@69 1004 * Sort key byte arrays are zero-terminated and can be compared using
jpayne@69 1005 * strcmp().
jpayne@69 1006 *
jpayne@69 1007 * Note that sort keys are often less efficient than simply doing comparison.
jpayne@69 1008 * For more details, see the ICU User Guide.
jpayne@69 1009 *
jpayne@69 1010 * @param source string to be processed.
jpayne@69 1011 * @param result buffer to store result in. If NULL, number of bytes needed
jpayne@69 1012 * will be returned.
jpayne@69 1013 * @param resultLength length of the result buffer. If if not enough the
jpayne@69 1014 * buffer will be filled to capacity.
jpayne@69 1015 * @return Number of bytes needed for storing the sort key
jpayne@69 1016 * @stable ICU 2.2
jpayne@69 1017 */
jpayne@69 1018 virtual int32_t getSortKey(const UnicodeString& source,
jpayne@69 1019 uint8_t* result,
jpayne@69 1020 int32_t resultLength) const = 0;
jpayne@69 1021
jpayne@69 1022 /**
jpayne@69 1023 * Get the sort key as an array of bytes from a char16_t buffer.
jpayne@69 1024 * Sort key byte arrays are zero-terminated and can be compared using
jpayne@69 1025 * strcmp().
jpayne@69 1026 *
jpayne@69 1027 * Note that sort keys are often less efficient than simply doing comparison.
jpayne@69 1028 * For more details, see the ICU User Guide.
jpayne@69 1029 *
jpayne@69 1030 * @param source string to be processed.
jpayne@69 1031 * @param sourceLength length of string to be processed.
jpayne@69 1032 * If -1, the string is 0 terminated and length will be decided by the
jpayne@69 1033 * function.
jpayne@69 1034 * @param result buffer to store result in. If NULL, number of bytes needed
jpayne@69 1035 * will be returned.
jpayne@69 1036 * @param resultLength length of the result buffer. If if not enough the
jpayne@69 1037 * buffer will be filled to capacity.
jpayne@69 1038 * @return Number of bytes needed for storing the sort key
jpayne@69 1039 * @stable ICU 2.2
jpayne@69 1040 */
jpayne@69 1041 virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength,
jpayne@69 1042 uint8_t*result, int32_t resultLength) const = 0;
jpayne@69 1043
jpayne@69 1044 /**
jpayne@69 1045 * Produce a bound for a given sortkey and a number of levels.
jpayne@69 1046 * Return value is always the number of bytes needed, regardless of
jpayne@69 1047 * whether the result buffer was big enough or even valid.<br>
jpayne@69 1048 * Resulting bounds can be used to produce a range of strings that are
jpayne@69 1049 * between upper and lower bounds. For example, if bounds are produced
jpayne@69 1050 * for a sortkey of string "smith", strings between upper and lower
jpayne@69 1051 * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
jpayne@69 1052 * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
jpayne@69 1053 * is produced, strings matched would be as above. However, if bound
jpayne@69 1054 * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
jpayne@69 1055 * also match "Smithsonian" and similar.<br>
jpayne@69 1056 * For more on usage, see example in cintltst/capitst.c in procedure
jpayne@69 1057 * TestBounds.
jpayne@69 1058 * Sort keys may be compared using <TT>strcmp</TT>.
jpayne@69 1059 * @param source The source sortkey.
jpayne@69 1060 * @param sourceLength The length of source, or -1 if null-terminated.
jpayne@69 1061 * (If an unmodified sortkey is passed, it is always null
jpayne@69 1062 * terminated).
jpayne@69 1063 * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
jpayne@69 1064 * produces a lower inclusive bound, UCOL_BOUND_UPPER, that
jpayne@69 1065 * produces upper bound that matches strings of the same length
jpayne@69 1066 * or UCOL_BOUND_UPPER_LONG that matches strings that have the
jpayne@69 1067 * same starting substring as the source string.
jpayne@69 1068 * @param noOfLevels Number of levels required in the resulting bound (for most
jpayne@69 1069 * uses, the recommended value is 1). See users guide for
jpayne@69 1070 * explanation on number of levels a sortkey can have.
jpayne@69 1071 * @param result A pointer to a buffer to receive the resulting sortkey.
jpayne@69 1072 * @param resultLength The maximum size of result.
jpayne@69 1073 * @param status Used for returning error code if something went wrong. If the
jpayne@69 1074 * number of levels requested is higher than the number of levels
jpayne@69 1075 * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
jpayne@69 1076 * issued.
jpayne@69 1077 * @return The size needed to fully store the bound.
jpayne@69 1078 * @see ucol_keyHashCode
jpayne@69 1079 * @stable ICU 2.1
jpayne@69 1080 */
jpayne@69 1081 static int32_t U_EXPORT2 getBound(const uint8_t *source,
jpayne@69 1082 int32_t sourceLength,
jpayne@69 1083 UColBoundMode boundType,
jpayne@69 1084 uint32_t noOfLevels,
jpayne@69 1085 uint8_t *result,
jpayne@69 1086 int32_t resultLength,
jpayne@69 1087 UErrorCode &status);
jpayne@69 1088
jpayne@69 1089
jpayne@69 1090 protected:
jpayne@69 1091
jpayne@69 1092 // Collator protected constructors -------------------------------------
jpayne@69 1093
jpayne@69 1094 /**
jpayne@69 1095 * Default constructor.
jpayne@69 1096 * Constructor is different from the old default Collator constructor.
jpayne@69 1097 * The task for determing the default collation strength and normalization
jpayne@69 1098 * mode is left to the child class.
jpayne@69 1099 * @stable ICU 2.0
jpayne@69 1100 */
jpayne@69 1101 Collator();
jpayne@69 1102
jpayne@69 1103 #ifndef U_HIDE_DEPRECATED_API
jpayne@69 1104 /**
jpayne@69 1105 * Constructor.
jpayne@69 1106 * Empty constructor, does not handle the arguments.
jpayne@69 1107 * This constructor is done for backward compatibility with 1.7 and 1.8.
jpayne@69 1108 * The task for handling the argument collation strength and normalization
jpayne@69 1109 * mode is left to the child class.
jpayne@69 1110 * @param collationStrength collation strength
jpayne@69 1111 * @param decompositionMode
jpayne@69 1112 * @deprecated ICU 2.4. Subclasses should use the default constructor
jpayne@69 1113 * instead and handle the strength and normalization mode themselves.
jpayne@69 1114 */
jpayne@69 1115 Collator(UCollationStrength collationStrength,
jpayne@69 1116 UNormalizationMode decompositionMode);
jpayne@69 1117 #endif /* U_HIDE_DEPRECATED_API */
jpayne@69 1118
jpayne@69 1119 /**
jpayne@69 1120 * Copy constructor.
jpayne@69 1121 * @param other Collator object to be copied from
jpayne@69 1122 * @stable ICU 2.0
jpayne@69 1123 */
jpayne@69 1124 Collator(const Collator& other);
jpayne@69 1125
jpayne@69 1126 public:
jpayne@69 1127 /**
jpayne@69 1128 * Used internally by registration to define the requested and valid locales.
jpayne@69 1129 * @param requestedLocale the requested locale
jpayne@69 1130 * @param validLocale the valid locale
jpayne@69 1131 * @param actualLocale the actual locale
jpayne@69 1132 * @internal
jpayne@69 1133 */
jpayne@69 1134 virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale);
jpayne@69 1135
jpayne@69 1136 /** Get the short definition string for a collator. This internal API harvests the collator's
jpayne@69 1137 * locale and the attribute set and produces a string that can be used for opening
jpayne@69 1138 * a collator with the same attributes using the ucol_openFromShortString API.
jpayne@69 1139 * This string will be normalized.
jpayne@69 1140 * The structure and the syntax of the string is defined in the "Naming collators"
jpayne@69 1141 * section of the users guide:
jpayne@69 1142 * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
jpayne@69 1143 * This function supports preflighting.
jpayne@69 1144 *
jpayne@69 1145 * This is internal, and intended to be used with delegate converters.
jpayne@69 1146 *
jpayne@69 1147 * @param locale a locale that will appear as a collators locale in the resulting
jpayne@69 1148 * short string definition. If NULL, the locale will be harvested
jpayne@69 1149 * from the collator.
jpayne@69 1150 * @param buffer space to hold the resulting string
jpayne@69 1151 * @param capacity capacity of the buffer
jpayne@69 1152 * @param status for returning errors. All the preflighting errors are featured
jpayne@69 1153 * @return length of the resulting string
jpayne@69 1154 * @see ucol_openFromShortString
jpayne@69 1155 * @see ucol_normalizeShortDefinitionString
jpayne@69 1156 * @see ucol_getShortDefinitionString
jpayne@69 1157 * @internal
jpayne@69 1158 */
jpayne@69 1159 virtual int32_t internalGetShortDefinitionString(const char *locale,
jpayne@69 1160 char *buffer,
jpayne@69 1161 int32_t capacity,
jpayne@69 1162 UErrorCode &status) const;
jpayne@69 1163
jpayne@69 1164 /**
jpayne@69 1165 * Implements ucol_strcollUTF8().
jpayne@69 1166 * @internal
jpayne@69 1167 */
jpayne@69 1168 virtual UCollationResult internalCompareUTF8(
jpayne@69 1169 const char *left, int32_t leftLength,
jpayne@69 1170 const char *right, int32_t rightLength,
jpayne@69 1171 UErrorCode &errorCode) const;
jpayne@69 1172
jpayne@69 1173 /**
jpayne@69 1174 * Implements ucol_nextSortKeyPart().
jpayne@69 1175 * @internal
jpayne@69 1176 */
jpayne@69 1177 virtual int32_t
jpayne@69 1178 internalNextSortKeyPart(
jpayne@69 1179 UCharIterator *iter, uint32_t state[2],
jpayne@69 1180 uint8_t *dest, int32_t count, UErrorCode &errorCode) const;
jpayne@69 1181
jpayne@69 1182 #ifndef U_HIDE_INTERNAL_API
jpayne@69 1183 /** @internal */
jpayne@69 1184 static inline Collator *fromUCollator(UCollator *uc) {
jpayne@69 1185 return reinterpret_cast<Collator *>(uc);
jpayne@69 1186 }
jpayne@69 1187 /** @internal */
jpayne@69 1188 static inline const Collator *fromUCollator(const UCollator *uc) {
jpayne@69 1189 return reinterpret_cast<const Collator *>(uc);
jpayne@69 1190 }
jpayne@69 1191 /** @internal */
jpayne@69 1192 inline UCollator *toUCollator() {
jpayne@69 1193 return reinterpret_cast<UCollator *>(this);
jpayne@69 1194 }
jpayne@69 1195 /** @internal */
jpayne@69 1196 inline const UCollator *toUCollator() const {
jpayne@69 1197 return reinterpret_cast<const UCollator *>(this);
jpayne@69 1198 }
jpayne@69 1199 #endif // U_HIDE_INTERNAL_API
jpayne@69 1200
jpayne@69 1201 private:
jpayne@69 1202 /**
jpayne@69 1203 * Assignment operator. Private for now.
jpayne@69 1204 */
jpayne@69 1205 Collator& operator=(const Collator& other);
jpayne@69 1206
jpayne@69 1207 friend class CFactory;
jpayne@69 1208 friend class SimpleCFactory;
jpayne@69 1209 friend class ICUCollatorFactory;
jpayne@69 1210 friend class ICUCollatorService;
jpayne@69 1211 static Collator* makeInstance(const Locale& desiredLocale,
jpayne@69 1212 UErrorCode& status);
jpayne@69 1213 };
jpayne@69 1214
jpayne@69 1215 #if !UCONFIG_NO_SERVICE
jpayne@69 1216 /**
jpayne@69 1217 * A factory, used with registerFactory, the creates multiple collators and provides
jpayne@69 1218 * display names for them. A factory supports some number of locales-- these are the
jpayne@69 1219 * locales for which it can create collators. The factory can be visible, in which
jpayne@69 1220 * case the supported locales will be enumerated by getAvailableLocales, or invisible,
jpayne@69 1221 * in which they are not. Invisible locales are still supported, they are just not
jpayne@69 1222 * listed by getAvailableLocales.
jpayne@69 1223 * <p>
jpayne@69 1224 * If standard locale display names are sufficient, Collator instances can
jpayne@69 1225 * be registered using registerInstance instead.</p>
jpayne@69 1226 * <p>
jpayne@69 1227 * Note: if the collators are to be used from C APIs, they must be instances
jpayne@69 1228 * of RuleBasedCollator.</p>
jpayne@69 1229 *
jpayne@69 1230 * @stable ICU 2.6
jpayne@69 1231 */
jpayne@69 1232 class U_I18N_API CollatorFactory : public UObject {
jpayne@69 1233 public:
jpayne@69 1234
jpayne@69 1235 /**
jpayne@69 1236 * Destructor
jpayne@69 1237 * @stable ICU 3.0
jpayne@69 1238 */
jpayne@69 1239 virtual ~CollatorFactory();
jpayne@69 1240
jpayne@69 1241 /**
jpayne@69 1242 * Return true if this factory is visible. Default is true.
jpayne@69 1243 * If not visible, the locales supported by this factory will not
jpayne@69 1244 * be listed by getAvailableLocales.
jpayne@69 1245 * @return true if the factory is visible.
jpayne@69 1246 * @stable ICU 2.6
jpayne@69 1247 */
jpayne@69 1248 virtual UBool visible(void) const;
jpayne@69 1249
jpayne@69 1250 /**
jpayne@69 1251 * Return a collator for the provided locale. If the locale
jpayne@69 1252 * is not supported, return NULL.
jpayne@69 1253 * @param loc the locale identifying the collator to be created.
jpayne@69 1254 * @return a new collator if the locale is supported, otherwise NULL.
jpayne@69 1255 * @stable ICU 2.6
jpayne@69 1256 */
jpayne@69 1257 virtual Collator* createCollator(const Locale& loc) = 0;
jpayne@69 1258
jpayne@69 1259 /**
jpayne@69 1260 * Return the name of the collator for the objectLocale, localized for the displayLocale.
jpayne@69 1261 * If objectLocale is not supported, or the factory is not visible, set the result string
jpayne@69 1262 * to bogus.
jpayne@69 1263 * @param objectLocale the locale identifying the collator
jpayne@69 1264 * @param displayLocale the locale for which the display name of the collator should be localized
jpayne@69 1265 * @param result an output parameter for the display name, set to bogus if not supported.
jpayne@69 1266 * @return the display name
jpayne@69 1267 * @stable ICU 2.6
jpayne@69 1268 */
jpayne@69 1269 virtual UnicodeString& getDisplayName(const Locale& objectLocale,
jpayne@69 1270 const Locale& displayLocale,
jpayne@69 1271 UnicodeString& result);
jpayne@69 1272
jpayne@69 1273 /**
jpayne@69 1274 * Return an array of all the locale names directly supported by this factory.
jpayne@69 1275 * The number of names is returned in count. This array is owned by the factory.
jpayne@69 1276 * Its contents must never change.
jpayne@69 1277 * @param count output parameter for the number of locales supported by the factory
jpayne@69 1278 * @param status the in/out error code
jpayne@69 1279 * @return a pointer to an array of count UnicodeStrings.
jpayne@69 1280 * @stable ICU 2.6
jpayne@69 1281 */
jpayne@69 1282 virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) = 0;
jpayne@69 1283 };
jpayne@69 1284 #endif /* UCONFIG_NO_SERVICE */
jpayne@69 1285
jpayne@69 1286 // Collator inline methods -----------------------------------------------
jpayne@69 1287
jpayne@69 1288 U_NAMESPACE_END
jpayne@69 1289
jpayne@69 1290 #endif /* #if !UCONFIG_NO_COLLATION */
jpayne@69 1291
jpayne@69 1292 #endif /* U_SHOW_CPLUSPLUS_API */
jpayne@69 1293
jpayne@69 1294 #endif