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
00296
00338 typedef uint8_t UBiDiLevel;
00339
00344 #define UBIDI_DEFAULT_LTR 0xfe
00345
00350 #define UBIDI_DEFAULT_RTL 0xff
00351
00357 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00358
00363 #define UBIDI_LEVEL_OVERRIDE 0x80
00364
00369 enum UBiDiDirection {
00371 UBIDI_LTR,
00373 UBIDI_RTL,
00375 UBIDI_MIXED
00376 };
00377
00379 typedef enum UBiDiDirection UBiDiDirection;
00380
00391 struct UBiDi;
00392
00394 typedef struct UBiDi UBiDi;
00395
00410 U_CAPI UBiDi * U_EXPORT2
00411 ubidi_open(void);
00412
00448 U_CAPI UBiDi * U_EXPORT2
00449 ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErrorCode);
00450
00469 U_CAPI void U_EXPORT2
00470 ubidi_close(UBiDi *pBiDi);
00471
00508 U_CAPI void U_EXPORT2
00509 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00510
00519 U_CAPI UBool U_EXPORT2
00520 ubidi_isInverse(UBiDi *pBiDi);
00521
00593 U_CAPI void U_EXPORT2
00594 ubidi_setPara(UBiDi *pBiDi, const UChar *text, UTextOffset length,
00595 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
00596 UErrorCode *pErrorCode);
00597
00641 U_CAPI void U_EXPORT2
00642 ubidi_setLine(const UBiDi *pParaBiDi,
00643 UTextOffset start, UTextOffset limit,
00644 UBiDi *pLineBiDi,
00645 UErrorCode *pErrorCode);
00646
00659 U_CAPI UBiDiDirection U_EXPORT2
00660 ubidi_getDirection(const UBiDi *pBiDi);
00661
00673 U_CAPI const UChar * U_EXPORT2
00674 ubidi_getText(const UBiDi *pBiDi);
00675
00684 U_CAPI UTextOffset U_EXPORT2
00685 ubidi_getLength(const UBiDi *pBiDi);
00686
00697 U_CAPI UBiDiLevel U_EXPORT2
00698 ubidi_getParaLevel(const UBiDi *pBiDi);
00699
00712 U_CAPI UBiDiLevel U_EXPORT2
00713 ubidi_getLevelAt(const UBiDi *pBiDi, UTextOffset charIndex);
00714
00732 U_CAPI const UBiDiLevel * U_EXPORT2
00733 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
00734
00757 U_CAPI void U_EXPORT2
00758 ubidi_getLogicalRun(const UBiDi *pBiDi, UTextOffset logicalStart,
00759 UTextOffset *pLogicalLimit, UBiDiLevel *pLevel);
00760
00777 U_CAPI UTextOffset U_EXPORT2
00778 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
00779
00831 U_CAPI UBiDiDirection U_EXPORT2
00832 ubidi_getVisualRun(UBiDi *pBiDi, UTextOffset runIndex,
00833 UTextOffset *pLogicalStart, UTextOffset *pLength);
00834
00858 U_CAPI UTextOffset U_EXPORT2
00859 ubidi_getVisualIndex(UBiDi *pBiDi, UTextOffset logicalIndex, UErrorCode *pErrorCode);
00860
00882 U_CAPI UTextOffset U_EXPORT2
00883 ubidi_getLogicalIndex(UBiDi *pBiDi, UTextOffset visualIndex, UErrorCode *pErrorCode);
00884
00903 U_CAPI void U_EXPORT2
00904 ubidi_getLogicalMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode);
00905
00924 U_CAPI void U_EXPORT2
00925 ubidi_getVisualMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode);
00926
00947 U_CAPI void U_EXPORT2
00948 ubidi_reorderLogical(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap);
00949
00970 U_CAPI void U_EXPORT2
00971 ubidi_reorderVisual(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap);
00972
00987 U_CAPI void U_EXPORT2
00988 ubidi_invertMap(const UTextOffset *srcMap, UTextOffset *destMap, UTextOffset length);
00989
00999 #define UBIDI_KEEP_BASE_COMBINING 1
01000
01009 #define UBIDI_DO_MIRRORING 2
01010
01020 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01021
01030 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01031
01046 #define UBIDI_OUTPUT_REVERSE 16
01047
01105 U_CAPI UTextOffset U_EXPORT2
01106 ubidi_writeReordered(UBiDi *pBiDi,
01107 UChar *dest, int32_t destSize,
01108 uint16_t options,
01109 UErrorCode *pErrorCode);
01110
01158 U_CAPI UTextOffset U_EXPORT2
01159 ubidi_writeReverse(const UChar *src, int32_t srcLength,
01160 UChar *dest, int32_t destSize,
01161 uint16_t options,
01162 UErrorCode *pErrorCode);
01163
01167
01170 #endif