ICU 73.2  73.2
utrans.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 *******************************************************************************
00005 *   Copyright (C) 1997-2011,2014-2015 International Business Machines
00006 *   Corporation and others.  All Rights Reserved.
00007 *******************************************************************************
00008 *   Date        Name        Description
00009 *   06/21/00    aliu        Creation.
00010 *******************************************************************************
00011 */
00012 
00013 #ifndef UTRANS_H
00014 #define UTRANS_H
00015 
00016 #include "unicode/utypes.h"
00017 
00018 #if !UCONFIG_NO_TRANSLITERATION
00019 
00020 #include "unicode/urep.h"
00021 #include "unicode/parseerr.h"
00022 #include "unicode/uenum.h"
00023 #include "unicode/uset.h"
00024 
00025 #if U_SHOW_CPLUSPLUS_API
00026 #include "unicode/localpointer.h"
00027 #endif   // U_SHOW_CPLUSPLUS_API
00028 
00029 /********************************************************************
00030  * General Notes
00031  ********************************************************************
00032  */
00062 /********************************************************************
00063  * Data Structures
00064  ********************************************************************/
00065 
00073 typedef void* UTransliterator;
00074 
00083 typedef enum UTransDirection {
00084     
00091     UTRANS_FORWARD,
00092 
00099     UTRANS_REVERSE
00100 
00101 } UTransDirection;
00102 
00125 typedef struct UTransPosition {
00126 
00135     int32_t contextStart;
00136     
00145     int32_t contextLimit;
00146     
00154     int32_t start;
00155     
00163     int32_t limit;
00164 
00165 } UTransPosition;
00166 
00167 /********************************************************************
00168  * General API
00169  ********************************************************************/
00170 
00194 U_CAPI UTransliterator* U_EXPORT2
00195 utrans_openU(const UChar *id,
00196              int32_t idLength,
00197              UTransDirection dir,
00198              const UChar *rules,
00199              int32_t rulesLength,
00200              UParseError *parseError,
00201              UErrorCode *pErrorCode);
00202 
00218 U_CAPI UTransliterator* U_EXPORT2 
00219 utrans_openInverse(const UTransliterator* trans,
00220                    UErrorCode* status);
00221 
00232 U_CAPI UTransliterator* U_EXPORT2 
00233 utrans_clone(const UTransliterator* trans,
00234              UErrorCode* status);
00235 
00242 U_CAPI void U_EXPORT2 
00243 utrans_close(UTransliterator* trans);
00244 
00245 #if U_SHOW_CPLUSPLUS_API
00246 
00247 U_NAMESPACE_BEGIN
00248 
00258 U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
00259 
00260 U_NAMESPACE_END
00261 
00262 #endif
00263 
00278 U_CAPI const UChar * U_EXPORT2
00279 utrans_getUnicodeID(const UTransliterator *trans,
00280                     int32_t *resultLength);
00281 
00296 U_CAPI void U_EXPORT2 
00297 utrans_register(UTransliterator* adoptedTrans,
00298                 UErrorCode* status);
00299 
00309 U_CAPI void U_EXPORT2
00310 utrans_unregisterID(const UChar* id, int32_t idLength);
00311 
00330 U_CAPI void U_EXPORT2 
00331 utrans_setFilter(UTransliterator* trans,
00332                  const UChar* filterPattern,
00333                  int32_t filterPatternLen,
00334                  UErrorCode* status);
00335 
00343 U_CAPI int32_t U_EXPORT2 
00344 utrans_countAvailableIDs(void);
00345 
00355 U_CAPI UEnumeration * U_EXPORT2
00356 utrans_openIDs(UErrorCode *pErrorCode);
00357 
00358 /********************************************************************
00359  * Transliteration API
00360  ********************************************************************/
00361 
00385 U_CAPI void U_EXPORT2 
00386 utrans_trans(const UTransliterator* trans,
00387              UReplaceable* rep,
00388              const UReplaceableCallbacks* repFunc,
00389              int32_t start,
00390              int32_t* limit,
00391              UErrorCode* status);
00392 
00436 U_CAPI void U_EXPORT2 
00437 utrans_transIncremental(const UTransliterator* trans,
00438                         UReplaceable* rep,
00439                         const UReplaceableCallbacks* repFunc,
00440                         UTransPosition* pos,
00441                         UErrorCode* status);
00442 
00473 U_CAPI void U_EXPORT2 
00474 utrans_transUChars(const UTransliterator* trans,
00475                    UChar* text,
00476                    int32_t* textLength,
00477                    int32_t textCapacity,
00478                    int32_t start,
00479                    int32_t* limit,
00480                    UErrorCode* status);
00481 
00508 U_CAPI void U_EXPORT2 
00509 utrans_transIncrementalUChars(const UTransliterator* trans,
00510                               UChar* text,
00511                               int32_t* textLength,
00512                               int32_t textCapacity,
00513                               UTransPosition* pos,
00514                               UErrorCode* status);
00515 
00533 U_CAPI int32_t U_EXPORT2
00534 utrans_toRules(     const UTransliterator* trans,
00535                     UBool escapeUnprintable,
00536                     UChar* result, int32_t resultLength,
00537                     UErrorCode* status);
00538 
00558 U_CAPI USet* U_EXPORT2
00559 utrans_getSourceSet(const UTransliterator* trans,
00560                     UBool ignoreFilter,
00561                     USet* fillIn,
00562                     UErrorCode* status);
00563 
00564 /* deprecated API ----------------------------------------------------------- */
00565 
00566 #ifndef U_HIDE_DEPRECATED_API
00567 
00568 /* see utrans.h documentation for why these functions are deprecated */
00569 
00593 U_DEPRECATED UTransliterator* U_EXPORT2 
00594 utrans_open(const char* id,
00595             UTransDirection dir,
00596             const UChar* rules,         /* may be Null */
00597             int32_t rulesLength,        /* -1 if null-terminated */ 
00598             UParseError* parseError,    /* may be Null */
00599             UErrorCode* status);
00600 
00616 U_DEPRECATED int32_t U_EXPORT2 
00617 utrans_getID(const UTransliterator* trans,
00618              char* buf,
00619              int32_t bufCapacity);
00620 
00630 U_DEPRECATED void U_EXPORT2 
00631 utrans_unregister(const char* id);
00632 
00651 U_DEPRECATED int32_t U_EXPORT2 
00652 utrans_getAvailableID(int32_t index,
00653                       char* buf,
00654                       int32_t bufCapacity);
00655 
00656 #endif  /* U_HIDE_DEPRECATED_API */
00657 
00658 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
00659 
00660 #endif