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
00337 typedef uint8_t UBiDiLevel;
00338
00342 #define UBIDI_DEFAULT_LTR 0xfe
00343
00347 #define UBIDI_DEFAULT_RTL 0xff
00348
00354 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00355
00359 #define UBIDI_LEVEL_OVERRIDE 0x80
00360
00364 enum UBiDiDirection {
00366 UBIDI_LTR,
00368 UBIDI_RTL,
00370 UBIDI_MIXED
00371 };
00372
00373 typedef enum UBiDiDirection UBiDiDirection;
00374
00384 struct UBiDi;
00385
00386 typedef struct UBiDi UBiDi;
00387
00401 U_CAPI UBiDi * U_EXPORT2
00402 ubidi_open(void);
00403
00438 U_CAPI UBiDi * U_EXPORT2
00439 ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErrorCode);
00440
00458 U_CAPI void U_EXPORT2
00459 ubidi_close(UBiDi *pBiDi);
00460
00496 U_CAPI void U_EXPORT2
00497 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00498
00506 U_CAPI UBool U_EXPORT2
00507 ubidi_isInverse(UBiDi *pBiDi);
00508
00579 U_CAPI void U_EXPORT2
00580 ubidi_setPara(UBiDi *pBiDi, const UChar *text, UTextOffset length,
00581 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
00582 UErrorCode *pErrorCode);
00583
00626 U_CAPI void U_EXPORT2
00627 ubidi_setLine(const UBiDi *pParaBiDi,
00628 UTextOffset start, UTextOffset limit,
00629 UBiDi *pLineBiDi,
00630 UErrorCode *pErrorCode);
00631
00643 U_CAPI UBiDiDirection U_EXPORT2
00644 ubidi_getDirection(const UBiDi *pBiDi);
00645
00656 U_CAPI const UChar * U_EXPORT2
00657 ubidi_getText(const UBiDi *pBiDi);
00658
00666 U_CAPI UTextOffset U_EXPORT2
00667 ubidi_getLength(const UBiDi *pBiDi);
00668
00678 U_CAPI UBiDiLevel U_EXPORT2
00679 ubidi_getParaLevel(const UBiDi *pBiDi);
00680
00692 U_CAPI UBiDiLevel U_EXPORT2
00693 ubidi_getLevelAt(const UBiDi *pBiDi, UTextOffset charIndex);
00694
00711 U_CAPI const UBiDiLevel * U_EXPORT2
00712 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
00713
00735 U_CAPI void U_EXPORT2
00736 ubidi_getLogicalRun(const UBiDi *pBiDi, UTextOffset logicalStart,
00737 UTextOffset *pLogicalLimit, UBiDiLevel *pLevel);
00738
00754 U_CAPI UTextOffset U_EXPORT2
00755 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
00756
00807 U_CAPI UBiDiDirection U_EXPORT2
00808 ubidi_getVisualRun(UBiDi *pBiDi, UTextOffset runIndex,
00809 UTextOffset *pLogicalStart, UTextOffset *pLength);
00810
00833 U_CAPI UTextOffset U_EXPORT2
00834 ubidi_getVisualIndex(UBiDi *pBiDi, UTextOffset logicalIndex, UErrorCode *pErrorCode);
00835
00856 U_CAPI UTextOffset U_EXPORT2
00857 ubidi_getLogicalIndex(UBiDi *pBiDi, UTextOffset visualIndex, UErrorCode *pErrorCode);
00858
00876 U_CAPI void U_EXPORT2
00877 ubidi_getLogicalMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode);
00878
00896 U_CAPI void U_EXPORT2
00897 ubidi_getVisualMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode);
00898
00918 U_CAPI void U_EXPORT2
00919 ubidi_reorderLogical(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap);
00920
00940 U_CAPI void U_EXPORT2
00941 ubidi_reorderVisual(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap);
00942
00956 U_CAPI void U_EXPORT2
00957 ubidi_invertMap(const UTextOffset *srcMap, UTextOffset *destMap, UTextOffset length);
00958
00967 #define UBIDI_KEEP_BASE_COMBINING 1
00968
00976 #define UBIDI_DO_MIRRORING 2
00977
00986 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
00987
00995 #define UBIDI_REMOVE_BIDI_CONTROLS 8
00996
01010 #define UBIDI_OUTPUT_REVERSE 16
01011
01068 U_CAPI UTextOffset U_EXPORT2
01069 ubidi_writeReordered(UBiDi *pBiDi,
01070 UChar *dest, int32_t destSize,
01071 uint16_t options,
01072 UErrorCode *pErrorCode);
01073
01120 U_CAPI UTextOffset U_EXPORT2
01121 ubidi_writeReverse(const UChar *src, int32_t srcLength,
01122 UChar *dest, int32_t destSize,
01123 uint16_t options,
01124 UErrorCode *pErrorCode);
01125
01129
01132 #endif