ICU 75.1 75.1
Loading...
Searching...
No Matches
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/urep.h"
21#include "unicode/parseerr.h"
22#include "unicode/uenum.h"
23#include "unicode/uset.h"
24
25#if U_SHOW_CPLUSPLUS_API
27#endif // U_SHOW_CPLUSPLUS_API
28
29/********************************************************************
30 * General Notes
31 ********************************************************************
32 */
62/********************************************************************
63 * Data Structures
64 ********************************************************************/
65
73typedef void* UTransliterator;
74
102
125typedef struct UTransPosition {
126
136
146
154 int32_t start;
155
163 int32_t limit;
164
166
167/********************************************************************
168 * General API
169 ********************************************************************/
170
194U_CAPI UTransliterator* U_EXPORT2
196 int32_t idLength,
197 UTransDirection dir,
198 const UChar *rules,
199 int32_t rulesLength,
200 UParseError *parseError,
201 UErrorCode *pErrorCode);
202
218U_CAPI UTransliterator* U_EXPORT2
220 UErrorCode* status);
221
232U_CAPI UTransliterator* U_EXPORT2
234 UErrorCode* status);
235
242U_CAPI void U_EXPORT2
244
245#if U_SHOW_CPLUSPLUS_API
246
247U_NAMESPACE_BEGIN
248
259
260U_NAMESPACE_END
261
262#endif
263
278U_CAPI const UChar * U_EXPORT2
280 int32_t *resultLength);
281
296U_CAPI void U_EXPORT2
298 UErrorCode* status);
299
309U_CAPI void U_EXPORT2
310utrans_unregisterID(const UChar* id, int32_t idLength);
311
330U_CAPI void U_EXPORT2
332 const UChar* filterPattern,
333 int32_t filterPatternLen,
334 UErrorCode* status);
335
343U_CAPI int32_t U_EXPORT2
345
355U_CAPI UEnumeration * U_EXPORT2
357
358/********************************************************************
359 * Transliteration API
360 ********************************************************************/
361
385U_CAPI void U_EXPORT2
387 UReplaceable* rep,
388 const UReplaceableCallbacks* repFunc,
389 int32_t start,
390 int32_t* limit,
391 UErrorCode* status);
392
436U_CAPI void U_EXPORT2
438 UReplaceable* rep,
439 const UReplaceableCallbacks* repFunc,
440 UTransPosition* pos,
441 UErrorCode* status);
442
473U_CAPI void U_EXPORT2
475 UChar* text,
476 int32_t* textLength,
477 int32_t textCapacity,
478 int32_t start,
479 int32_t* limit,
480 UErrorCode* status);
481
508U_CAPI void U_EXPORT2
510 UChar* text,
511 int32_t* textLength,
512 int32_t textCapacity,
513 UTransPosition* pos,
514 UErrorCode* status);
515
533U_CAPI int32_t U_EXPORT2
535 UBool escapeUnprintable,
536 UChar* result, int32_t resultLength,
537 UErrorCode* status);
538
558U_CAPI USet* U_EXPORT2
560 UBool ignoreFilter,
561 USet* fillIn,
562 UErrorCode* status);
563
564/* deprecated API ----------------------------------------------------------- */
565
566#ifndef U_HIDE_DEPRECATED_API
567
568/* see utrans.h documentation for why these functions are deprecated */
569
594utrans_open(const char* id,
595 UTransDirection dir,
596 const UChar* rules, /* may be Null */
597 int32_t rulesLength, /* -1 if null-terminated */
598 UParseError* parseError, /* may be Null */
599 UErrorCode* status);
600
616U_DEPRECATED int32_t U_EXPORT2
618 char* buf,
619 int32_t bufCapacity);
620
630U_DEPRECATED void U_EXPORT2
631utrans_unregister(const char* id);
632
651U_DEPRECATED int32_t U_EXPORT2
653 char* buf,
654 int32_t bufCapacity);
655
656#endif /* U_HIDE_DEPRECATED_API */
657
658#endif /* #if !UCONFIG_NO_TRANSLITERATION */
659
660#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.
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:125
int32_t start
Beginning index, inclusive, of the text to be transliterated.
Definition utrans.h:154
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition utrans.h:145
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation.
Definition utrans.h:135
int32_t limit
Ending index, exclusive, of the text to be transliterated.
Definition utrans.h:163
C API: String Enumeration.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition uenum.h:44
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API
Definition umachine.h:116
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:247
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:378
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:50
UTransDirection
Direction constant indicating the direction in a transliterator, e.g., the forward or reverse rules o...
Definition utrans.h:83
@ UTRANS_FORWARD
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition utrans.h:91
@ UTRANS_REVERSE
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition utrans.h:99
U_CAPI UTransliterator * utrans_clone(const UTransliterator *trans, UErrorCode *status)
Create a copy of a transliterator.
U_CAPI void utrans_register(UTransliterator *adoptedTrans, UErrorCode *status)
Register an open transliterator with the system.
void * UTransliterator
An opaque transliterator for use in C.
Definition utrans.h:73
U_CAPI 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.
U_CAPI 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,...
U_CAPI void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
U_CAPI const UChar * utrans_getUnicodeID(const UTransliterator *trans, int32_t *resultLength)
Return the programmatic identifier for this transliterator.
U_CAPI 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,...
U_CAPI 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.
U_CAPI void utrans_close(UTransliterator *trans)
Close a transliterator.
int32_t utrans_getID(const UTransliterator *trans, char *buf, int32_t bufCapacity)
Deprecated, use utrans_getUnicodeID() instead.
U_CAPI UEnumeration * utrans_openIDs(UErrorCode *pErrorCode)
Return a UEnumeration for the available transliterators.
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.
U_CAPI UTransliterator * utrans_openInverse(const UTransliterator *trans, UErrorCode *status)
Open an inverse of an existing transliterator.
UTransliterator * utrans_open(const char *id, UTransDirection dir, const UChar *rules, int32_t rulesLength, UParseError *parseError, UErrorCode *status)
Deprecated, use utrans_openU() instead.
U_CAPI 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.
U_CAPI int32_t utrans_countAvailableIDs(void)
Return the number of system transliterators.
U_CAPI 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.
U_CAPI 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.
U_CAPI void utrans_unregisterID(const UChar *id, int32_t idLength)
Unregister a transliterator from the system.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415