1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru****************************************************************************** 38393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius* Copyright (C) 1996-2013, International Business Machines Corporation and 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* others. All Rights Reserved. 5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru****************************************************************************** 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 9c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \file 10c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \brief C++ API: RuleBasedCollator class provides the simple implementation of Collator. 11c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 12c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 13c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File tblcoll.h 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Created by: Helena Shih 17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Modification History: 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Date Name Description 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 2/5/97 aliu Added streamIn and streamOut methods. Added 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* constructor which reads RuleBasedCollator object from 23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* a binary file. Added writeToFile method which streams 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* RuleBasedCollator out to a binary file. The streamIn 25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* and streamOut methods use istream and ostream objects 26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* in binary mode. 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 2/12/97 aliu Modified to use TableCollationData sub-object to 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* hold invariant data. 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 2/13/97 aliu Moved several methods into this class from Collation. 30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Added a private RuleBasedCollator(Locale&) constructor, 31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* to be used by Collator::createDefault(). General 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* clean up. 33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 2/20/97 helena Added clone, operator==, operator!=, operator=, and copy 34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* constructor and getDynamicClassID. 35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 3/5/97 aliu Modified constructFromFile() to add parameter 36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* specifying whether or not binary loading is to be 37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* attempted. This is required for dynamic rule loading. 38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 05/07/97 helena Added memory allocation error detection. 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 6/17/97 helena Added IDENTICAL strength for compare, changed getRules to 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* use MergeCollation::getPattern. 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 6/20/97 helena Java class name change. 42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 8/18/97 helena Added internal API documentation. 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 09/03/97 helena Added createCollationKeyValues(). 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 02/10/98 damiba Added compare with "length" parameter 45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 08/05/98 erm Synched with 1.2 version of RuleBasedCollator.java 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 04/23/99 stephen Removed EDecompositionMode, merged with 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Normalizer::EMode 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 06/14/99 stephen Removed kResourceBundleSuffix 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 11/02/99 helena Collator performance enhancements. Eliminates the 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* UnicodeString construction and special case for NO_OP. 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 11/23/99 srl More performance enhancements. Updates to NormalizerIterator 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* internal state management. 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 12/15/99 aliu Update to support Thai collation. Move NormalizerIterator 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* to implementation file. 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 01/29/01 synwee Modified into a C++ wrapper which calls C API 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* (ucol.h) 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef TBLCOLL_H 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define TBLCOLL_H 61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/coll.h" 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/ucol.h" 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/sortkey.h" 70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/normlzr.h" 71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_BEGIN 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* @stable ICU 2.0 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass StringSearch; 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* @stable ICU 2.0 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass CollationElementIterator; 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The RuleBasedCollator class provides the simple implementation of 85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Collator, using data-driven tables. The user can create a customized 86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * table-based collation. 87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <em>Important: </em>The ICU collation service has been reimplemented 89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in order to achieve better performance and UCA compliance. 90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For details, see the 91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm"> 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation design document</a>. 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator is a thin C++ wrapper over the C implementation. 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more information about the collation service see 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <a href="http://icu-project.org/userguide/Collate_Intro.html">the users guide</a>. 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Collation service provides correct sorting orders for most locales supported in ICU. 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If specific data for a locale is not available, the orders eventually falls back 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>. 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sort ordering may be customized by providing your own set of rules. For more on 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this subject see the <a href="http://icu-project.org/userguide/Collate_Customization.html"> 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Collation customization</a> section of the users guide. 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note, RuleBasedCollator is not to be subclassed. 108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Collator 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @version 2.0 11/15/2001 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass U_I18N_API RuleBasedCollator : public Collator 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querupublic: 114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // constructor ------------------------------------------------------------- 116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator constructor. This takes the table rules and builds a 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation table out of them. Please see RuleBasedCollator class 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * description for more details on the collation rule syntax. 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules the collation rules to build the collation table from. 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status reporting a success or an error. 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Locale 124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const UnicodeString& rules, UErrorCode& status); 127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator constructor. This takes the table rules and builds a 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation table out of them. Please see RuleBasedCollator class 131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * description for more details on the collation rule syntax. 132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules the collation rules to build the collation table from. 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param collationStrength default strength for comparison 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status reporting a success or an error. 135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Locale 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const UnicodeString& rules, 139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ECollationStrength collationStrength, 140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status); 141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator constructor. This takes the table rules and builds a 144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation table out of them. Please see RuleBasedCollator class 145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * description for more details on the collation rule syntax. 146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules the collation rules to build the collation table from. 147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param decompositionMode the normalisation mode 148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status reporting a success or an error. 149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Locale 150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const UnicodeString& rules, 153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UColAttributeValue decompositionMode, 154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status); 155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator constructor. This takes the table rules and builds a 158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation table out of them. Please see RuleBasedCollator class 159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * description for more details on the collation rule syntax. 160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules the collation rules to build the collation table from. 161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param collationStrength default strength for comparison 162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param decompositionMode the normalisation mode 163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status reporting a success or an error. 164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Locale 165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const UnicodeString& rules, 168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ECollationStrength collationStrength, 169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UColAttributeValue decompositionMode, 170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status); 171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy constructor. 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param other the RuleBasedCollator object to be copied 175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see Locale 176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const RuleBasedCollator& other); 179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Opens a collator from a collator binary image created using 182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * cloneBinary. Binary image used in instantiation of the 183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collator remains owned by the user and should stay around for 184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the lifetime of the collator. The API also takes a base collator 185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which usualy should be UCA. 186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param bin binary image owned by the user and required through the 187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * lifetime of the collator 188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length size of the image. If negative, the API will try to 189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * figure out the length of the image 190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param base fallback collator, usually UCA. Base is required to be 191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * present through the lifetime of the collator. Currently 192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it cannot be NULL. 193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status for catching errors 194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return newly created collator 195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see cloneBinary 196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.4 197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const uint8_t *bin, int32_t length, 199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const RuleBasedCollator *base, 200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status); 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // destructor -------------------------------------------------------------- 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Destructor. 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual ~RuleBasedCollator(); 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // public methods ---------------------------------------------------------- 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Assignment operator. 213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param other other RuleBasedCollator object to compare with. 214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator& operator=(const RuleBasedCollator& other); 217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns true if argument is the same as this object. 220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param other Collator object to be compared. 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return true if arguments is the same as this object. 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UBool operator==(const Collator& other) const; 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 22754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Makes a copy of this object. 22854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return a copy of this object, owned by the caller 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual Collator* clone(void) const; 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates a collation element iterator for the source string. The caller of 235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this method is responsible for the memory management of the return 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pointer. 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the string over which the CollationElementIterator will 238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * iterate. 239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the collation element iterator of the source string using this as 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the based Collator. 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual CollationElementIterator* createCollationElementIterator( 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UnicodeString& source) const; 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates a collation element iterator for the source. The caller of this 248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * method is responsible for the memory management of the returned pointer. 249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the CharacterIterator which produces the characters over 250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which the CollationElementItgerator will iterate. 251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the collation element iterator of the source using this as the 252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * based Collator. 253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual CollationElementIterator* createCollationElementIterator( 256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const CharacterIterator& source) const; 257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 25854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius // Make deprecated versions of Collator::compare() visible. 25954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius using Collator::compare; 260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The comparison function compares the character data stored in two 263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * different strings. Returns information about whether a string is less 264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than, greater than or equal to another string. 265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the source string to be compared with. 266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target the string that is to be compared with the source string. 267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status possible error code 268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Returns an enum value. UCOL_GREATER if source is greater 269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less 270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than target 271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru **/ 273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UCollationResult compare(const UnicodeString& source, 274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UnicodeString& target, 275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status) const; 276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Does the same thing as compare but limits the comparison to a specified 279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length 280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the source string to be compared with. 281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target the string that is to be compared with the source string. 282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length the length the comparison is limited to 283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status possible error code 284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Returns an enum value. UCOL_GREATER if source (up to the specified 285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length) is greater than target; UCOL_EQUAL if source (up to specified 286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length) is equal to target; UCOL_LESS if source (up to the specified 287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length) is less than target. 288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UCollationResult compare(const UnicodeString& source, 291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UnicodeString& target, 292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t length, 293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status) const; 294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The comparison function compares the character data stored in two 297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * different string arrays. Returns information about whether a string array 298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is less than, greater than or equal to another string array. 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the source string array to be compared with. 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength the length of the source string array. If this value 301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is equal to -1, the string array is null-terminated. 302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target the string that is to be compared with the source string. 303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param targetLength the length of the target string array. If this value 304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is equal to -1, the string array is null-terminated. 305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status possible error code 306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Returns an enum value. UCOL_GREATER if source is greater 307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less 308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than target 309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UCollationResult compare(const UChar* source, int32_t sourceLength, 312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar* target, int32_t targetLength, 313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status) const; 314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 316b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Compares two strings using the Collator. 317b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns whether the first one compares less than/equal to/greater than 318b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the second one. 319b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * This version takes UCharIterator input. 320b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param sIter the first ("source") string iterator 321b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param tIter the second ("target") string iterator 322b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param status ICU status 323b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER 32450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 325b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 326b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru virtual UCollationResult compare(UCharIterator &sIter, 327b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UCharIterator &tIter, 328b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode &status) const; 329b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 330b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru /** 331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Transforms a specified region of the string into a series of characters 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that can be compared with CollationKey.compare. Use a CollationKey when 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * you need to do repeated comparisions on the same string. For a single 334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * comparison the compare method will be faster. 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the source string. 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key the transformed key of the source string. 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the error code status. 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the transformed key. 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see CollationKey 34054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @stable ICU 2.0 341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual CollationKey& getCollationKey(const UnicodeString& source, 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru CollationKey& key, 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status) const; 345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Transforms a specified region of the string into a series of characters 348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that can be compared with CollationKey.compare. Use a CollationKey when 349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * you need to do repeated comparisions on the same string. For a single 350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * comparison the compare method will be faster. 351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the source string. 352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength the length of the source string. 353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key the transformed key of the source string. 354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the error code status. 355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the transformed key. 356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see CollationKey 35754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @stable ICU 2.0 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual CollationKey& getCollationKey(const UChar *source, 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t sourceLength, 361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru CollationKey& key, 362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status) const; 363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Generates the hash code for the rule-based collation object. 366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the hash code. 367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t hashCode(void) const; 370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the locale of the Collator 373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param type can be either requested, valid or actual locale. For more 374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * information see the definition of ULocDataLocaleType in 375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * uloc.h 376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the error code status. 377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return locale where the collation data lives. If the collator 378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * was instantiated from rules, locale is empty. 379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 likely to change in ICU 3.0, based on feedback 380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 38154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; 382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 38454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Gets the tailoring rules for this collator. 38554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return the collation tailoring from which this collator was created 386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UnicodeString& getRules(void) const; 389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the version information for a Collator. 392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param info the version # information, the result will be filled in 393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual void getVersion(UVersionInfo info) const; 396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 3978393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#ifndef U_HIDE_DEPRECATED_API 398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 3998393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * Returns the maximum length of any expansion sequences that end with the 400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * specified comparison order. 4018393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * 4028393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * This is specific to the kind of collation element values and sequences 4038393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * returned by the CollationElementIterator. 4048393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * Call CollationElementIterator::getMaxExpansion() instead. 4058393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * 4068393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param order a collation order returned by CollationElementIterator::previous 4078393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * or CollationElementIterator::next. 408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return maximum size of the expansion sequences ending with the collation 4098393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * element, or 1 if the collation element does not occur at the end of 410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * any expansion sequence 411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see CollationElementIterator#getMaxExpansion 4128393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @deprecated ICU 51 Use CollationElementIterator::getMaxExpansion() instead. 413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t getMaxExpansion(int32_t order) const; 4158393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * method is to implement a simple version of RTTI, since not all C++ 420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * compilers support genuine RTTI. Polymorphic operator==() and clone() 421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * methods call this method. 422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The class ID for this object. All objects of a given class have 423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the same class ID. Objects of other classes have different class 424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * IDs. 425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UClassID getDynamicClassID(void) const; 428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the class ID for this class. This is useful only for comparing to 431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a return value from getDynamicClassID(). For example: 432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <pre> 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Base* polymorphic_pointer = createPolymorphicObject(); 434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if (polymorphic_pointer->getDynamicClassID() == 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Derived::getStaticClassID()) ... 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </pre> 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The class ID for all objects of this class. 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(void); 441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the binary format of the class's rules. The format is that of 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * .col files. 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length Returns the length of the data, in bytes 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the error code status. 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return memory, owned by the caller, of size 'length' bytes. 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint8_t *cloneRuleData(int32_t &length, UErrorCode &status); 451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Creates a binary image of a collator. This binary image can be stored and 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * later used to instantiate a collator using ucol_openBinary. 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This API supports preflighting. 456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffer a fill-in buffer to receive the binary image 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param capacity capacity of the destination buffer 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status for catching errors 459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return size of the image 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openBinary 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.4 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t cloneBinary(uint8_t *buffer, int32_t capacity, UErrorCode &status); 464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns current rules. Delta defines whether full rules are returned or 467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * just the tailoring. 46854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 46954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * getRules(void) should normally be used instead. 47054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales 471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. 472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffer UnicodeString to store the result rules 473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 47454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @see UCOL_FULL_RULES 475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void getRules(UColRuleOption delta, UnicodeString &buffer); 477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Universal attribute setter 480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param attr attribute type 481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param value attribute value 482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to indicate whether the operation went on smoothly or there were errors 483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual void setAttribute(UColAttribute attr, UColAttributeValue value, 486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status); 487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Universal attribute getter. 490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param attr attribute type 491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to indicate whether the operation went on smoothly or there were errors 492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return attribute value 493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UColAttributeValue getAttribute(UColAttribute attr, 49654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the variable top to a collation element value of a string supplied. 500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param varTop one or more (if contraction) UChars to which the variable top should be set 501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len length of variable top string. If -1 it is considered to be zero terminated. 502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> 503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br> 504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes 505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined 506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status); 509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the variable top to a collation element value of a string supplied. 512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param varTop an UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set 513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> 514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br> 515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes 516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined 517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 518b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 51954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status); 520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits. 523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Lower 16 bits are ignored. 524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param varTop CE value, as returned by setVariableTop or ucol)getVariableTop 525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code (not changed by function) 526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 52854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual void setVariableTop(uint32_t varTop, UErrorCode &status); 529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the variable top value of a Collator. 532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Lower 16 bits are undefined and should be ignored. 533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code (not changed by function). If error code is set, the return value is undefined. 534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual uint32_t getVariableTop(UErrorCode &status) const; 537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get an UnicodeSet that contains all the characters and sequences tailored in 540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this collator. 541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code of the operation 542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a UnicodeSet object containing all the 543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * code points and sequences that may sort differently than 544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the UCA. The object must be disposed of by using delete 545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UnicodeSet *getTailoredSet(UErrorCode &status) const; 548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get the sort key as an array of bytes from an UnicodeString. 551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source string to be processed. 552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result buffer to store result in. If NULL, number of bytes needed 553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be returned. 554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength length of the result buffer. If if not enough the 555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer will be filled to capacity. 556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Number of bytes needed for storing the sort key 557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getSortKey(const UnicodeString& source, uint8_t *result, 560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t resultLength) const; 561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get the sort key as an array of bytes from an UChar buffer. 564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source string to be processed. 565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength length of string to be processed. If -1, the string 566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is 0 terminated and length will be decided by the function. 567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result buffer to store result in. If NULL, number of bytes needed 568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be returned. 569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength length of the result buffer. If if not enough the 570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer will be filled to capacity. 571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Number of bytes needed for storing the sort key 572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getSortKey(const UChar *source, int32_t sourceLength, 575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint8_t *result, int32_t resultLength) const; 576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 578b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Retrieves the reordering codes for this collator. 57927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest The array to fill with the script ordering. 580b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function 581b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * will only return the length of the result without writing any of the result string (pre-flighting). 582b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A reference to an error code value, which must not indicate 583b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * a failure before the function call. 584b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The length of the script ordering array. 585b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_setReorderCodes 586b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#getEquivalentReorderCodes 587b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#setReorderCodes 588103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 58927f654740f2a26ad62a5c155af9199af9e69b889claireho */ 59054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual int32_t getReorderCodes(int32_t *dest, 59154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius int32_t destCapacity, 59254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode& status) const; 59327f654740f2a26ad62a5c155af9199af9e69b889claireho 59427f654740f2a26ad62a5c155af9199af9e69b889claireho /** 595b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Sets the ordering of scripts for this collator. 596b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param reorderCodes An array of script codes in the new order. This can be NULL if the 597b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * length is also set to 0. An empty array will clear any reordering codes on the collator. 59827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param reorderCodesLength The length of reorderCodes. 599b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status error code 600b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#getReorderCodes 601b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#getEquivalentReorderCodes 602103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 603b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 60454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual void setReorderCodes(const int32_t* reorderCodes, 60554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius int32_t reorderCodesLength, 60654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode& status) ; 607b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 608b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho /** 609b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder 610b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * codes will be grouped and must reorder together. 611b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param reorderCode The reorder code to determine equivalence for. 612b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param dest The array to fill with the script equivalene reordering codes. 613b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the 614b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * function will only return the length of the result without writing any of the result 615b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * string (pre-flighting). 616b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A reference to an error code value, which must not indicate 617b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * a failure before the function call. 618b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The length of the of the reordering code equivalence array. 61927f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ucol_setReorderCodes 620b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#getReorderCodes 621b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see Collator#setReorderCodes 622103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 62327f654740f2a26ad62a5c155af9199af9e69b889claireho */ 624b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static int32_t U_EXPORT2 getEquivalentReorderCodes(int32_t reorderCode, 625b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho int32_t* dest, 626b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho int32_t destCapacity, 627b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UErrorCode& status); 62827f654740f2a26ad62a5c155af9199af9e69b889claireho 629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprivate: 630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // private static constants ----------------------------------------------- 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru enum { 634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* need look up in .commit() */ 635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru CHARINDEX = 0x70000000, 636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* Expand index follows */ 637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru EXPANDCHARINDEX = 0x7E000000, 638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* contract indexes follows */ 639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru CONTRACTCHARINDEX = 0x7F000000, 640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* unmapped character values */ 641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNMAPPED = 0xFFFFFFFF, 642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* primary strength increment */ 643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMARYORDERINCREMENT = 0x00010000, 644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* secondary strength increment */ 645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru SECONDARYORDERINCREMENT = 0x00000100, 646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* tertiary strength increment */ 647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TERTIARYORDERINCREMENT = 0x00000001, 648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* mask off anything but primary order */ 649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMARYORDERMASK = 0xffff0000, 650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* mask off anything but secondary order */ 651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru SECONDARYORDERMASK = 0x0000ff00, 652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* mask off anything but tertiary order */ 653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TERTIARYORDERMASK = 0x000000ff, 654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* mask off ignorable char order */ 655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru IGNORABLEMASK = 0x0000ffff, 656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* use only the primary difference */ 657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMARYDIFFERENCEONLY = 0xffff0000, 658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* use only the primary and secondary difference */ 659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru SECONDARYDIFFERENCEONLY = 0xffffff00, 660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* primary order shift */ 661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMARYORDERSHIFT = 16, 662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* secondary order shift */ 663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru SECONDARYORDERSHIFT = 8, 664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* starting value for collation elements */ 665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru COLELEMENTSTART = 0x02020202, 666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* testing mask for primary low element */ 667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMARYLOWZEROMASK = 0x00FF0000, 668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* reseting value for secondaries and tertiaries */ 669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RESETSECONDARYTERTIARY = 0x00000202, 670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /* reseting value for tertiaries */ 671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RESETTERTIARY = 0x00000002, 672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru PRIMIGNORABLE = 0x0202 674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru }; 675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // private data members --------------------------------------------------- 677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool dataIsOwned; 679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool isWriteThroughAlias; 681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * c struct for collation. All initialisation for it has to be done through 684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * setUCollator(). 685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UCollator *ucollator; 687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Rule UnicodeString 690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString urulestring; 692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // friend classes -------------------------------------------------------- 694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Used to iterate over collation elements in a character source. 697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru friend class CollationElementIterator; 699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Collator ONLY needs access to RuleBasedCollator(const Locale&, 702b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UErrorCode&) 703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru friend class Collator; 705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Searching over collation elements in a character source 708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru friend class StringSearch; 710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // private constructors -------------------------------------------------- 712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Default constructor 715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(); 717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RuleBasedCollator constructor. This constructor takes a locale. The 720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only caller of this class should be Collator::createInstance(). If 721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * createInstance() happens to know that the requested locale's collation is 722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * implemented as a RuleBasedCollator, it can then call this constructor. 723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * OTHERWISE IT SHOULDN'T, since this constructor ALWAYS RETURNS A VALID 724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * COLLATION TABLE. It does this by falling back to defaults. 725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param desiredLocale locale used 726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code status 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RuleBasedCollator(const Locale& desiredLocale, UErrorCode& status); 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * common constructor implementation 732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules the collation rules to build the collation table from. 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param collationStrength default strength for comparison 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param decompositionMode the normalisation mode 736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status reporting a success or an error. 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru construct(const UnicodeString& rules, 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UColAttributeValue collationStrength, 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UColAttributeValue decompositionMode, 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status); 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // private methods ------------------------------------------------------- 745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates the c struct for ucollator 748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale desired locale 749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error status 750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void setUCollator(const Locale& locale, UErrorCode& status); 752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates the c struct for ucollator 755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale desired locale name 756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error status 757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void setUCollator(const char* locale, UErrorCode& status); 759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates the c struct for ucollator. This used internally by StringSearch. 762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Hence the responsibility of cleaning up the ucollator is not done by 763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this RuleBasedCollator. The isDataOwned flag is set to FALSE. 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param collator new ucollator data 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void setUCollator(UCollator *collator); 767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querupublic: 769103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get UCollator data struct. Used only by StringSearch & intltest. 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return UCollator data struct 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @internal 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UCollator * getUCollator(); 776103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprotected: 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Used internally by registraton to define the requested and valid locales. 781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param requestedLocale the requsted locale 782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param validLocale the valid locale 783c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param actualLocale the actual locale 784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @internal 785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 786c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale); 787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprivate: 789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // if not owned and not a write through alias, copy the ucollator 790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void checkOwned(void); 791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru // utility to init rule string used by checkOwned and construct 793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void setRuleStringFromCollator(); 794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 79554dcd9b6a06071f647dac967e9e267abb9410720Craig Corneliuspublic: 796103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /** Get the short definition string for a collator. This internal API harvests the collator's 797103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * locale and the attribute set and produces a string that can be used for opening 798103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * a collator with the same properties using the ucol_openFromShortString API. 799103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * This string will be normalized. 800103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * The structure and the syntax of the string is defined in the "Naming collators" 801103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * section of the users guide: 802103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators 803103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * This function supports preflighting. 804103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 805103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * This is internal, and intended to be used with delegate converters. 806103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 807103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param locale a locale that will appear as a collators locale in the resulting 808103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * short string definition. If NULL, the locale will be harvested 809103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * from the collator. 810103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param buffer space to hold the resulting string 811103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param capacity capacity of the buffer 812103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param status for returning errors. All the preflighting errors are featured 813103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return length of the resulting string 814103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see ucol_openFromShortString 815103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see ucol_normalizeShortDefinitionString 816103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see ucol_getShortDefinitionString 817103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @internal 818103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 819103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius virtual int32_t internalGetShortDefinitionString(const char *locale, 820103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius char *buffer, 821103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius int32_t capacity, 822103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius UErrorCode &status) const; 823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}; 824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru// inline method implementation --------------------------------------------- 826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruinline void RuleBasedCollator::setUCollator(const Locale &locale, 828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode &status) 829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru setUCollator(locale.getName(), status); 831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruinline void RuleBasedCollator::setUCollator(UCollator *collator) 835b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru if (ucollator && dataIsOwned) { 838b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ucol_close(ucollator); 839b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru } 840b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ucollator = collator; 841b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru dataIsOwned = FALSE; 842b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru isWriteThroughAlias = TRUE; 843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru setRuleStringFromCollator(); 844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruinline const UCollator * RuleBasedCollator::getUCollator() 847b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return ucollator; 849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 850b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 851b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_END 852b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 855b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 856