ICU 57.1 57.1
utrans.h
Go to the documentation of this file.
1/*
2*******************************************************************************
3* Copyright (C) 1997-2011,2014-2015 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
19#include "unicode/urep.h"
20#include "unicode/parseerr.h"
21#include "unicode/uenum.h"
22#include "unicode/uset.h"
23
24/********************************************************************
25 * General Notes
26 ********************************************************************
27 */
57/********************************************************************
58 * Data Structures
59 ********************************************************************/
60
68typedef void* UTransliterator;
69
78typedef enum UTransDirection {
79
87
95
97
120typedef struct UTransPosition {
121
131
141
149 int32_t start;
150
158 int32_t limit;
159
161
162/********************************************************************
163 * General API
164 ********************************************************************/
165
189U_STABLE UTransliterator* U_EXPORT2
191 int32_t idLength,
192 UTransDirection dir,
193 const UChar *rules,
194 int32_t rulesLength,
195 UParseError *parseError,
196 UErrorCode *pErrorCode);
197
213U_STABLE UTransliterator* U_EXPORT2
215 UErrorCode* status);
216
227U_STABLE UTransliterator* U_EXPORT2
229 UErrorCode* status);
230
237U_STABLE void U_EXPORT2
239
240#if U_SHOW_CPLUSPLUS_API
241
243
254
256
257#endif
258
273U_STABLE const UChar * U_EXPORT2
275 int32_t *resultLength);
276
291U_STABLE void U_EXPORT2
293 UErrorCode* status);
294
304U_STABLE void U_EXPORT2
305utrans_unregisterID(const UChar* id, int32_t idLength);
306
325U_STABLE void U_EXPORT2
327 const UChar* filterPattern,
328 int32_t filterPatternLen,
329 UErrorCode* status);
330
338U_STABLE int32_t U_EXPORT2
340
350U_STABLE UEnumeration * U_EXPORT2
352
353/********************************************************************
354 * Transliteration API
355 ********************************************************************/
356
380U_STABLE void U_EXPORT2
382 UReplaceable* rep,
383 UReplaceableCallbacks* repFunc,
384 int32_t start,
385 int32_t* limit,
386 UErrorCode* status);
387
431U_STABLE void U_EXPORT2
433 UReplaceable* rep,
434 UReplaceableCallbacks* repFunc,
435 UTransPosition* pos,
436 UErrorCode* status);
437
469U_STABLE void U_EXPORT2
471 UChar* text,
472 int32_t* textLength,
473 int32_t textCapacity,
474 int32_t start,
475 int32_t* limit,
476 UErrorCode* status);
477
504U_STABLE void U_EXPORT2
506 UChar* text,
507 int32_t* textLength,
508 int32_t textCapacity,
509 UTransPosition* pos,
510 UErrorCode* status);
511
529U_STABLE int32_t U_EXPORT2
531 UBool escapeUnprintable,
532 UChar* result, int32_t resultLength,
533 UErrorCode* status);
534
554U_STABLE USet* U_EXPORT2
556 UBool ignoreFilter,
557 USet* fillIn,
558 UErrorCode* status);
559
560/* deprecated API ----------------------------------------------------------- */
561
562#ifndef U_HIDE_DEPRECATED_API
563
564/* see utrans.h documentation for why these functions are deprecated */
565
590utrans_open(const char* id,
591 UTransDirection dir,
592 const UChar* rules, /* may be Null */
593 int32_t rulesLength, /* -1 if null-terminated */
594 UParseError* parseError, /* may be Null */
595 UErrorCode* status);
596
612U_DEPRECATED int32_t U_EXPORT2
614 char* buf,
615 int32_t bufCapacity);
616
626U_DEPRECATED void U_EXPORT2
627utrans_unregister(const char* id);
628
647U_DEPRECATED int32_t U_EXPORT2
649 char* buf,
650 int32_t bufCapacity);
651
652#endif /* U_HIDE_DEPRECATED_API */
653
654#endif /* #if !UCONFIG_NO_TRANSLITERATION */
655
656#endif
"Smart pointer" class, closes a UTransliterator via utrans_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:539
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
A set of function pointers that transliterators use to manipulate a UReplaceable.
Definition: urep.h:51
Position structure for utrans_transIncremental() incremental transliteration.
Definition: utrans.h:120
int32_t start
Beginning index, inclusive, of the text to be transliteratd.
Definition: utrans.h:149
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:140
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:130
int32_t limit
Ending index, exclusive, of the text to be transliteratd.
Definition: utrans.h:158
struct USet USet
Definition: ucnv.h:67
C API: String Enumeration.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API
Definition: umachine.h:113
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
C API: Callbacks for UReplaceable.
void * UReplaceable
An opaque replaceable text object.
Definition: urep.h:42
C API: Unicode Set.
UTransDirection
Direction constant indicating the direction in a transliterator, e.g., the forward or reverse rules o...
Definition: utrans.h:78
@ UTRANS_FORWARD
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition: utrans.h:86
@ UTRANS_REVERSE
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition: utrans.h:94
void * UTransliterator
An opaque transliterator for use in C.
Definition: utrans.h:68
void utrans_close(UTransliterator *trans)
Close a transliterator.
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.
void utrans_register(UTransliterator *adoptedTrans, UErrorCode *status)
Register an open transliterator with the system.
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.
UTransliterator * utrans_clone(const UTransliterator *trans, UErrorCode *status)
Create a copy of a transliterator.
const UChar * utrans_getUnicodeID(const UTransliterator *trans, int32_t *resultLength)
Return the programmatic identifier for this transliterator.
int32_t utrans_getID(const UTransliterator *trans, char *buf, int32_t bufCapacity)
Deprecated, use utrans_getUnicodeID() instead.
void utrans_unregisterID(const UChar *id, int32_t idLength)
Unregister a transliterator from the system.
void utrans_unregister(const char *id)
Deprecated, use utrans_unregisterID() instead.
int32_t utrans_getAvailableID(int32_t index, char *buf, int32_t bufCapacity)
Deprecated, use utrans_openIDs() instead.
struct UTransPosition UTransPosition
Position structure for utrans_transIncremental() incremental transliteration.
int32_t utrans_countAvailableIDs(void)
Return the number of system transliterators.
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,...
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.
void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
UEnumeration * utrans_openIDs(UErrorCode *pErrorCode)
Return a UEnumeration for the available transliterators.
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_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.
UTransliterator * utrans_openInverse(const UTransliterator *trans, UErrorCode *status)
Open an inverse of an existing transliterator.
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,...
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.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129