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
00287
00330 typedef uint8_t UBiDiLevel;
00331
00336 #define UBIDI_DEFAULT_LTR 0xfe
00337
00342 #define UBIDI_DEFAULT_RTL 0xff
00343
00349 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00350
00355 #define UBIDI_LEVEL_OVERRIDE 0x80
00356
00370 #define UBIDI_MAP_NOWHERE (-1)
00371
00376 enum UBiDiDirection {
00378 UBIDI_LTR,
00380 UBIDI_RTL,
00382 UBIDI_MIXED
00383 };
00384
00386 typedef enum UBiDiDirection UBiDiDirection;
00387
00398 struct UBiDi;
00399
00401 typedef struct UBiDi UBiDi;
00402
00418 U_STABLE UBiDi * U_EXPORT2
00419 ubidi_open(void);
00420
00455 U_STABLE UBiDi * U_EXPORT2
00456 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00457
00478 U_STABLE void U_EXPORT2
00479 ubidi_close(UBiDi *pBiDi);
00480
00529 U_STABLE void U_EXPORT2
00530 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00531
00548 U_STABLE UBool U_EXPORT2
00549 ubidi_isInverse(UBiDi *pBiDi);
00550
00571 U_STABLE void U_EXPORT2
00572 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00573
00585 U_STABLE UBool U_EXPORT2
00586 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00587
00595 typedef enum UBiDiReorderingMode {
00598 UBIDI_REORDER_DEFAULT = 0,
00602 UBIDI_REORDER_NUMBERS_SPECIAL,
00606 UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00614 UBIDI_REORDER_RUNS_ONLY,
00619 UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00622 UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00626 UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00629 UBIDI_REORDER_COUNT
00630 } UBiDiReorderingMode;
00631
00785 U_DRAFT void U_EXPORT2
00786 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00787
00796 U_DRAFT UBiDiReorderingMode U_EXPORT2
00797 ubidi_getReorderingMode(UBiDi *pBiDi);
00798
00806 typedef enum UBiDiReorderingOption {
00813 UBIDI_OPTION_DEFAULT = 0,
00814
00859 UBIDI_OPTION_INSERT_MARKS = 1,
00860
00877 UBIDI_OPTION_REMOVE_CONTROLS = 2,
00878
00925 UBIDI_OPTION_STREAMING = 4
00926 } UBiDiReorderingOption;
00927
00941 U_DRAFT void U_EXPORT2
00942 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
00943
00952 U_DRAFT uint32_t U_EXPORT2
00953 ubidi_getReorderingOptions(UBiDi *pBiDi);
00954
01032 U_STABLE void U_EXPORT2
01033 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01034 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01035 UErrorCode *pErrorCode);
01036
01083 U_STABLE void U_EXPORT2
01084 ubidi_setLine(const UBiDi *pParaBiDi,
01085 int32_t start, int32_t limit,
01086 UBiDi *pLineBiDi,
01087 UErrorCode *pErrorCode);
01088
01101 U_STABLE UBiDiDirection U_EXPORT2
01102 ubidi_getDirection(const UBiDi *pBiDi);
01103
01115 U_STABLE const UChar * U_EXPORT2
01116 ubidi_getText(const UBiDi *pBiDi);
01117
01126 U_STABLE int32_t U_EXPORT2
01127 ubidi_getLength(const UBiDi *pBiDi);
01128
01144 U_STABLE UBiDiLevel U_EXPORT2
01145 ubidi_getParaLevel(const UBiDi *pBiDi);
01146
01155 U_STABLE int32_t U_EXPORT2
01156 ubidi_countParagraphs(UBiDi *pBiDi);
01157
01190 U_STABLE int32_t U_EXPORT2
01191 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01192 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01193 UErrorCode *pErrorCode);
01194
01222 U_STABLE void U_EXPORT2
01223 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01224 int32_t *pParaStart, int32_t *pParaLimit,
01225 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01226
01240 U_STABLE UBiDiLevel U_EXPORT2
01241 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01242
01261 U_STABLE const UBiDiLevel * U_EXPORT2
01262 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01263
01288 U_STABLE void U_EXPORT2
01289 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
01290 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01291
01307 U_STABLE int32_t U_EXPORT2
01308 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01309
01361 U_STABLE UBiDiDirection U_EXPORT2
01362 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01363 int32_t *pLogicalStart, int32_t *pLength);
01364
01392 U_STABLE int32_t U_EXPORT2
01393 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01394
01420 U_STABLE int32_t U_EXPORT2
01421 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01422
01449 U_STABLE void U_EXPORT2
01450 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01451
01478 U_STABLE void U_EXPORT2
01479 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01480
01501 U_STABLE void U_EXPORT2
01502 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01503
01524 U_STABLE void U_EXPORT2
01525 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01526
01554 U_STABLE void U_EXPORT2
01555 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01556
01566 #define UBIDI_KEEP_BASE_COMBINING 1
01567
01576 #define UBIDI_DO_MIRRORING 2
01577
01590 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01591
01603 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01604
01619 #define UBIDI_OUTPUT_REVERSE 16
01620
01659 U_DRAFT int32_t U_EXPORT2
01660 ubidi_getProcessedLength(const UBiDi *pBiDi);
01661
01689 U_DRAFT int32_t U_EXPORT2
01690 ubidi_getResultLength(const UBiDi *pBiDi);
01691
01692 U_CDECL_BEGIN
01699 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01700
01721 typedef UCharDirection U_CALLCONV
01722 UBiDiClassCallback(const void *context, UChar32 c);
01723
01724 U_CDECL_END
01725
01741 U_DRAFT UCharDirection U_EXPORT2
01742 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
01743
01771 U_DRAFT void U_EXPORT2
01772 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
01773 const void *newContext, UBiDiClassCallback **oldFn,
01774 const void **oldContext, UErrorCode *pErrorCode);
01775
01788 U_DRAFT void U_EXPORT2
01789 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
01790
01856 U_STABLE int32_t U_EXPORT2
01857 ubidi_writeReordered(UBiDi *pBiDi,
01858 UChar *dest, int32_t destSize,
01859 uint16_t options,
01860 UErrorCode *pErrorCode);
01861
01908 U_STABLE int32_t U_EXPORT2
01909 ubidi_writeReverse(const UChar *src, int32_t srcLength,
01910 UChar *dest, int32_t destSize,
01911 uint16_t options,
01912 UErrorCode *pErrorCode);
01913
01914
01917 #endif