00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef UBIDI_H
00018 #define UBIDI_H
00019
00020 #include "unicode/utypes.h"
00021 #include "unicode/uchar.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00301
00344 typedef uint8_t UBiDiLevel;
00345
00350 #define UBIDI_DEFAULT_LTR 0xfe
00351
00356 #define UBIDI_DEFAULT_RTL 0xff
00357
00363 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00364
00369 #define UBIDI_LEVEL_OVERRIDE 0x80
00370
00375 enum UBiDiDirection {
00377 UBIDI_LTR,
00379 UBIDI_RTL,
00381 UBIDI_MIXED
00382 };
00383
00385 typedef enum UBiDiDirection UBiDiDirection;
00386
00397 struct UBiDi;
00398
00400 typedef struct UBiDi UBiDi;
00401
00416 U_CAPI UBiDi * U_EXPORT2
00417 ubidi_open(void);
00418
00454 U_CAPI UBiDi * U_EXPORT2
00455 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00456
00475 U_CAPI void U_EXPORT2
00476 ubidi_close(UBiDi *pBiDi);
00477
00514 U_CAPI void U_EXPORT2
00515 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00516
00526 U_CAPI UBool U_EXPORT2
00527 ubidi_isInverse(UBiDi *pBiDi);
00528
00600 U_CAPI void U_EXPORT2
00601 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
00602 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
00603 UErrorCode *pErrorCode);
00604
00648 U_CAPI void U_EXPORT2
00649 ubidi_setLine(const UBiDi *pParaBiDi,
00650 int32_t start, int32_t limit,
00651 UBiDi *pLineBiDi,
00652 UErrorCode *pErrorCode);
00653
00666 U_CAPI UBiDiDirection U_EXPORT2
00667 ubidi_getDirection(const UBiDi *pBiDi);
00668
00680 U_CAPI const UChar * U_EXPORT2
00681 ubidi_getText(const UBiDi *pBiDi);
00682
00691 U_CAPI int32_t U_EXPORT2
00692 ubidi_getLength(const UBiDi *pBiDi);
00693
00704 U_CAPI UBiDiLevel U_EXPORT2
00705 ubidi_getParaLevel(const UBiDi *pBiDi);
00706
00719 U_CAPI UBiDiLevel U_EXPORT2
00720 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
00721
00739 U_CAPI const UBiDiLevel * U_EXPORT2
00740 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
00741
00764 U_CAPI void U_EXPORT2
00765 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
00766 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
00767
00784 U_CAPI int32_t U_EXPORT2
00785 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
00786
00838 U_CAPI UBiDiDirection U_EXPORT2
00839 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
00840 int32_t *pLogicalStart, int32_t *pLength);
00841
00865 U_CAPI int32_t U_EXPORT2
00866 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
00867
00889 U_CAPI int32_t U_EXPORT2
00890 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
00891
00910 U_CAPI void U_EXPORT2
00911 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
00912
00931 U_CAPI void U_EXPORT2
00932 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
00933
00954 U_CAPI void U_EXPORT2
00955 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
00956
00977 U_CAPI void U_EXPORT2
00978 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
00979
00994 U_CAPI void U_EXPORT2
00995 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
00996
01006 #define UBIDI_KEEP_BASE_COMBINING 1
01007
01016 #define UBIDI_DO_MIRRORING 2
01017
01027 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01028
01037 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01038
01053 #define UBIDI_OUTPUT_REVERSE 16
01054
01112 U_CAPI int32_t U_EXPORT2
01113 ubidi_writeReordered(UBiDi *pBiDi,
01114 UChar *dest, int32_t destSize,
01115 uint16_t options,
01116 UErrorCode *pErrorCode);
01117
01165 U_CAPI int32_t U_EXPORT2
01166 ubidi_writeReverse(const UChar *src, int32_t srcLength,
01167 UChar *dest, int32_t destSize,
01168 uint16_t options,
01169 UErrorCode *pErrorCode);
01170
01171
01174 #endif