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
00356 #define UBIDI_DEFAULT_LTR 0xfe
00357
00383 #define UBIDI_DEFAULT_RTL 0xff
00384
00390 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00391
00396 #define UBIDI_LEVEL_OVERRIDE 0x80
00397
00411 #define UBIDI_MAP_NOWHERE (-1)
00412
00417 enum UBiDiDirection {
00419 UBIDI_LTR,
00421 UBIDI_RTL,
00423 UBIDI_MIXED
00424 };
00425
00427 typedef enum UBiDiDirection UBiDiDirection;
00428
00439 struct UBiDi;
00440
00442 typedef struct UBiDi UBiDi;
00443
00459 U_STABLE UBiDi * U_EXPORT2
00460 ubidi_open(void);
00461
00496 U_STABLE UBiDi * U_EXPORT2
00497 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00498
00519 U_STABLE void U_EXPORT2
00520 ubidi_close(UBiDi *pBiDi);
00521
00570 U_STABLE void U_EXPORT2
00571 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00572
00589 U_STABLE UBool U_EXPORT2
00590 ubidi_isInverse(UBiDi *pBiDi);
00591
00612 U_STABLE void U_EXPORT2
00613 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00614
00626 U_STABLE UBool U_EXPORT2
00627 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00628
00636 typedef enum UBiDiReorderingMode {
00640 UBIDI_REORDER_DEFAULT = 0,
00644 UBIDI_REORDER_NUMBERS_SPECIAL,
00648 UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00656 UBIDI_REORDER_RUNS_ONLY,
00661 UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00665 UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00669 UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00672 UBIDI_REORDER_COUNT
00673 } UBiDiReorderingMode;
00674
00828 U_STABLE void U_EXPORT2
00829 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00830
00839 U_STABLE UBiDiReorderingMode U_EXPORT2
00840 ubidi_getReorderingMode(UBiDi *pBiDi);
00841
00849 typedef enum UBiDiReorderingOption {
00856 UBIDI_OPTION_DEFAULT = 0,
00857
00902 UBIDI_OPTION_INSERT_MARKS = 1,
00903
00920 UBIDI_OPTION_REMOVE_CONTROLS = 2,
00921
00968 UBIDI_OPTION_STREAMING = 4
00969 } UBiDiReorderingOption;
00970
00984 U_STABLE void U_EXPORT2
00985 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
00986
00995 U_STABLE uint32_t U_EXPORT2
00996 ubidi_getReorderingOptions(UBiDi *pBiDi);
00997
01077 U_STABLE void U_EXPORT2
01078 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01079 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01080 UErrorCode *pErrorCode);
01081
01128 U_STABLE void U_EXPORT2
01129 ubidi_setLine(const UBiDi *pParaBiDi,
01130 int32_t start, int32_t limit,
01131 UBiDi *pLineBiDi,
01132 UErrorCode *pErrorCode);
01133
01148 U_STABLE UBiDiDirection U_EXPORT2
01149 ubidi_getDirection(const UBiDi *pBiDi);
01150
01162 U_STABLE const UChar * U_EXPORT2
01163 ubidi_getText(const UBiDi *pBiDi);
01164
01173 U_STABLE int32_t U_EXPORT2
01174 ubidi_getLength(const UBiDi *pBiDi);
01175
01191 U_STABLE UBiDiLevel U_EXPORT2
01192 ubidi_getParaLevel(const UBiDi *pBiDi);
01193
01202 U_STABLE int32_t U_EXPORT2
01203 ubidi_countParagraphs(UBiDi *pBiDi);
01204
01239 U_STABLE int32_t U_EXPORT2
01240 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01241 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01242 UErrorCode *pErrorCode);
01243
01271 U_STABLE void U_EXPORT2
01272 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01273 int32_t *pParaStart, int32_t *pParaLimit,
01274 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01275
01291 U_STABLE UBiDiLevel U_EXPORT2
01292 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01293
01312 U_STABLE const UBiDiLevel * U_EXPORT2
01313 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01314
01339 U_STABLE void U_EXPORT2
01340 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01341 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01342
01358 U_STABLE int32_t U_EXPORT2
01359 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01360
01416 U_STABLE UBiDiDirection U_EXPORT2
01417 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01418 int32_t *pLogicalStart, int32_t *pLength);
01419
01457 U_STABLE int32_t U_EXPORT2
01458 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01459
01492 U_STABLE int32_t U_EXPORT2
01493 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01494
01535 U_STABLE void U_EXPORT2
01536 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01537
01571 U_STABLE void U_EXPORT2
01572 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01573
01594 U_STABLE void U_EXPORT2
01595 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01596
01617 U_STABLE void U_EXPORT2
01618 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01619
01652 U_STABLE void U_EXPORT2
01653 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01654
01664 #define UBIDI_KEEP_BASE_COMBINING 1
01665
01674 #define UBIDI_DO_MIRRORING 2
01675
01688 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01689
01701 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01702
01717 #define UBIDI_OUTPUT_REVERSE 16
01718
01757 U_STABLE int32_t U_EXPORT2
01758 ubidi_getProcessedLength(const UBiDi *pBiDi);
01759
01787 U_STABLE int32_t U_EXPORT2
01788 ubidi_getResultLength(const UBiDi *pBiDi);
01789
01790 U_CDECL_BEGIN
01797 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01798
01819 typedef UCharDirection U_CALLCONV
01820 UBiDiClassCallback(const void *context, UChar32 c);
01821
01822 U_CDECL_END
01823
01839 U_STABLE UCharDirection U_EXPORT2
01840 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
01841
01869 U_STABLE void U_EXPORT2
01870 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
01871 const void *newContext, UBiDiClassCallback **oldFn,
01872 const void **oldContext, UErrorCode *pErrorCode);
01873
01886 U_STABLE void U_EXPORT2
01887 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
01888
01954 U_STABLE int32_t U_EXPORT2
01955 ubidi_writeReordered(UBiDi *pBiDi,
01956 UChar *dest, int32_t destSize,
01957 uint16_t options,
01958 UErrorCode *pErrorCode);
01959
02006 U_STABLE int32_t U_EXPORT2
02007 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02008 UChar *dest, int32_t destSize,
02009 uint16_t options,
02010 UErrorCode *pErrorCode);
02011
02012
02015 #endif