ICU 66.1 66.1
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
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
70typedef void* UTransliterator;
71
80typedef enum UTransDirection {
81
89
97
99
122typedef struct UTransPosition {
123
133
143
151 int32_t start;
152
160 int32_t limit;
161
163
164/********************************************************************
165 * General API
166 ********************************************************************/
167
191U_STABLE UTransliterator* U_EXPORT2
193 int32_t idLength,
194 UTransDirection dir,
195 const UChar *rules,
196 int32_t rulesLength,
197 UParseError *parseError,
198 UErrorCode *pErrorCode);
199
215U_STABLE UTransliterator* U_EXPORT2
217 UErrorCode* status);
218
229U_STABLE UTransliterator* U_EXPORT2
231 UErrorCode* status);
232
239U_STABLE void U_EXPORT2
241
242#if U_SHOW_CPLUSPLUS_API
243
244U_NAMESPACE_BEGIN
245
256
257U_NAMESPACE_END
258
259#endif
260
275U_STABLE const UChar * U_EXPORT2
277 int32_t *resultLength);
278
293U_STABLE void U_EXPORT2
295 UErrorCode* status);
296
306U_STABLE void U_EXPORT2
307utrans_unregisterID(const UChar* id, int32_t idLength);
308
327U_STABLE void U_EXPORT2
329 const UChar* filterPattern,
330 int32_t filterPatternLen,
331 UErrorCode* status);
332
340U_STABLE int32_t U_EXPORT2
342
352U_STABLE UEnumeration * U_EXPORT2
354
355/********************************************************************
356 * Transliteration API
357 ********************************************************************/
358
382U_STABLE void U_EXPORT2
384 UReplaceable* rep,
385 const UReplaceableCallbacks* repFunc,
386 int32_t start,
387 int32_t* limit,
388 UErrorCode* status);
389
433U_STABLE void U_EXPORT2
435 UReplaceable* rep,
436 const UReplaceableCallbacks* repFunc,
437 UTransPosition* pos,
438 UErrorCode* status);
439
470U_STABLE void U_EXPORT2
472 UChar* text,
473 int32_t* textLength,
474 int32_t textCapacity,
475 int32_t start,
476 int32_t* limit,
477 UErrorCode* status);
478
505U_STABLE void U_EXPORT2
507 UChar* text,
508 int32_t* textLength,
509 int32_t textCapacity,
510 UTransPosition* pos,
511 UErrorCode* status);
512
530U_STABLE int32_t U_EXPORT2
532 UBool escapeUnprintable,
533 UChar* result, int32_t resultLength,
534 UErrorCode* status);
535
555U_STABLE USet* U_EXPORT2
557 UBool ignoreFilter,
558 USet* fillIn,
559 UErrorCode* status);
560
561/* deprecated API ----------------------------------------------------------- */
562
563#ifndef U_HIDE_DEPRECATED_API
564
565/* see utrans.h documentation for why these functions are deprecated */
566
591utrans_open(const char* id,
592 UTransDirection dir,
593 const UChar* rules, /* may be Null */
594 int32_t rulesLength, /* -1 if null-terminated */
595 UParseError* parseError, /* may be Null */
596 UErrorCode* status);
597
613U_DEPRECATED int32_t U_EXPORT2
615 char* buf,
616 int32_t bufCapacity);
617
627U_DEPRECATED void U_EXPORT2
628utrans_unregister(const char* id);
629
648U_DEPRECATED int32_t U_EXPORT2
650 char* buf,
651 int32_t bufCapacity);
652
653#endif /* U_HIDE_DEPRECATED_API */
654
655#endif /* #if !UCONFIG_NO_TRANSLITERATION */
656
657#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:562
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
A set of function pointers that transliterators use to manipulate a UReplaceable.
Definition: urep.h:53
Position structure for utrans_transIncremental() incremental transliteration.
Definition: utrans.h:122
int32_t start
Beginning index, inclusive, of the text to be transliterated.
Definition: utrans.h:151
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:142
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation.
Definition: utrans.h:132
int32_t limit
Ending index, exclusive, of the text to be transliterated.
Definition: utrans.h:160
C API: String Enumeration.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:43
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API
Definition: umachine.h:115
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
C API: Callbacks for UReplaceable.
void * UReplaceable
An opaque replaceable text object.
Definition: urep.h:44
C API: Unicode Set.
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition: uset.h:47
UTransDirection
Direction constant indicating the direction in a transliterator, e.g., the forward or reverse rules o...
Definition: utrans.h:80
@ UTRANS_FORWARD
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition: utrans.h:88
@ UTRANS_REVERSE
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition: utrans.h:96
void * UTransliterator
An opaque transliterator for use in C.
Definition: utrans.h:70
void utrans_close(UTransliterator *trans)
Close a transliterator.
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_trans(const UTransliterator *trans, UReplaceable *rep, const UReplaceableCallbacks *repFunc, int32_t start, int32_t *limit, UErrorCode *status)
Transliterate a segment of a UReplaceable string.
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 unambiguously.
void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
void utrans_transIncremental(const UTransliterator *trans, UReplaceable *rep, const UReplaceableCallbacks *repFunc, UTransPosition *pos, UErrorCode *status)
Transliterate the portion of the UReplaceable text buffer that can be transliterated unambiguously.
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.
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
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415