ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utrans.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 1997-2005, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * Date Name Description
7 * 06/21/00 aliu Creation.
8 *******************************************************************************
9 */
10 
11 #ifndef UTRANS_H
12 #define UTRANS_H
13 
14 #include "unicode/utypes.h"
15 
16 #if !UCONFIG_NO_TRANSLITERATION
17 
18 #include "unicode/urep.h"
19 #include "unicode/parseerr.h"
20 #include "unicode/uenum.h"
21 
22 /********************************************************************
23  * General Notes
24  ********************************************************************
25  */
55 /********************************************************************
56  * Data Structures
57  ********************************************************************/
58 
66 typedef void* UTransliterator;
67 
76 typedef enum UTransDirection {
77 
85 
93 
95 
118 typedef struct UTransPosition {
119 
129 
139 
148 
157 
159 
160 /********************************************************************
161  * General API
162  ********************************************************************/
163 
188 utrans_openU(const UChar *id,
189  int32_t idLength,
190  UTransDirection dir,
191  const UChar *rules,
192  int32_t rulesLength,
193  UParseError *parseError,
194  UErrorCode *pErrorCode);
195 
213  UErrorCode* status);
214 
226 utrans_clone(const UTransliterator* trans,
227  UErrorCode* status);
228 
235 U_STABLE void U_EXPORT2
237 
252 U_STABLE const UChar * U_EXPORT2
254  int32_t *resultLength);
255 
270 U_STABLE void U_EXPORT2
271 utrans_register(UTransliterator* adoptedTrans,
272  UErrorCode* status);
273 
283 U_STABLE void U_EXPORT2
284 utrans_unregisterID(const UChar* id, int32_t idLength);
285 
304 U_STABLE void U_EXPORT2
306  const UChar* filterPattern,
307  int32_t filterPatternLen,
308  UErrorCode* status);
309 
319 
330 utrans_openIDs(UErrorCode *pErrorCode);
331 
332 /********************************************************************
333  * Transliteration API
334  ********************************************************************/
335 
359 U_STABLE void U_EXPORT2
360 utrans_trans(const UTransliterator* trans,
361  UReplaceable* rep,
362  UReplaceableCallbacks* repFunc,
363  int32_t start,
364  int32_t* limit,
365  UErrorCode* status);
366 
410 U_STABLE void U_EXPORT2
412  UReplaceable* rep,
413  UReplaceableCallbacks* repFunc,
414  UTransPosition* pos,
415  UErrorCode* status);
416 
448 U_STABLE void U_EXPORT2
450  UChar* text,
451  int32_t* textLength,
452  int32_t textCapacity,
453  int32_t start,
454  int32_t* limit,
455  UErrorCode* status);
456 
483 U_STABLE void U_EXPORT2
485  UChar* text,
486  int32_t* textLength,
487  int32_t textCapacity,
488  UTransPosition* pos,
489  UErrorCode* status);
490 
491 /* deprecated API ----------------------------------------------------------- */
492 
493 /* see utrans.h documentation for why these functions are deprecated */
494 
519 utrans_open(const char* id,
520  UTransDirection dir,
521  const UChar* rules, /* may be Null */
522  int32_t rulesLength, /* -1 if null-terminated */
523  UParseError* parseError, /* may be Null */
524  UErrorCode* status);
525 
542 utrans_getID(const UTransliterator* trans,
543  char* buf,
544  int32_t bufCapacity);
545 
556 utrans_unregister(const char* id);
557 
578  char* buf,
579  int32_t bufCapacity);
580 
581 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
582 
583 #endif
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition: utrans.h:84
int32_t utrans_getID(const UTransliterator *trans, char *buf, int32_t bufCapacity)
Deprecated, use utrans_getUnicodeID() instead.
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition: utrans.h:92
void * UTransliterator
An opaque transliterator for use in C.
Definition: utrans.h:66
void utrans_unregisterID(const UChar *id, int32_t idLength)
Unregister a transliterator from the system.
void utrans_transIncremental(const UTransliterator *trans, UReplaceable *rep, UReplaceableCallbacks *repFunc, UTransPosition *pos, UErrorCode *status)
Transliterate the portion of the UReplaceable text buffer that can be transliterated unambiguosly...
void utrans_close(UTransliterator *trans)
Close a transliterator.
int32_t utrans_countAvailableIDs(void)
Return the number of system transliterators.
void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
Position structure for utrans_transIncremental() incremental transliteration.
Definition: utrans.h:118
C API: Callbacks for UReplacebale.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:38
void * UReplaceable
An opaque replaceable text object.
Definition: urep.h:42
UTransliterator * utrans_openU(const UChar *id, int32_t idLength, UTransDirection dir, const UChar *rules, int32_t rulesLength, UParseError *parseError, UErrorCode *pErrorCode)
Open a custom transliterator, given a custom rules string OR a system transliterator, given its ID.
int32_t limit
Ending index, exclusive, of the text to be transliteratd.
Definition: utrans.h:156
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:138
UEnumeration * utrans_openIDs(UErrorCode *pErrorCode)
Return a UEnumeration for the available transliterators.
void utrans_transUChars(const UTransliterator *trans, UChar *text, int32_t *textLength, int32_t textCapacity, int32_t start, int32_t *limit, UErrorCode *status)
Transliterate a segment of a UChar* string.
const UChar * utrans_getUnicodeID(const UTransliterator *trans, int32_t *resultLength)
Return the programmatic identifier for this transliterator.
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API.
Definition: umachine.h:121
UTransliterator * utrans_open(const char *id, UTransDirection dir, const UChar *rules, int32_t rulesLength, UParseError *parseError, UErrorCode *status)
Deprecated, use utrans_openU() instead.
void utrans_trans(const UTransliterator *trans, UReplaceable *rep, UReplaceableCallbacks *repFunc, int32_t start, int32_t *limit, UErrorCode *status)
Transliterate a segment of a UReplaceable string.
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation...
Definition: utrans.h:128
int32_t start
Beginning index, inclusive, of the text to be transliteratd.
Definition: utrans.h:147
void utrans_transIncrementalUChars(const UTransliterator *trans, UChar *text, int32_t *textLength, int32_t textCapacity, UTransPosition *pos, UErrorCode *status)
Transliterate the portion of the UChar* text buffer that can be transliterated unambiguosly.
int32_t utrans_getAvailableID(int32_t index, char *buf, int32_t bufCapacity)
Deprecated, use utrans_openIDs() instead.
UTransliterator * utrans_clone(const UTransliterator *trans, UErrorCode *status)
Create a copy of a transliterator.
#define U_EXPORT2
Definition: platform.h:338
UTransliterator * utrans_openInverse(const UTransliterator *trans, UErrorCode *status)
Open an inverse of an existing transliterator.
A set of function pointers that transliterators use to manipulate a UReplaceable. ...
Definition: urep.h:51
void utrans_register(UTransliterator *adoptedTrans, UErrorCode *status)
Register an open transliterator with the system.
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
C API: Parse Error Information.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
C API: String Enumeration.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
Basic definitions for ICU, for both C and C++ APIs.
struct UTransPosition UTransPosition
Position structure for utrans_transIncremental() incremental transliteration.
void utrans_unregister(const char *id)
Deprecated, use utrans_unregisterID() instead.
UTransDirection
Direction constant indicating the direction in a transliterator, e.g., the forward or reverse rules o...
Definition: utrans.h:76
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:117