UBiDiOrder
* This bidi transformation engine supports all possible combinations (4 in * total) of input and output text order: *
UBiDi
UBIDI_REORDER_DEFAULT
UBIDI_REORDER_INVERSE_LIKE_DIRECT
UBIDI_REORDER_RUNS_ONLY
UBiDiMirroring
ubidi_writeReordered
ubidi_writeReverse
UBIDI_DO_MIRRORING
UBiDiTransform
* In terms of UBiDi, such a transformation implies: *
ubidi_setReorderingMode
ubidi_setInverse
ubidi_setPara
u_shapeArabic
* There are 36 possible combinations of ordering schemes, * which are partially supported by UBiDi already. Examples of the * currently supported combinations: *
paraLevel == UBIDI_LTR
paraLevel == UBIDI_RTL
paraLevel == UBIDI_DEFAULT_LTR
paraLevel == UBIDI_DEFAULT_RTL
ubidi_setInverse(UBiDi*, TRUE)
Example of usage of the transformation engine: *
* \code * UChar text1[] = {'a', 'b', 'c', 0x0625, '1', 0}; * UChar text2[] = {'a', 'b', 'c', 0x0625, '1', 0}; * UErrorCode errorCode = U_ZERO_ERROR; * // Run a transformation. * ubiditransform_transform(pBidiTransform, * text1, -1, text2, -1, * UBIDI_LTR, UBIDI_VISUAL, * UBIDI_RTL, UBIDI_LOGICAL, * UBIDI_MIRRORING_OFF, * U_SHAPE_DIGITS_AN2EN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED, * &errorCode); * // Do something with text2. * text2[4] = '2'; * // Run a reverse transformation. * ubiditransform_transform(pBidiTransform, * text2, -1, text1, -1, * UBIDI_RTL, UBIDI_LOGICAL, * UBIDI_LTR, UBIDI_VISUAL, * UBIDI_MIRRORING_OFF, * U_SHAPE_DIGITS_EN2AN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED, * &errorCode); *\endcode *
ubiditransform_open()
NULL
* This object serves for one-time setup to amortize initialization * overheads. Use of this object is not thread-safe. All other threads * should allocate a new UBiDiTransform object by calling * ubiditransform_open() before using it. Alternatively, * a caller can set this parameter to NULL, in which case * the object will be allocated by the engine on the fly.
Note: the text must be (at least) * srcLength long.
srcLength
length == -1
dest
U_SHAPE_LETTERS_UNSHAPE
srcLength * 2
destSize
destSize == -1 is allowed and makes sense when * dest was holds some meaningful value, e.g. that of * src. In this case dest must be * zero-terminated.
destSize == -1
src
paraLevel
Note: Direction indicator options are computed by * the transformation engine based on the effective ordering schemes, so * user-defined direction indicators will be ignored.
pErrorCode
* Note:The object can only be reused in the same thread. * All other threads should allocate a new UBiDiTransform object * before using it.
* Example of usage:
*
* \code * UErrorCode errorCode = U_ZERO_ERROR; * // Open a new UBiDiTransform. * UBiDiTransform* transform = ubiditransform_open(&errorCode); * // Run a transformation. * ubiditransform_transform(transform, * text1, -1, text2, -1, * UBIDI_RTL, UBIDI_LOGICAL, * UBIDI_LTR, UBIDI_VISUAL, * UBIDI_MIRRORING_ON, * U_SHAPE_DIGITS_EN2AN, * &errorCode); * // Do something with the output text and invoke another transformation using * // that text as input. * ubiditransform_transform(transform, * text2, -1, text3, -1, * UBIDI_LTR, UBIDI_VISUAL, * UBIDI_RTL, UBIDI_VISUAL, * UBIDI_MIRRORING_ON, * 0, &errorCode); *\endcode *
* The UBiDiTransform object must be deallocated by calling * ubiditransform_close(). * * @return An empty UBiDiTransform object. * @stable ICU 58 */ U_STABLE UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode); /** * Deallocates the given UBiDiTransform object. * @stable ICU 58 */ U_STABLE void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBidiTransform); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUBiDiTransformPointer * "Smart pointer" class, closes a UBiDiTransform via ubiditransform_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 58 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close); U_NAMESPACE_END #endif #endif
ubiditransform_close()