intl/icu/source/i18n/unicode/utrans.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/unicode/utrans.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,607 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*   Copyright (C) 1997-2011, International Business Machines
     1.7 +*   Corporation and others.  All Rights Reserved.
     1.8 +*******************************************************************************
     1.9 +*   Date        Name        Description
    1.10 +*   06/21/00    aliu        Creation.
    1.11 +*******************************************************************************
    1.12 +*/
    1.13 +
    1.14 +#ifndef UTRANS_H
    1.15 +#define UTRANS_H
    1.16 +
    1.17 +#include "unicode/utypes.h"
    1.18 +
    1.19 +#if !UCONFIG_NO_TRANSLITERATION
    1.20 +
    1.21 +#include "unicode/localpointer.h"
    1.22 +#include "unicode/urep.h"
    1.23 +#include "unicode/parseerr.h"
    1.24 +#include "unicode/uenum.h"
    1.25 +
    1.26 +/********************************************************************
    1.27 + * General Notes
    1.28 + ********************************************************************
    1.29 + */
    1.30 +/**
    1.31 + * \file
    1.32 + * \brief C API: Transliterator
    1.33 + *
    1.34 + * <h2> Transliteration </h2>
    1.35 + * The data structures and functions described in this header provide
    1.36 + * transliteration services.  Transliteration services are implemented
    1.37 + * as C++ classes.  The comments and documentation in this header
    1.38 + * assume the reader is familiar with the C++ headers translit.h and
    1.39 + * associated documentation.
    1.40 + *
    1.41 + * A significant but incomplete subset of the C++ transliteration
    1.42 + * services are available to C code through this header.  In order to
    1.43 + * access more complex transliteration services, refer to the C++
    1.44 + * headers and documentation.
    1.45 + *
    1.46 + * There are two sets of functions for working with transliterator IDs:
    1.47 + *
    1.48 + * An old, deprecated set uses char * IDs, which works for true and pure
    1.49 + * identifiers that these APIs were designed for,
    1.50 + * for example "Cyrillic-Latin".
    1.51 + * It does not work when the ID contains filters ("[:Script=Cyrl:]")
    1.52 + * or even a complete set of rules because then the ID string contains more
    1.53 + * than just "invariant" characters (see utypes.h).
    1.54 + *
    1.55 + * A new set of functions replaces the old ones and uses UChar * IDs,
    1.56 + * paralleling the UnicodeString IDs in the C++ API. (New in ICU 2.8.)
    1.57 + */
    1.58 +
    1.59 +/********************************************************************
    1.60 + * Data Structures
    1.61 + ********************************************************************/
    1.62 +
    1.63 +/**
    1.64 + * An opaque transliterator for use in C.  Open with utrans_openxxx()
    1.65 + * and close with utrans_close() when done.  Equivalent to the C++ class
    1.66 + * Transliterator and its subclasses.
    1.67 + * @see Transliterator
    1.68 + * @stable ICU 2.0
    1.69 + */
    1.70 +typedef void* UTransliterator;
    1.71 +
    1.72 +/**
    1.73 + * Direction constant indicating the direction in a transliterator,
    1.74 + * e.g., the forward or reverse rules of a RuleBasedTransliterator.
    1.75 + * Specified when a transliterator is opened.  An "A-B" transliterator
    1.76 + * transliterates A to B when operating in the forward direction, and
    1.77 + * B to A when operating in the reverse direction.
    1.78 + * @stable ICU 2.0
    1.79 + */
    1.80 +typedef enum UTransDirection {
    1.81 +    
    1.82 +    /**
    1.83 +     * UTRANS_FORWARD means from &lt;source&gt; to &lt;target&gt; for a
    1.84 +     * transliterator with ID &lt;source&gt;-&lt;target&gt;.  For a transliterator
    1.85 +     * opened using a rule, it means forward direction rules, e.g.,
    1.86 +     * "A > B".
    1.87 +     */
    1.88 +    UTRANS_FORWARD,
    1.89 +
    1.90 +    /**
    1.91 +     * UTRANS_REVERSE means from &lt;target&gt; to &lt;source&gt; for a
    1.92 +     * transliterator with ID &lt;source&gt;-&lt;target&gt;.  For a transliterator
    1.93 +     * opened using a rule, it means reverse direction rules, e.g.,
    1.94 +     * "A < B".
    1.95 +     */
    1.96 +    UTRANS_REVERSE
    1.97 +
    1.98 +} UTransDirection;
    1.99 +
   1.100 +/**
   1.101 + * Position structure for utrans_transIncremental() incremental
   1.102 + * transliteration.  This structure defines two substrings of the text
   1.103 + * being transliterated.  The first region, [contextStart,
   1.104 + * contextLimit), defines what characters the transliterator will read
   1.105 + * as context.  The second region, [start, limit), defines what
   1.106 + * characters will actually be transliterated.  The second region
   1.107 + * should be a subset of the first.
   1.108 + *
   1.109 + * <p>After a transliteration operation, some of the indices in this
   1.110 + * structure will be modified.  See the field descriptions for
   1.111 + * details.
   1.112 + *
   1.113 + * <p>contextStart <= start <= limit <= contextLimit
   1.114 + *
   1.115 + * <p>Note: All index values in this structure must be at code point
   1.116 + * boundaries.  That is, none of them may occur between two code units
   1.117 + * of a surrogate pair.  If any index does split a surrogate pair,
   1.118 + * results are unspecified.
   1.119 + *
   1.120 + * @stable ICU 2.0
   1.121 + */
   1.122 +typedef struct UTransPosition {
   1.123 +
   1.124 +    /**
   1.125 +     * Beginning index, inclusive, of the context to be considered for
   1.126 +     * a transliteration operation.  The transliterator will ignore
   1.127 +     * anything before this index.  INPUT/OUTPUT parameter: This parameter
   1.128 +     * is updated by a transliteration operation to reflect the maximum
   1.129 +     * amount of antecontext needed by a transliterator.
   1.130 +     * @stable ICU 2.4
   1.131 +     */
   1.132 +    int32_t contextStart;
   1.133 +    
   1.134 +    /**
   1.135 +     * Ending index, exclusive, of the context to be considered for a
   1.136 +     * transliteration operation.  The transliterator will ignore
   1.137 +     * anything at or after this index.  INPUT/OUTPUT parameter: This
   1.138 +     * parameter is updated to reflect changes in the length of the
   1.139 +     * text, but points to the same logical position in the text.
   1.140 +     * @stable ICU 2.4
   1.141 +     */
   1.142 +    int32_t contextLimit;
   1.143 +    
   1.144 +    /**
   1.145 +     * Beginning index, inclusive, of the text to be transliteratd.
   1.146 +     * INPUT/OUTPUT parameter: This parameter is advanced past
   1.147 +     * characters that have already been transliterated by a
   1.148 +     * transliteration operation.
   1.149 +     * @stable ICU 2.4
   1.150 +     */
   1.151 +    int32_t start;
   1.152 +    
   1.153 +    /**
   1.154 +     * Ending index, exclusive, of the text to be transliteratd.
   1.155 +     * INPUT/OUTPUT parameter: This parameter is updated to reflect
   1.156 +     * changes in the length of the text, but points to the same
   1.157 +     * logical position in the text.
   1.158 +     * @stable ICU 2.4
   1.159 +     */
   1.160 +    int32_t limit;
   1.161 +
   1.162 +} UTransPosition;
   1.163 +
   1.164 +/********************************************************************
   1.165 + * General API
   1.166 + ********************************************************************/
   1.167 +
   1.168 +/**
   1.169 + * Open a custom transliterator, given a custom rules string 
   1.170 + * OR 
   1.171 + * a system transliterator, given its ID.  
   1.172 + * Any non-NULL result from this function should later be closed with
   1.173 + * utrans_close().
   1.174 + *
   1.175 + * @param id a valid transliterator ID
   1.176 + * @param idLength the length of the ID string, or -1 if NUL-terminated
   1.177 + * @param dir the desired direction
   1.178 + * @param rules the transliterator rules.  See the C++ header rbt.h for
   1.179 + *              rules syntax. If NULL then a system transliterator matching
   1.180 + *              the ID is returned.
   1.181 + * @param rulesLength the length of the rules, or -1 if the rules
   1.182 + *                    are NUL-terminated.
   1.183 + * @param parseError a pointer to a UParseError struct to receive the details
   1.184 + *                   of any parsing errors. This parameter may be NULL if no
   1.185 + *                   parsing error details are desired.
   1.186 + * @param pErrorCode a pointer to the UErrorCode
   1.187 + * @return a transliterator pointer that may be passed to other
   1.188 + *         utrans_xxx() functions, or NULL if the open call fails.
   1.189 + * @stable ICU 2.8
   1.190 + */
   1.191 +U_STABLE UTransliterator* U_EXPORT2
   1.192 +utrans_openU(const UChar *id,
   1.193 +             int32_t idLength,
   1.194 +             UTransDirection dir,
   1.195 +             const UChar *rules,
   1.196 +             int32_t rulesLength,
   1.197 +             UParseError *parseError,
   1.198 +             UErrorCode *pErrorCode);
   1.199 +
   1.200 +/**
   1.201 + * Open an inverse of an existing transliterator.  For this to work,
   1.202 + * the inverse must be registered with the system.  For example, if
   1.203 + * the Transliterator "A-B" is opened, and then its inverse is opened,
   1.204 + * the result is the Transliterator "B-A", if such a transliterator is
   1.205 + * registered with the system.  Otherwise the result is NULL and a
   1.206 + * failing UErrorCode is set.  Any non-NULL result from this function
   1.207 + * should later be closed with utrans_close().
   1.208 + *
   1.209 + * @param trans the transliterator to open the inverse of.
   1.210 + * @param status a pointer to the UErrorCode
   1.211 + * @return a pointer to a newly-opened transliterator that is the
   1.212 + * inverse of trans, or NULL if the open call fails.
   1.213 + * @stable ICU 2.0
   1.214 + */
   1.215 +U_STABLE UTransliterator* U_EXPORT2 
   1.216 +utrans_openInverse(const UTransliterator* trans,
   1.217 +                   UErrorCode* status);
   1.218 +
   1.219 +/**
   1.220 + * Create a copy of a transliterator.  Any non-NULL result from this
   1.221 + * function should later be closed with utrans_close().
   1.222 + *
   1.223 + * @param trans the transliterator to be copied.
   1.224 + * @param status a pointer to the UErrorCode
   1.225 + * @return a transliterator pointer that may be passed to other
   1.226 + * utrans_xxx() functions, or NULL if the clone call fails.
   1.227 + * @stable ICU 2.0
   1.228 + */
   1.229 +U_STABLE UTransliterator* U_EXPORT2 
   1.230 +utrans_clone(const UTransliterator* trans,
   1.231 +             UErrorCode* status);
   1.232 +
   1.233 +/**
   1.234 + * Close a transliterator.  Any non-NULL pointer returned by
   1.235 + * utrans_openXxx() or utrans_clone() should eventually be closed.
   1.236 + * @param trans the transliterator to be closed.
   1.237 + * @stable ICU 2.0
   1.238 + */
   1.239 +U_STABLE void U_EXPORT2 
   1.240 +utrans_close(UTransliterator* trans);
   1.241 +
   1.242 +#if U_SHOW_CPLUSPLUS_API
   1.243 +
   1.244 +U_NAMESPACE_BEGIN
   1.245 +
   1.246 +/**
   1.247 + * \class LocalUTransliteratorPointer
   1.248 + * "Smart pointer" class, closes a UTransliterator via utrans_close().
   1.249 + * For most methods see the LocalPointerBase base class.
   1.250 + *
   1.251 + * @see LocalPointerBase
   1.252 + * @see LocalPointer
   1.253 + * @stable ICU 4.4
   1.254 + */
   1.255 +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
   1.256 +
   1.257 +U_NAMESPACE_END
   1.258 +
   1.259 +#endif
   1.260 +
   1.261 +/**
   1.262 + * Return the programmatic identifier for this transliterator.
   1.263 + * If this identifier is passed to utrans_openU(), it will open
   1.264 + * a transliterator equivalent to this one, if the ID has been
   1.265 + * registered.
   1.266 + *
   1.267 + * @param trans the transliterator to return the ID of.
   1.268 + * @param resultLength pointer to an output variable receiving the length
   1.269 + *        of the ID string; can be NULL
   1.270 + * @return the NUL-terminated ID string. This pointer remains
   1.271 + * valid until utrans_close() is called on this transliterator.
   1.272 + *
   1.273 + * @stable ICU 2.8
   1.274 + */
   1.275 +U_STABLE const UChar * U_EXPORT2
   1.276 +utrans_getUnicodeID(const UTransliterator *trans,
   1.277 +                    int32_t *resultLength);
   1.278 +
   1.279 +/**
   1.280 + * Register an open transliterator with the system.  When
   1.281 + * utrans_open() is called with an ID string that is equal to that
   1.282 + * returned by utrans_getID(adoptedTrans,...), then
   1.283 + * utrans_clone(adoptedTrans,...) is returned.
   1.284 + *
   1.285 + * <p>NOTE: After this call the system owns the adoptedTrans and will
   1.286 + * close it.  The user must not call utrans_close() on adoptedTrans.
   1.287 + *
   1.288 + * @param adoptedTrans a transliterator, typically the result of
   1.289 + * utrans_openRules(), to be registered with the system.
   1.290 + * @param status a pointer to the UErrorCode
   1.291 + * @stable ICU 2.0
   1.292 + */
   1.293 +U_STABLE void U_EXPORT2 
   1.294 +utrans_register(UTransliterator* adoptedTrans,
   1.295 +                UErrorCode* status);
   1.296 +
   1.297 +/**
   1.298 + * Unregister a transliterator from the system.  After this call the
   1.299 + * system will no longer recognize the given ID when passed to
   1.300 + * utrans_open(). If the ID is invalid then nothing is done.
   1.301 + *
   1.302 + * @param id an ID to unregister
   1.303 + * @param idLength the length of id, or -1 if id is zero-terminated
   1.304 + * @stable ICU 2.8
   1.305 + */
   1.306 +U_STABLE void U_EXPORT2
   1.307 +utrans_unregisterID(const UChar* id, int32_t idLength);
   1.308 +
   1.309 +/**
   1.310 + * Set the filter used by a transliterator.  A filter can be used to
   1.311 + * make the transliterator pass certain characters through untouched.
   1.312 + * The filter is expressed using a UnicodeSet pattern.  If the
   1.313 + * filterPattern is NULL or the empty string, then the transliterator
   1.314 + * will be reset to use no filter.
   1.315 + *
   1.316 + * @param trans the transliterator
   1.317 + * @param filterPattern a pattern string, in the form accepted by
   1.318 + * UnicodeSet, specifying which characters to apply the
   1.319 + * transliteration to.  May be NULL or the empty string to indicate no
   1.320 + * filter.
   1.321 + * @param filterPatternLen the length of filterPattern, or -1 if
   1.322 + * filterPattern is zero-terminated
   1.323 + * @param status a pointer to the UErrorCode
   1.324 + * @see UnicodeSet
   1.325 + * @stable ICU 2.0
   1.326 + */
   1.327 +U_STABLE void U_EXPORT2 
   1.328 +utrans_setFilter(UTransliterator* trans,
   1.329 +                 const UChar* filterPattern,
   1.330 +                 int32_t filterPatternLen,
   1.331 +                 UErrorCode* status);
   1.332 +
   1.333 +/**
   1.334 + * Return the number of system transliterators.
   1.335 + * It is recommended to use utrans_openIDs() instead.
   1.336 + *
   1.337 + * @return the number of system transliterators.
   1.338 + * @stable ICU 2.0
   1.339 + */
   1.340 +U_STABLE int32_t U_EXPORT2 
   1.341 +utrans_countAvailableIDs(void);
   1.342 +
   1.343 +/**
   1.344 + * Return a UEnumeration for the available transliterators.
   1.345 + *
   1.346 + * @param pErrorCode Pointer to the UErrorCode in/out parameter.
   1.347 + * @return UEnumeration for the available transliterators.
   1.348 + *         Close with uenum_close().
   1.349 + *
   1.350 + * @stable ICU 2.8
   1.351 + */
   1.352 +U_STABLE UEnumeration * U_EXPORT2
   1.353 +utrans_openIDs(UErrorCode *pErrorCode);
   1.354 +
   1.355 +/********************************************************************
   1.356 + * Transliteration API
   1.357 + ********************************************************************/
   1.358 +
   1.359 +/**
   1.360 + * Transliterate a segment of a UReplaceable string.  The string is
   1.361 + * passed in as a UReplaceable pointer rep and a UReplaceableCallbacks
   1.362 + * function pointer struct repFunc.  Functions in the repFunc struct
   1.363 + * will be called in order to modify the rep string.
   1.364 + *
   1.365 + * @param trans the transliterator
   1.366 + * @param rep a pointer to the string.  This will be passed to the
   1.367 + * repFunc functions.
   1.368 + * @param repFunc a set of function pointers that will be used to
   1.369 + * modify the string pointed to by rep.
   1.370 + * @param start the beginning index, inclusive; <code>0 <= start <=
   1.371 + * limit</code>.
   1.372 + * @param limit pointer to the ending index, exclusive; <code>start <=
   1.373 + * limit <= repFunc->length(rep)</code>.  Upon return, *limit will
   1.374 + * contain the new limit index.  The text previously occupying
   1.375 + * <code>[start, limit)</code> has been transliterated, possibly to a
   1.376 + * string of a different length, at <code>[start,
   1.377 + * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
   1.378 + * is the return value.
   1.379 + * @param status a pointer to the UErrorCode
   1.380 + * @stable ICU 2.0
   1.381 + */
   1.382 +U_STABLE void U_EXPORT2 
   1.383 +utrans_trans(const UTransliterator* trans,
   1.384 +             UReplaceable* rep,
   1.385 +             UReplaceableCallbacks* repFunc,
   1.386 +             int32_t start,
   1.387 +             int32_t* limit,
   1.388 +             UErrorCode* status);
   1.389 +
   1.390 +/**
   1.391 + * Transliterate the portion of the UReplaceable text buffer that can
   1.392 + * be transliterated unambiguosly.  This method is typically called
   1.393 + * after new text has been inserted, e.g. as a result of a keyboard
   1.394 + * event.  The transliterator will try to transliterate characters of
   1.395 + * <code>rep</code> between <code>index.cursor</code> and
   1.396 + * <code>index.limit</code>.  Characters before
   1.397 + * <code>index.cursor</code> will not be changed.
   1.398 + *
   1.399 + * <p>Upon return, values in <code>index</code> will be updated.
   1.400 + * <code>index.start</code> will be advanced to the first
   1.401 + * character that future calls to this method will read.
   1.402 + * <code>index.cursor</code> and <code>index.limit</code> will
   1.403 + * be adjusted to delimit the range of text that future calls to
   1.404 + * this method may change.
   1.405 + *
   1.406 + * <p>Typical usage of this method begins with an initial call
   1.407 + * with <code>index.start</code> and <code>index.limit</code>
   1.408 + * set to indicate the portion of <code>text</code> to be
   1.409 + * transliterated, and <code>index.cursor == index.start</code>.
   1.410 + * Thereafter, <code>index</code> can be used without
   1.411 + * modification in future calls, provided that all changes to
   1.412 + * <code>text</code> are made via this method.
   1.413 + *
   1.414 + * <p>This method assumes that future calls may be made that will
   1.415 + * insert new text into the buffer.  As a result, it only performs
   1.416 + * unambiguous transliterations.  After the last call to this method,
   1.417 + * there may be untransliterated text that is waiting for more input
   1.418 + * to resolve an ambiguity.  In order to perform these pending
   1.419 + * transliterations, clients should call utrans_trans() with a start
   1.420 + * of index.start and a limit of index.end after the last call to this
   1.421 + * method has been made.
   1.422 + *
   1.423 + * @param trans the transliterator
   1.424 + * @param rep a pointer to the string.  This will be passed to the
   1.425 + * repFunc functions.
   1.426 + * @param repFunc a set of function pointers that will be used to
   1.427 + * modify the string pointed to by rep.
   1.428 + * @param pos a struct containing the start and limit indices of the
   1.429 + * text to be read and the text to be transliterated
   1.430 + * @param status a pointer to the UErrorCode
   1.431 + * @stable ICU 2.0
   1.432 + */
   1.433 +U_STABLE void U_EXPORT2 
   1.434 +utrans_transIncremental(const UTransliterator* trans,
   1.435 +                        UReplaceable* rep,
   1.436 +                        UReplaceableCallbacks* repFunc,
   1.437 +                        UTransPosition* pos,
   1.438 +                        UErrorCode* status);
   1.439 +
   1.440 +/**
   1.441 + * Transliterate a segment of a UChar* string.  The string is passed
   1.442 + * in in a UChar* buffer.  The string is modified in place.  If the
   1.443 + * result is longer than textCapacity, it is truncated.  The actual
   1.444 + * length of the result is returned in *textLength, if textLength is
   1.445 + * non-NULL. *textLength may be greater than textCapacity, but only
   1.446 + * textCapacity UChars will be written to *text, including the zero
   1.447 + * terminator.
   1.448 + *
   1.449 + * @param trans the transliterator
   1.450 + * @param text a pointer to a buffer containing the text to be
   1.451 + * transliterated on input and the result text on output.
   1.452 + * @param textLength a pointer to the length of the string in text.
   1.453 + * If the length is -1 then the string is assumed to be
   1.454 + * zero-terminated.  Upon return, the new length is stored in
   1.455 + * *textLength.  If textLength is NULL then the string is assumed to
   1.456 + * be zero-terminated.
   1.457 + * @param textCapacity a pointer to the length of the text buffer.
   1.458 + * Upon return, 
   1.459 + * @param start the beginning index, inclusive; <code>0 <= start <=
   1.460 + * limit</code>.
   1.461 + * @param limit pointer to the ending index, exclusive; <code>start <=
   1.462 + * limit <= repFunc->length(rep)</code>.  Upon return, *limit will
   1.463 + * contain the new limit index.  The text previously occupying
   1.464 + * <code>[start, limit)</code> has been transliterated, possibly to a
   1.465 + * string of a different length, at <code>[start,
   1.466 + * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
   1.467 + * is the return value.
   1.468 + * @param status a pointer to the UErrorCode
   1.469 + * @stable ICU 2.0
   1.470 + */
   1.471 +U_STABLE void U_EXPORT2 
   1.472 +utrans_transUChars(const UTransliterator* trans,
   1.473 +                   UChar* text,
   1.474 +                   int32_t* textLength,
   1.475 +                   int32_t textCapacity,
   1.476 +                   int32_t start,
   1.477 +                   int32_t* limit,
   1.478 +                   UErrorCode* status);
   1.479 +
   1.480 +/**
   1.481 + * Transliterate the portion of the UChar* text buffer that can be
   1.482 + * transliterated unambiguosly.  See utrans_transIncremental().  The
   1.483 + * string is passed in in a UChar* buffer.  The string is modified in
   1.484 + * place.  If the result is longer than textCapacity, it is truncated.
   1.485 + * The actual length of the result is returned in *textLength, if
   1.486 + * textLength is non-NULL. *textLength may be greater than
   1.487 + * textCapacity, but only textCapacity UChars will be written to
   1.488 + * *text, including the zero terminator.  See utrans_transIncremental()
   1.489 + * for usage details.
   1.490 + *
   1.491 + * @param trans the transliterator
   1.492 + * @param text a pointer to a buffer containing the text to be
   1.493 + * transliterated on input and the result text on output.
   1.494 + * @param textLength a pointer to the length of the string in text.
   1.495 + * If the length is -1 then the string is assumed to be
   1.496 + * zero-terminated.  Upon return, the new length is stored in
   1.497 + * *textLength.  If textLength is NULL then the string is assumed to
   1.498 + * be zero-terminated.
   1.499 + * @param textCapacity the length of the text buffer
   1.500 + * @param pos a struct containing the start and limit indices of the
   1.501 + * text to be read and the text to be transliterated
   1.502 + * @param status a pointer to the UErrorCode
   1.503 + * @see utrans_transIncremental
   1.504 + * @stable ICU 2.0
   1.505 + */
   1.506 +U_STABLE void U_EXPORT2 
   1.507 +utrans_transIncrementalUChars(const UTransliterator* trans,
   1.508 +                              UChar* text,
   1.509 +                              int32_t* textLength,
   1.510 +                              int32_t textCapacity,
   1.511 +                              UTransPosition* pos,
   1.512 +                              UErrorCode* status);
   1.513 +
   1.514 +/* deprecated API ----------------------------------------------------------- */
   1.515 +
   1.516 +#ifndef U_HIDE_DEPRECATED_API
   1.517 +
   1.518 +/* see utrans.h documentation for why these functions are deprecated */
   1.519 +
   1.520 +/**
   1.521 + * Deprecated, use utrans_openU() instead.
   1.522 + * Open a custom transliterator, given a custom rules string 
   1.523 + * OR 
   1.524 + * a system transliterator, given its ID.  
   1.525 + * Any non-NULL result from this function should later be closed with
   1.526 + * utrans_close().
   1.527 + *
   1.528 + * @param id a valid ID, as returned by utrans_getAvailableID()
   1.529 + * @param dir the desired direction
   1.530 + * @param rules the transliterator rules.  See the C++ header rbt.h
   1.531 + * for rules syntax. If NULL then a system transliterator matching 
   1.532 + * the ID is returned.
   1.533 + * @param rulesLength the length of the rules, or -1 if the rules
   1.534 + * are zero-terminated.
   1.535 + * @param parseError a pointer to a UParseError struct to receive the
   1.536 + * details of any parsing errors. This parameter may be NULL if no
   1.537 + * parsing error details are desired.
   1.538 + * @param status a pointer to the UErrorCode
   1.539 + * @return a transliterator pointer that may be passed to other
   1.540 + * utrans_xxx() functions, or NULL if the open call fails.
   1.541 + * @deprecated ICU 2.8 Use utrans_openU() instead, see utrans.h
   1.542 + */
   1.543 +U_DEPRECATED UTransliterator* U_EXPORT2 
   1.544 +utrans_open(const char* id,
   1.545 +            UTransDirection dir,
   1.546 +            const UChar* rules,         /* may be Null */
   1.547 +            int32_t rulesLength,        /* -1 if null-terminated */ 
   1.548 +            UParseError* parseError,    /* may be Null */
   1.549 +            UErrorCode* status);
   1.550 +
   1.551 +/**
   1.552 + * Deprecated, use utrans_getUnicodeID() instead.
   1.553 + * Return the programmatic identifier for this transliterator.
   1.554 + * If this identifier is passed to utrans_open(), it will open
   1.555 + * a transliterator equivalent to this one, if the ID has been
   1.556 + * registered.
   1.557 + * @param trans the transliterator to return the ID of.
   1.558 + * @param buf the buffer in which to receive the ID.  This may be
   1.559 + * NULL, in which case no characters are copied.
   1.560 + * @param bufCapacity the capacity of the buffer.  Ignored if buf is
   1.561 + * NULL.
   1.562 + * @return the actual length of the ID, not including
   1.563 + * zero-termination.  This may be greater than bufCapacity.
   1.564 + * @deprecated ICU 2.8 Use utrans_getUnicodeID() instead, see utrans.h
   1.565 + */
   1.566 +U_DEPRECATED int32_t U_EXPORT2 
   1.567 +utrans_getID(const UTransliterator* trans,
   1.568 +             char* buf,
   1.569 +             int32_t bufCapacity);
   1.570 +
   1.571 +/**
   1.572 + * Deprecated, use utrans_unregisterID() instead.
   1.573 + * Unregister a transliterator from the system.  After this call the
   1.574 + * system will no longer recognize the given ID when passed to
   1.575 + * utrans_open().  If the id is invalid then nothing is done.
   1.576 + *
   1.577 + * @param id a zero-terminated ID
   1.578 + * @deprecated ICU 2.8 Use utrans_unregisterID() instead, see utrans.h
   1.579 + */
   1.580 +U_DEPRECATED void U_EXPORT2 
   1.581 +utrans_unregister(const char* id);
   1.582 +
   1.583 +/**
   1.584 + * Deprecated, use utrans_openIDs() instead.
   1.585 + * Return the ID of the index-th system transliterator.  The result
   1.586 + * is placed in the given buffer.  If the given buffer is too small,
   1.587 + * the initial substring is copied to buf.  The result in buf is
   1.588 + * always zero-terminated.
   1.589 + *
   1.590 + * @param index the number of the transliterator to return.  Must
   1.591 + * satisfy 0 <= index < utrans_countAvailableIDs().  If index is out
   1.592 + * of range then it is treated as if it were 0.
   1.593 + * @param buf the buffer in which to receive the ID.  This may be
   1.594 + * NULL, in which case no characters are copied.
   1.595 + * @param bufCapacity the capacity of the buffer.  Ignored if buf is
   1.596 + * NULL.
   1.597 + * @return the actual length of the index-th ID, not including
   1.598 + * zero-termination.  This may be greater than bufCapacity.
   1.599 + * @deprecated ICU 2.8 Use utrans_openIDs() instead, see utrans.h
   1.600 + */
   1.601 +U_DEPRECATED int32_t U_EXPORT2 
   1.602 +utrans_getAvailableID(int32_t index,
   1.603 +                      char* buf,
   1.604 +                      int32_t bufCapacity);
   1.605 +
   1.606 +#endif  /* U_HIDE_DEPRECATED_API */
   1.607 +
   1.608 +#endif /* #if !UCONFIG_NO_TRANSLITERATION */
   1.609 +
   1.610 +#endif

mercurial