ICU 4.8.1.1  4.8.1.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-2010, 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/localpointer.h"
19 #include "unicode/urep.h"
20 #include "unicode/parseerr.h"
21 #include "unicode/uenum.h"
22 
23 /********************************************************************
24  * General Notes
25  ********************************************************************
26  */
56 /********************************************************************
57  * Data Structures
58  ********************************************************************/
59 
67 typedef void* UTransliterator;
68 
77 typedef enum UTransDirection {
78 
86 
94 
96 
119 typedef struct UTransPosition {
120 
129  int32_t contextStart;
130 
139  int32_t contextLimit;
140 
148  int32_t start;
149 
157  int32_t limit;
158 
160 
161 /********************************************************************
162  * General API
163  ********************************************************************/
164 
189 utrans_openU(const UChar *id,
190  int32_t idLength,
191  UTransDirection dir,
192  const UChar *rules,
193  int32_t rulesLength,
194  UParseError *parseError,
195  UErrorCode *pErrorCode);
196 
214  UErrorCode* status);
215 
227 utrans_clone(const UTransliterator* trans,
228  UErrorCode* status);
229 
236 U_STABLE void U_EXPORT2
238 
239 #if U_SHOW_CPLUSPLUS_API
240 
242 
252 U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
253 
255 
256 #endif
257 
272 U_STABLE const UChar * U_EXPORT2
274  int32_t *resultLength);
275 
290 U_STABLE void U_EXPORT2
291 utrans_register(UTransliterator* adoptedTrans,
292  UErrorCode* status);
293 
303 U_STABLE void U_EXPORT2
304 utrans_unregisterID(const UChar* id, int32_t idLength);
305 
324 U_STABLE void U_EXPORT2
326  const UChar* filterPattern,
327  int32_t filterPatternLen,
328  UErrorCode* status);
329 
337 U_STABLE int32_t U_EXPORT2
339 
350 utrans_openIDs(UErrorCode *pErrorCode);
351 
352 /********************************************************************
353  * Transliteration API
354  ********************************************************************/
355 
379 U_STABLE void U_EXPORT2
380 utrans_trans(const UTransliterator* trans,
381  UReplaceable* rep,
382  UReplaceableCallbacks* repFunc,
383  int32_t start,
384  int32_t* limit,
385  UErrorCode* status);
386 
430 U_STABLE void U_EXPORT2
432  UReplaceable* rep,
433  UReplaceableCallbacks* repFunc,
434  UTransPosition* pos,
435  UErrorCode* status);
436 
468 U_STABLE void U_EXPORT2
470  UChar* text,
471  int32_t* textLength,
472  int32_t textCapacity,
473  int32_t start,
474  int32_t* limit,
475  UErrorCode* status);
476 
503 U_STABLE void U_EXPORT2
505  UChar* text,
506  int32_t* textLength,
507  int32_t textCapacity,
508  UTransPosition* pos,
509  UErrorCode* status);
510 
511 /* deprecated API ----------------------------------------------------------- */
512 
513 /* see utrans.h documentation for why these functions are deprecated */
514 
539 utrans_open(const char* id,
540  UTransDirection dir,
541  const UChar* rules, /* may be Null */
542  int32_t rulesLength, /* -1 if null-terminated */
543  UParseError* parseError, /* may be Null */
544  UErrorCode* status);
545 
561 U_DEPRECATED int32_t U_EXPORT2
562 utrans_getID(const UTransliterator* trans,
563  char* buf,
564  int32_t bufCapacity);
565 
576 utrans_unregister(const char* id);
577 
596 U_DEPRECATED int32_t U_EXPORT2
597 utrans_getAvailableID(int32_t index,
598  char* buf,
599  int32_t bufCapacity);
600 
601 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
602 
603 #endif
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition: utrans.h:85
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:93
void * UTransliterator
An opaque transliterator for use in C.
Definition: utrans.h:67
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:119
C API: Callbacks for UReplaceable.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
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:157
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:139
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:141
UTransliterator * utrans_open(const char *id, UTransDirection dir, const UChar *rules, int32_t rulesLength, UParseError *parseError, UErrorCode *status)
Deprecated, use utrans_openU() instead.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
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:129
int32_t start
Beginning index, inclusive, of the text to be transliteratd.
Definition: utrans.h:148
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.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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:314
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:325
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
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:639
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:77
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:137