00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1997-2000, International Business Machines 00004 * Corporation and others. All Rights Reserved. 00005 ******************************************************************************* 00006 * Date Name Description 00007 * 06/21/00 aliu Creation. 00008 ******************************************************************************* 00009 */ 00010 00011 #ifndef UTRANS_H 00012 #define UTRANS_H 00013 00014 #include "unicode/utypes.h" 00015 #include "unicode/urep.h" 00016 #include "unicode/parseerr.h" 00017 00018 /******************************************************************** 00019 * General Notes 00020 ******************************************************************** 00021 * 00022 * The data structures and functions described in this header provide 00023 * transliteration services. Transliteration services are implemented 00024 * as C++ classes. The comments and documentation in this header 00025 * assume the reader is familiar with the C++ headers translit.h and 00026 * rbt.h and associated documentation. 00027 * 00028 * A significant but incomplete subset of the C++ transliteration 00029 * services are available to C code through this header. In order to 00030 * access more complex transliteration services, refer to the C++ 00031 * headers and documentation. 00032 */ 00033 00034 /******************************************************************** 00035 * Data Structures 00036 ********************************************************************/ 00037 00045 typedef void* UTransliterator; 00046 00055 typedef enum _UTransDirection { 00056 00063 UTRANS_FORWARD, 00064 00071 UTRANS_REVERSE 00072 00073 } UTransDirection; 00074 00091 typedef struct _UTransPosition { 00092 00099 int32_t contextStart; 00100 00108 int32_t contextLimit; 00109 00116 int32_t start; 00117 00124 int32_t limit; 00125 00126 } UTransPosition; 00127 00128 /******************************************************************** 00129 * General API 00130 ********************************************************************/ 00131 00143 U_CAPI UTransliterator* 00144 utrans_open(const char* id, 00145 UTransDirection dir, 00146 UErrorCode* status); 00147 00169 U_CAPI UTransliterator* 00170 utrans_openRules(const char* id, 00171 const UChar* rules, 00172 int32_t rulesLength, /* -1 if null-terminated */ 00173 UTransDirection dir, 00174 UParseError* parseErr, /* may be NULL */ 00175 UErrorCode* status); 00176 00192 U_CAPI UTransliterator* 00193 utrans_openInverse(const UTransliterator* trans, 00194 UErrorCode* status); 00195 00206 U_CAPI UTransliterator* 00207 utrans_clone(const UTransliterator* trans, 00208 UErrorCode* status); 00209 00215 U_CAPI void 00216 utrans_close(UTransliterator* trans); 00217 00232 U_CAPI int32_t 00233 utrans_getID(const UTransliterator* trans, 00234 char* buf, 00235 int32_t bufCapacity); 00236 00251 U_CAPI void 00252 utrans_register(UTransliterator* adoptedTrans, 00253 UErrorCode* status); 00254 00263 U_CAPI void 00264 utrans_unregister(const char* id); 00265 00284 U_CAPI void 00285 utrans_setFilter(UTransliterator* trans, 00286 const UChar* filterPattern, 00287 int32_t filterPatternLen, 00288 UErrorCode* status); 00289 00294 U_CAPI int32_t 00295 utrans_countAvailableIDs(void); 00296 00314 U_CAPI int32_t 00315 utrans_getAvailableID(int32_t index, 00316 char* buf, 00317 int32_t bufCapacity); 00318 00319 /******************************************************************** 00320 * Transliteration API 00321 ********************************************************************/ 00322 00346 U_CAPI void 00347 utrans_trans(const UTransliterator* trans, 00348 UReplaceable* rep, 00349 UReplaceableCallbacks* repFunc, 00350 int32_t start, 00351 int32_t* limit, 00352 UErrorCode* status); 00353 00397 U_CAPI void 00398 utrans_transIncremental(const UTransliterator* trans, 00399 UReplaceable* rep, 00400 UReplaceableCallbacks* repFunc, 00401 UTransPosition* pos, 00402 UErrorCode* status); 00403 00435 U_CAPI void 00436 utrans_transUChars(const UTransliterator* trans, 00437 UChar* text, 00438 int32_t* textLength, 00439 int32_t textCapacity, 00440 int32_t start, 00441 int32_t* limit, 00442 UErrorCode* status); 00443 00470 U_CAPI void 00471 utrans_transIncrementalUChars(const UTransliterator* trans, 00472 UChar* text, 00473 int32_t* textLength, 00474 int32_t textCapacity, 00475 UTransPosition* pos, 00476 UErrorCode* status); 00477 00478 #endif