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
01075 U_STABLE void U_EXPORT2
01076 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01077 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01078 UErrorCode *pErrorCode);
01079
01126 U_STABLE void U_EXPORT2
01127 ubidi_setLine(const UBiDi *pParaBiDi,
01128 int32_t start, int32_t limit,
01129 UBiDi *pLineBiDi,
01130 UErrorCode *pErrorCode);
01131
01146 U_STABLE UBiDiDirection U_EXPORT2
01147 ubidi_getDirection(const UBiDi *pBiDi);
01148
01160 U_STABLE const UChar * U_EXPORT2
01161 ubidi_getText(const UBiDi *pBiDi);
01162
01171 U_STABLE int32_t U_EXPORT2
01172 ubidi_getLength(const UBiDi *pBiDi);
01173
01189 U_STABLE UBiDiLevel U_EXPORT2
01190 ubidi_getParaLevel(const UBiDi *pBiDi);
01191
01200 U_STABLE int32_t U_EXPORT2
01201 ubidi_countParagraphs(UBiDi *pBiDi);
01202
01237 U_STABLE int32_t U_EXPORT2
01238 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01239 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01240 UErrorCode *pErrorCode);
01241
01269 U_STABLE void U_EXPORT2
01270 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01271 int32_t *pParaStart, int32_t *pParaLimit,
01272 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01273
01289 U_STABLE UBiDiLevel U_EXPORT2
01290 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01291
01310 U_STABLE const UBiDiLevel * U_EXPORT2
01311 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01312
01337 U_STABLE void U_EXPORT2
01338 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01339 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01340
01356 U_STABLE int32_t U_EXPORT2
01357 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01358
01414 U_STABLE UBiDiDirection U_EXPORT2
01415 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01416 int32_t *pLogicalStart, int32_t *pLength);
01417
01455 U_STABLE int32_t U_EXPORT2
01456 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01457
01490 U_STABLE int32_t U_EXPORT2
01491 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01492
01533 U_STABLE void U_EXPORT2
01534 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01535
01569 U_STABLE void U_EXPORT2
01570 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01571
01592 U_STABLE void U_EXPORT2
01593 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01594
01615 U_STABLE void U_EXPORT2
01616 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01617
01650 U_STABLE void U_EXPORT2
01651 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01652
01662 #define UBIDI_KEEP_BASE_COMBINING 1
01663
01672 #define UBIDI_DO_MIRRORING 2
01673
01686 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01687
01699 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01700
01715 #define UBIDI_OUTPUT_REVERSE 16
01716
01755 U_STABLE int32_t U_EXPORT2
01756 ubidi_getProcessedLength(const UBiDi *pBiDi);
01757
01785 U_STABLE int32_t U_EXPORT2
01786 ubidi_getResultLength(const UBiDi *pBiDi);
01787
01788 U_CDECL_BEGIN
01795 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01796
01817 typedef UCharDirection U_CALLCONV
01818 UBiDiClassCallback(const void *context, UChar32 c);
01819
01820 U_CDECL_END
01821
01837 U_STABLE UCharDirection U_EXPORT2
01838 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
01839
01867 U_STABLE void U_EXPORT2
01868 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
01869 const void *newContext, UBiDiClassCallback **oldFn,
01870 const void **oldContext, UErrorCode *pErrorCode);
01871
01884 U_STABLE void U_EXPORT2
01885 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
01886
01952 U_STABLE int32_t U_EXPORT2
01953 ubidi_writeReordered(UBiDi *pBiDi,
01954 UChar *dest, int32_t destSize,
01955 uint16_t options,
01956 UErrorCode *pErrorCode);
01957
02004 U_STABLE int32_t U_EXPORT2
02005 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02006 UChar *dest, int32_t destSize,
02007 uint16_t options,
02008 UErrorCode *pErrorCode);
02009
02010
02013 #endif