ICU 60.2 60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

utrans.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 1997-2011,2014-2015 International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * Date Name Description
9 * 06/21/00 aliu Creation.
10 *******************************************************************************
11 */
12
13 #ifndef UTRANS_H
14 #define UTRANS_H
15
16 #include "unicode/utypes.h"
17
18 #if !UCONFIG_NO_TRANSLITERATION
19
20 #include "unicode/localpointer.h"
21 #include "unicode/urep.h"
22 #include "unicode/parseerr.h"
23 #include "unicode/uenum.h"
24 #include "unicode/uset.h"
25
26 /********************************************************************
27 * General Notes
28 ********************************************************************
29 */
59 /********************************************************************
60 * Data Structures
61 ********************************************************************/
62
70 typedef void* UTransliterator;
71
80 typedef enum UTransDirection {
81
88 UTRANS_FORWARD,
89
96 UTRANS_REVERSE
97
98 } UTransDirection;
99
122 typedef struct UTransPosition {
123
132 int32_t contextStart;
133
142 int32_t contextLimit;
143
151 int32_t start;
152
160 int32_t limit;
161
162 } UTransPosition;
163
164 /********************************************************************
165 * General API
166 ********************************************************************/
167
191 U_STABLE UTransliterator* U_EXPORT2
192 utrans_openU(const UChar *id,
193 int32_t idLength,
194 UTransDirection dir,
195 const UChar *rules,
196 int32_t rulesLength,
197 UParseError *parseError,
198 UErrorCode *pErrorCode);
199
215 U_STABLE UTransliterator* U_EXPORT2
216 utrans_openInverse(const UTransliterator* trans,
217 UErrorCode* status);
218
229 U_STABLE UTransliterator* U_EXPORT2
230 utrans_clone(const UTransliterator* trans,
231 UErrorCode* status);
232
239 U_STABLE void U_EXPORT2
240 utrans_close(UTransliterator* trans);
241
242 #if U_SHOW_CPLUSPLUS_API
243
244 U_NAMESPACE_BEGIN
245
255 U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
256
257 U_NAMESPACE_END
258
259 #endif
260
275 U_STABLE const UChar * U_EXPORT2
276 utrans_getUnicodeID(const UTransliterator *trans,
277 int32_t *resultLength);
278
293 U_STABLE void U_EXPORT2
294 utrans_register(UTransliterator* adoptedTrans,
295 UErrorCode* status);
296
306 U_STABLE void U_EXPORT2
307 utrans_unregisterID(const UChar* id, int32_t idLength);
308
327 U_STABLE void U_EXPORT2
328 utrans_setFilter(UTransliterator* trans,
329 const UChar* filterPattern,
330 int32_t filterPatternLen,
331 UErrorCode* status);
332
340 U_STABLE int32_t U_EXPORT2
341 utrans_countAvailableIDs(void);
342
352 U_STABLE UEnumeration * U_EXPORT2
353 utrans_openIDs(UErrorCode *pErrorCode);
354
355 /********************************************************************
356 * Transliteration API
357 ********************************************************************/
358
382 U_STABLE void U_EXPORT2
383 utrans_trans(const UTransliterator* trans,
384 UReplaceable* rep,
385 UReplaceableCallbacks* repFunc,
386 int32_t start,
387 int32_t* limit,
388 UErrorCode* status);
389
433 U_STABLE void U_EXPORT2
434 utrans_transIncremental(const UTransliterator* trans,
435 UReplaceable* rep,
436 UReplaceableCallbacks* repFunc,
437 UTransPosition* pos,
438 UErrorCode* status);
439
471 U_STABLE void U_EXPORT2
472 utrans_transUChars(const UTransliterator* trans,
473 UChar* text,
474 int32_t* textLength,
475 int32_t textCapacity,
476 int32_t start,
477 int32_t* limit,
478 UErrorCode* status);
479
506 U_STABLE void U_EXPORT2
507 utrans_transIncrementalUChars(const UTransliterator* trans,
508 UChar* text,
509 int32_t* textLength,
510 int32_t textCapacity,
511 UTransPosition* pos,
512 UErrorCode* status);
513
531 U_STABLE int32_t U_EXPORT2
532 utrans_toRules( const UTransliterator* trans,
533 UBool escapeUnprintable,
534 UChar* result, int32_t resultLength,
535 UErrorCode* status);
536
556 U_STABLE USet* U_EXPORT2
557 utrans_getSourceSet(const UTransliterator* trans,
558 UBool ignoreFilter,
559 USet* fillIn,
560 UErrorCode* status);
561
562 /* deprecated API ----------------------------------------------------------- */
563
564 #ifndef U_HIDE_DEPRECATED_API
565
566 /* see utrans.h documentation for why these functions are deprecated */
567
591 U_DEPRECATED UTransliterator* U_EXPORT2
592 utrans_open(const char* id,
593 UTransDirection dir,
594 const UChar* rules, /* may be Null */
595 int32_t rulesLength, /* -1 if null-terminated */
596 UParseError* parseError, /* may be Null */
597 UErrorCode* status);
598
614 U_DEPRECATED int32_t U_EXPORT2
615 utrans_getID(const UTransliterator* trans,
616 char* buf,
617 int32_t bufCapacity);
618
628 U_DEPRECATED void U_EXPORT2
629 utrans_unregister(const char* id);
630
649 U_DEPRECATED int32_t U_EXPORT2
650 utrans_getAvailableID(int32_t index,
651 char* buf,
652 int32_t bufCapacity);
653
654 #endif /* U_HIDE_DEPRECATED_API */
655
656 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
657
658 #endif
UTRANS_FORWARD
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition: utrans.h:88
utrans_getID
int32_t utrans_getID(const UTransliterator *trans, char *buf, int32_t bufCapacity)
Deprecated, use utrans_getUnicodeID() instead.
UTRANS_REVERSE
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition: utrans.h:96
UTransliterator
void * UTransliterator
An opaque transliterator for use in C.
Definition: utrans.h:70
utrans_unregisterID
void utrans_unregisterID(const UChar *id, int32_t idLength)
Unregister a transliterator from the system.
utrans_transIncremental
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...
utrans_close
void utrans_close(UTransliterator *trans)
Close a transliterator.
utrans_countAvailableIDs
int32_t utrans_countAvailableIDs(void)
Return the number of system transliterators.
utrans_setFilter
void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
UTransPosition
Position structure for utrans_transIncremental() incremental transliteration.
Definition: utrans.h:122
urep.h
C API: Callbacks for UReplaceable.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:43
UReplaceable
void * UReplaceable
An opaque replaceable text object.
Definition: urep.h:44
utrans_openU
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.
utrans_toRules
int32_t utrans_toRules(const UTransliterator *trans, UBool escapeUnprintable, UChar *result, int32_t resultLength, UErrorCode *status)
Create a rule string that can be passed to utrans_openU to recreate this transliterator.
UTransPosition::limit
int32_t limit
Ending index, exclusive, of the text to be transliteratd.
Definition: utrans.h:160
UTransPosition::contextLimit
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:142
utrans_openIDs
UEnumeration * utrans_openIDs(UErrorCode *pErrorCode)
Return a UEnumeration for the available transliterators.
uset.h
C API: Unicode Set.
utrans_transUChars
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.
utrans_getUnicodeID
const UChar * utrans_getUnicodeID(const UTransliterator *trans, int32_t *resultLength)
Return the programmatic identifier for this transliterator.
U_DEPRECATED
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API.
Definition: umachine.h:115
utrans_open
UTransliterator * utrans_open(const char *id, UTransDirection dir, const UChar *rules, int32_t rulesLength, UParseError *parseError, UErrorCode *status)
Deprecated, use utrans_openU() instead.
LocalUTransliteratorPointer
"Smart pointer" class, closes a UTransliterator via utrans_close().
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
utrans_trans
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.
UTransPosition::contextStart
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation...
Definition: utrans.h:132
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:487
UTransPosition::start
int32_t start
Beginning index, inclusive, of the text to be transliteratd.
Definition: utrans.h:151
utrans_transIncrementalUChars
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.
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
utrans_getAvailableID
int32_t utrans_getAvailableID(int32_t index, char *buf, int32_t bufCapacity)
Deprecated, use utrans_openIDs() instead.
utrans_clone
UTransliterator * utrans_clone(const UTransliterator *trans, UErrorCode *status)
Create a copy of a transliterator.
utrans_getSourceSet
USet * utrans_getSourceSet(const UTransliterator *trans, UBool ignoreFilter, USet *fillIn, UErrorCode *status)
Returns the set of all characters that may be modified in the input text by this UTransliterator, optionally ignoring the transliterator&#39;s current filter.
utrans_openInverse
UTransliterator * utrans_openInverse(const UTransliterator *trans, UErrorCode *status)
Open an inverse of an existing transliterator.
UReplaceableCallbacks
A set of function pointers that transliterators use to manipulate a UReplaceable. ...
Definition: urep.h:53
utrans_register
void utrans_register(UTransliterator *adoptedTrans, UErrorCode *status)
Register an open transliterator with the system.
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:349
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
USet
struct USet USet
Definition: ucnv.h:69
parseerr.h
C API: Parse Error Information.
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
uenum.h
C API: String Enumeration.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UTransPosition
struct UTransPosition UTransPosition
Position structure for utrans_transIncremental() incremental transliteration.
utrans_unregister
void utrans_unregister(const char *id)
Deprecated, use utrans_unregisterID() instead.
UTransDirection
UTransDirection
Direction constant indicating the direction in a transliterator, e.g., the forward or reverse rules o...
Definition: utrans.h:80
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236