1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************* 3fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* Copyright (C) 2001-2014, International Business Machines 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************* 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 7fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* File ucoleitr.h 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History: 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 02/15/2001 synwee Modified all methods to process its own function 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* instead of calling the equivalent c++ api (coleitr.h) 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*******************************************************************************/ 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef UCOLEITR_H 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define UCOLEITR_H 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This indicates an error has occured during processing or if no more CEs is 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to be returned. 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define UCOL_NULLORDER ((int32_t)0xFFFFFFFF) 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/ucol.h" 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The UCollationElements struct. 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For usage in C programs. 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querutypedef struct UCollationElements UCollationElements; 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C API: UCollationElements 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The UCollationElements API is used as an iterator to walk through each 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character of an international string. Use the iterator to return the 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ordering priority of the positioned character. The ordering priority of a 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character, which we refer to as a key, defines how a character is collated 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in the given collation object. 48fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * For example, consider the following in Slovak and in traditional Spanish collation: 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . "ca" -> the first key is key('c') and second key is key('a'). 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . "cha" -> the first key is key('ch') and second key is key('a'). 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 53fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * And in German phonebook collation, 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . "<ae ligature>b"-> the first key is key('a'), the second key is key('e'), and 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . the third key is key('b'). 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Example of the iterator usage: (without error checking) 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . void CollationElementIterator_Example() 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . { 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . UChar *s; 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . t_int32 order, primaryOrder; 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . UCollationElements *c; 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . UCollatorOld *coll; 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . UErrorCode success = U_ZERO_ERROR; 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) ); 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . u_uastrcpy(s, "This is a test"); 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . coll = ucol_open(NULL, &success); 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . c = ucol_openElements(coll, str, u_strlen(str), &status); 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . order = ucol_next(c, &success); 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . ucol_reset(c); 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . order = ucol_prev(c, &success); 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . free(s); 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . ucol_close(coll); 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . ucol_closeElements(c); 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . } 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p> 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ucol_next() returns the collation order of the next. 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ucol_prev() returns the collation order of the previous character. 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The Collation Element Iterator moves only in one direction between calls to 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ucol_reset. That is, ucol_next() and ucol_prev can not be inter-used. 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Whenever ucol_prev is to be called after ucol_next() or vice versa, 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ucol_reset has to be called first to reset the status, shifting pointers to 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * either the end or the start of the string. Hence at the next call of 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ucol_prev or ucol_next, the first or last collation order will be returned. 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If a change of direction is done without a ucol_reset, the result is 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * undefined. 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The result of a forward iterate (ucol_next) and reversed result of the 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * backward iterate (ucol_prev) on the same string are equivalent, if 92fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * collation orders with the value 0 are ignored. 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Character based on the comparison level of the collator. A collation order 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * consists of primary order, secondary order and tertiary order. The data 95fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * type of the collation order is <strong>int32_t</strong>. 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see UCollator 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Open the collation elements for a string. 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param coll The collator containing the desired collation rules. 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The text to iterate over. 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param textLength The number of characters in text, or -1 if null-terminated 106fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors. 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a struct containing collation element information 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE UCollationElements* U_EXPORT2 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_openElements(const UCollator *coll, 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UChar *text, 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t textLength, 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode *status); 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 11685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * get a hash code for a key... Not very useful! 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param key the given key. 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param length the size of the key array. 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the hash code. 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_keyHashCode(const uint8_t* key, int32_t length); 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Close a UCollationElements. 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Once closed, a UCollationElements may no longer be used. 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements to close. 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE void U_EXPORT2 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_closeElements(UCollationElements *elems); 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Reset the collation elements to their initial state. 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This will move the 'cursor' to the beginning of the text. 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Property settings for collation will be reset to the current status. 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements to reset. 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see ucol_next 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see ucol_previous 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE void U_EXPORT2 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_reset(UCollationElements *elems); 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 14885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho/** 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the ordering priority of the next collation element in the text. 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A single character may contain more than one collation element. 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements containing the text. 152fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors. 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The next collation elements ordering, otherwise returns NULLORDER 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if an error has occured or if the end of string has been reached 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_next(UCollationElements *elems, UErrorCode *status); 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the ordering priority of the previous collation element in the text. 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A single character may contain more than one collation element. 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note that internally a stack is used to store buffered collation elements. 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements containing the text. 165fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors. Noteably 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * buffer has been exhausted. 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The previous collation elements ordering, otherwise returns 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * NULLORDER if an error has occured or if the start of string has 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * been reached. 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_previous(UCollationElements *elems, UErrorCode *status); 17585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the maximum length of any expansion sequences that end with the 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specified comparison order. 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is useful for .... ? 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements containing the text. 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param order A collation order returned by previous or next. 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return maximum size of the expansion sequences ending with the collation 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * element or 1 if collation element does not occur at the end of any 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * expansion sequence 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_getMaxExpansion(const UCollationElements *elems, int32_t order); 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the text containing the collation elements. 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Property settings for collation will remain the same. 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In order to reset the iterator to the current collation property settings, 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the API reset() has to be called. 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements to set. 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The source text containing the collation elements. 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param textLength The length of text, or -1 if null-terminated. 198fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors. 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see ucol_getText 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE void U_EXPORT2 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_setText( UCollationElements *elems, 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UChar *text, 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t textLength, 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode *status); 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the offset of the current source character. 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is an offset into the text of the character containing the current 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * collation elements. 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements to query. 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The offset of the current source character. 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see ucol_setOffset 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_getOffset(const UCollationElements *elems); 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the offset of the current source character. 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is an offset into the text of the character to be processed. 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Property settings for collation will remain the same. 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In order to reset the iterator to the current collation property settings, 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the API reset() has to be called. 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param elems The UCollationElements to set. 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param offset The desired character offset. 228fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors. 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see ucol_getOffset 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE void U_EXPORT2 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_setOffset(UCollationElements *elems, 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t offset, 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode *status); 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Get the primary order of a collation order. 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @param order the collation order 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @return the primary order of a collation order. 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @stable ICU 2.6 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_primaryOrder (int32_t order); 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Get the secondary order of a collation order. 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @param order the collation order 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @return the secondary order of a collation order. 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @stable ICU 2.6 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_secondaryOrder (int32_t order); 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Get the tertiary order of a collation order. 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @param order the collation order 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @return the tertiary order of a collation order. 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* @stable ICU 2.6 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruucol_tertiaryOrder (int32_t order); 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 267