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
00417 U_STABLE UBiDi * U_EXPORT2
00418 ubidi_open(void);
00419
00454 U_STABLE UBiDi * U_EXPORT2
00455 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00456
00477 U_STABLE void U_EXPORT2
00478 ubidi_close(UBiDi *pBiDi);
00479
00516 U_STABLE void U_EXPORT2
00517 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00518
00529 U_STABLE UBool U_EXPORT2
00530 ubidi_isInverse(UBiDi *pBiDi);
00531
00552 U_STABLE void U_EXPORT2
00553 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00554
00566 U_STABLE UBool U_EXPORT2
00567 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00568
00647 U_STABLE void U_EXPORT2
00648 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
00649 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
00650 UErrorCode *pErrorCode);
00651
00697 U_STABLE void U_EXPORT2
00698 ubidi_setLine(const UBiDi *pParaBiDi,
00699 int32_t start, int32_t limit,
00700 UBiDi *pLineBiDi,
00701 UErrorCode *pErrorCode);
00702
00715 U_STABLE UBiDiDirection U_EXPORT2
00716 ubidi_getDirection(const UBiDi *pBiDi);
00717
00729 U_STABLE const UChar * U_EXPORT2
00730 ubidi_getText(const UBiDi *pBiDi);
00731
00740 U_STABLE int32_t U_EXPORT2
00741 ubidi_getLength(const UBiDi *pBiDi);
00742
00758 U_STABLE UBiDiLevel U_EXPORT2
00759 ubidi_getParaLevel(const UBiDi *pBiDi);
00760
00769 U_STABLE int32_t U_EXPORT2
00770 ubidi_countParagraphs(UBiDi *pBiDi);
00771
00802 U_STABLE int32_t U_EXPORT2
00803 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
00804 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
00805 UErrorCode *pErrorCode);
00806
00834 U_STABLE void U_EXPORT2
00835 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
00836 int32_t *pParaStart, int32_t *pParaLimit,
00837 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
00838
00851 U_STABLE UBiDiLevel U_EXPORT2
00852 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
00853
00871 U_STABLE const UBiDiLevel * U_EXPORT2
00872 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
00873
00896 U_STABLE void U_EXPORT2
00897 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
00898 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
00899
00915 U_STABLE int32_t U_EXPORT2
00916 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
00917
00969 U_STABLE UBiDiDirection U_EXPORT2
00970 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
00971 int32_t *pLogicalStart, int32_t *pLength);
00972
00995 U_STABLE int32_t U_EXPORT2
00996 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
00997
01018 U_STABLE int32_t U_EXPORT2
01019 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01020
01038 U_STABLE void U_EXPORT2
01039 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01040
01058 U_STABLE void U_EXPORT2
01059 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01060
01081 U_STABLE void U_EXPORT2
01082 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01083
01104 U_STABLE void U_EXPORT2
01105 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01106
01121 U_STABLE void U_EXPORT2
01122 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01123
01133 #define UBIDI_KEEP_BASE_COMBINING 1
01134
01143 #define UBIDI_DO_MIRRORING 2
01144
01154 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01155
01164 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01165
01180 #define UBIDI_OUTPUT_REVERSE 16
01181
01250 U_STABLE int32_t U_EXPORT2
01251 ubidi_writeReordered(UBiDi *pBiDi,
01252 UChar *dest, int32_t destSize,
01253 uint16_t options,
01254 UErrorCode *pErrorCode);
01255
01302 U_STABLE int32_t U_EXPORT2
01303 ubidi_writeReverse(const UChar *src, int32_t srcLength,
01304 UChar *dest, int32_t destSize,
01305 uint16_t options,
01306 UErrorCode *pErrorCode);
01307
01308
01311 #endif