Loading...
Searching...
No Matches
utrans.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 1997-2011,2014-2015 International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* Date Name Description
* 06/21/00 aliu Creation.
*******************************************************************************
*/
#ifndef UTRANS_H
#define UTRANS_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION
#include "unicode/urep.h"
#include "unicode/parseerr.h"
#include "unicode/uenum.h"
#include "unicode/uset.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
/********************************************************************
* General Notes
********************************************************************
*/
/********************************************************************
* Data Structures
********************************************************************/
typedef void* UTransliterator;
typedef enum UTransDirection {
UTRANS_FORWARD,
UTRANS_REVERSE
} UTransDirection;
typedef struct UTransPosition {
int32_t contextStart;
int32_t contextLimit;
int32_t start;
int32_t limit;
} UTransPosition;
/********************************************************************
* General API
********************************************************************/
U_CAPI UTransliterator* U_EXPORT2
utrans_openU(const UChar *id,
int32_t idLength,
UTransDirection dir,
const UChar *rules,
int32_t rulesLength,
UParseError *parseError,
UErrorCode *pErrorCode);
U_CAPI UTransliterator* U_EXPORT2
utrans_openInverse(const UTransliterator* trans,
UErrorCode* status);
U_CAPI UTransliterator* U_EXPORT2
utrans_clone(const UTransliterator* trans,
UErrorCode* status);
U_CAPI void U_EXPORT2
utrans_close(UTransliterator* trans);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
U_NAMESPACE_END
#endif
U_CAPI const UChar * U_EXPORT2
utrans_getUnicodeID(const UTransliterator *trans,
int32_t *resultLength);
U_CAPI void U_EXPORT2
utrans_register(UTransliterator* adoptedTrans,
UErrorCode* status);
U_CAPI void U_EXPORT2
utrans_unregisterID(const UChar* id, int32_t idLength);
U_CAPI void U_EXPORT2
utrans_setFilter(UTransliterator* trans,
const UChar* filterPattern,
int32_t filterPatternLen,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
utrans_countAvailableIDs(void);
U_CAPI UEnumeration * U_EXPORT2
utrans_openIDs(UErrorCode *pErrorCode);
/********************************************************************
* Transliteration API
********************************************************************/
U_CAPI void U_EXPORT2
utrans_trans(const UTransliterator* trans,
UReplaceable* rep,
const UReplaceableCallbacks* repFunc,
int32_t start,
int32_t* limit,
UErrorCode* status);
U_CAPI void U_EXPORT2
utrans_transIncremental(const UTransliterator* trans,
UReplaceable* rep,
const UReplaceableCallbacks* repFunc,
UTransPosition* pos,
UErrorCode* status);
U_CAPI void U_EXPORT2
utrans_transUChars(const UTransliterator* trans,
UChar* text,
int32_t* textLength,
int32_t textCapacity,
int32_t start,
int32_t* limit,
UErrorCode* status);
U_CAPI void U_EXPORT2
utrans_transIncrementalUChars(const UTransliterator* trans,
UChar* text,
int32_t* textLength,
int32_t textCapacity,
UTransPosition* pos,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
utrans_toRules( const UTransliterator* trans,
UBool escapeUnprintable,
UChar* result, int32_t resultLength,
UErrorCode* status);
U_CAPI USet* U_EXPORT2
utrans_getSourceSet(const UTransliterator* trans,
UBool ignoreFilter,
USet* fillIn,
UErrorCode* status);
/* deprecated API ----------------------------------------------------------- */
#ifndef U_HIDE_DEPRECATED_API
/* see utrans.h documentation for why these functions are deprecated */
U_DEPRECATED UTransliterator* U_EXPORT2
utrans_open(const char* id,
UTransDirection dir,
const UChar* rules, /* may be Null */
int32_t rulesLength, /* -1 if null-terminated */
UParseError* parseError, /* may be Null */
UErrorCode* status);
U_DEPRECATED int32_t U_EXPORT2
utrans_getID(const UTransliterator* trans,
char* buf,
int32_t bufCapacity);
U_DEPRECATED void U_EXPORT2
utrans_unregister(const char* id);
U_DEPRECATED int32_t U_EXPORT2
utrans_getAvailableID(int32_t index,
char* buf,
int32_t bufCapacity);
#endif /* U_HIDE_DEPRECATED_API */
#endif /* #if !UCONFIG_NO_TRANSLITERATION */
#endif
LocalUTransliteratorPointer
"Smart pointer" class, closes a UTransliterator via utrans_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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:548
parseerr.h
C API: Parse Error Information.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
UReplaceableCallbacks
A set of function pointers that transliterators use to manipulate a UReplaceable.
Definition urep.h:53
UTransPosition
Position structure for utrans_transIncremental() incremental transliteration.
Definition utrans.h:125
UTransPosition::start
int32_t start
Beginning index, inclusive, of the text to be transliterated.
Definition utrans.h:154
UTransPosition::contextLimit
int32_t contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation.
Definition utrans.h:145
UTransPosition::contextStart
int32_t contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation.
Definition utrans.h:135
UTransPosition::limit
int32_t limit
Ending index, exclusive, of the text to be transliterated.
Definition utrans.h:163
uenum.h
C API: String Enumeration.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition uenum.h:44
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:400
U_DEPRECATED
#define U_DEPRECATED
This is used to declare a function as a deprecated public ICU C API.
Definition umachine.h:116
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:269
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
urep.h
C API: Callbacks for UReplaceable.
UReplaceable
void * UReplaceable
An opaque replaceable text object.
Definition urep.h:44
uset.h
C API: Unicode Set.
USet
struct USet USet
USet is the C API type corresponding to C++ class UnicodeSet.
Definition uset.h:54
UTransDirection
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
UTRANS_FORWARD means from <source> to <target> for a transliterator with ID <source>-<target>.
Definition utrans.h:91
UTRANS_REVERSE
@ UTRANS_REVERSE
UTRANS_REVERSE means from <target> to <source> for a transliterator with ID <source>-<target>.
Definition utrans.h:99
utrans_clone
U_CAPI UTransliterator * utrans_clone(const UTransliterator *trans, UErrorCode *status)
Create a copy of a transliterator.
utrans_register
U_CAPI void utrans_register(UTransliterator *adoptedTrans, UErrorCode *status)
Register an open transliterator with the system.
UTransliterator
void * UTransliterator
An opaque transliterator for use in C.
Definition utrans.h:73
utrans_trans
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.
utrans_openU
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,...
utrans_setFilter
U_CAPI void utrans_setFilter(UTransliterator *trans, const UChar *filterPattern, int32_t filterPatternLen, UErrorCode *status)
Set the filter used by a transliterator.
utrans_getUnicodeID
U_CAPI const UChar * utrans_getUnicodeID(const UTransliterator *trans, int32_t *resultLength)
Return the programmatic identifier for this transliterator.
utrans_getSourceSet
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,...
utrans_transIncrementalUChars
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.
utrans_close
U_CAPI void utrans_close(UTransliterator *trans)
Close a transliterator.
utrans_getID
int32_t utrans_getID(const UTransliterator *trans, char *buf, int32_t bufCapacity)
Deprecated, use utrans_getUnicodeID() instead.
utrans_openIDs
U_CAPI UEnumeration * utrans_openIDs(UErrorCode *pErrorCode)
Return a UEnumeration for the available transliterators.
utrans_unregister
void utrans_unregister(const char *id)
Deprecated, use utrans_unregisterID() instead.
utrans_getAvailableID
int32_t utrans_getAvailableID(int32_t index, char *buf, int32_t bufCapacity)
Deprecated, use utrans_openIDs() instead.
utrans_openInverse
U_CAPI UTransliterator * utrans_openInverse(const UTransliterator *trans, UErrorCode *status)
Open an inverse of an existing transliterator.
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.
utrans_toRules
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.
utrans_countAvailableIDs
U_CAPI int32_t utrans_countAvailableIDs(void)
Return the number of system transliterators.
utrans_transUChars
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.
utrans_transIncremental
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.
utrans_unregisterID
U_CAPI void utrans_unregisterID(const UChar *id, int32_t idLength)
Unregister a transliterator from the system.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:509