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 #include "unicode/localpointer.h"
00023
00288
00331 typedef uint8_t UBiDiLevel;
00332
00357 #define UBIDI_DEFAULT_LTR 0xfe
00358
00384 #define UBIDI_DEFAULT_RTL 0xff
00385
00391 #define UBIDI_MAX_EXPLICIT_LEVEL 61
00392
00397 #define UBIDI_LEVEL_OVERRIDE 0x80
00398
00412 #define UBIDI_MAP_NOWHERE (-1)
00413
00418 enum UBiDiDirection {
00420 UBIDI_LTR,
00422 UBIDI_RTL,
00424 UBIDI_MIXED
00425 };
00426
00428 typedef enum UBiDiDirection UBiDiDirection;
00429
00440 struct UBiDi;
00441
00443 typedef struct UBiDi UBiDi;
00444
00460 U_STABLE UBiDi * U_EXPORT2
00461 ubidi_open(void);
00462
00497 U_STABLE UBiDi * U_EXPORT2
00498 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00499
00520 U_STABLE void U_EXPORT2
00521 ubidi_close(UBiDi *pBiDi);
00522
00523 #if U_SHOW_CPLUSPLUS_API
00524
00525 U_NAMESPACE_BEGIN
00526
00536 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
00537
00538 U_NAMESPACE_END
00539
00540 #endif
00541
00590 U_STABLE void U_EXPORT2
00591 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00592
00609 U_STABLE UBool U_EXPORT2
00610 ubidi_isInverse(UBiDi *pBiDi);
00611
00632 U_STABLE void U_EXPORT2
00633 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00634
00646 U_STABLE UBool U_EXPORT2
00647 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00648
00656 typedef enum UBiDiReorderingMode {
00660 UBIDI_REORDER_DEFAULT = 0,
00664 UBIDI_REORDER_NUMBERS_SPECIAL,
00668 UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00676 UBIDI_REORDER_RUNS_ONLY,
00681 UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00685 UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00689 UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00692 UBIDI_REORDER_COUNT
00693 } UBiDiReorderingMode;
00694
00846 U_STABLE void U_EXPORT2
00847 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00848
00857 U_STABLE UBiDiReorderingMode U_EXPORT2
00858 ubidi_getReorderingMode(UBiDi *pBiDi);
00859
00867 typedef enum UBiDiReorderingOption {
00874 UBIDI_OPTION_DEFAULT = 0,
00875
00920 UBIDI_OPTION_INSERT_MARKS = 1,
00921
00938 UBIDI_OPTION_REMOVE_CONTROLS = 2,
00939
00986 UBIDI_OPTION_STREAMING = 4
00987 } UBiDiReorderingOption;
00988
01002 U_STABLE void U_EXPORT2
01003 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
01004
01013 U_STABLE uint32_t U_EXPORT2
01014 ubidi_getReorderingOptions(UBiDi *pBiDi);
01015
01095 U_STABLE void U_EXPORT2
01096 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01097 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01098 UErrorCode *pErrorCode);
01099
01146 U_STABLE void U_EXPORT2
01147 ubidi_setLine(const UBiDi *pParaBiDi,
01148 int32_t start, int32_t limit,
01149 UBiDi *pLineBiDi,
01150 UErrorCode *pErrorCode);
01151
01166 U_STABLE UBiDiDirection U_EXPORT2
01167 ubidi_getDirection(const UBiDi *pBiDi);
01168
01180 U_STABLE const UChar * U_EXPORT2
01181 ubidi_getText(const UBiDi *pBiDi);
01182
01191 U_STABLE int32_t U_EXPORT2
01192 ubidi_getLength(const UBiDi *pBiDi);
01193
01209 U_STABLE UBiDiLevel U_EXPORT2
01210 ubidi_getParaLevel(const UBiDi *pBiDi);
01211
01220 U_STABLE int32_t U_EXPORT2
01221 ubidi_countParagraphs(UBiDi *pBiDi);
01222
01257 U_STABLE int32_t U_EXPORT2
01258 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01259 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01260 UErrorCode *pErrorCode);
01261
01289 U_STABLE void U_EXPORT2
01290 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01291 int32_t *pParaStart, int32_t *pParaLimit,
01292 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01293
01309 U_STABLE UBiDiLevel U_EXPORT2
01310 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01311
01330 U_STABLE const UBiDiLevel * U_EXPORT2
01331 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01332
01357 U_STABLE void U_EXPORT2
01358 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01359 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01360
01376 U_STABLE int32_t U_EXPORT2
01377 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01378
01434 U_STABLE UBiDiDirection U_EXPORT2
01435 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01436 int32_t *pLogicalStart, int32_t *pLength);
01437
01475 U_STABLE int32_t U_EXPORT2
01476 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01477
01510 U_STABLE int32_t U_EXPORT2
01511 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01512
01553 U_STABLE void U_EXPORT2
01554 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01555
01589 U_STABLE void U_EXPORT2
01590 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01591
01612 U_STABLE void U_EXPORT2
01613 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01614
01635 U_STABLE void U_EXPORT2
01636 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01637
01670 U_STABLE void U_EXPORT2
01671 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01672
01682 #define UBIDI_KEEP_BASE_COMBINING 1
01683
01692 #define UBIDI_DO_MIRRORING 2
01693
01706 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01707
01719 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01720
01735 #define UBIDI_OUTPUT_REVERSE 16
01736
01775 U_STABLE int32_t U_EXPORT2
01776 ubidi_getProcessedLength(const UBiDi *pBiDi);
01777
01805 U_STABLE int32_t U_EXPORT2
01806 ubidi_getResultLength(const UBiDi *pBiDi);
01807
01808 U_CDECL_BEGIN
01815 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01816
01837 typedef UCharDirection U_CALLCONV
01838 UBiDiClassCallback(const void *context, UChar32 c);
01839
01840 U_CDECL_END
01841
01857 U_STABLE UCharDirection U_EXPORT2
01858 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
01859
01887 U_STABLE void U_EXPORT2
01888 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
01889 const void *newContext, UBiDiClassCallback **oldFn,
01890 const void **oldContext, UErrorCode *pErrorCode);
01891
01904 U_STABLE void U_EXPORT2
01905 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
01906
01972 U_STABLE int32_t U_EXPORT2
01973 ubidi_writeReordered(UBiDi *pBiDi,
01974 UChar *dest, int32_t destSize,
01975 uint16_t options,
01976 UErrorCode *pErrorCode);
01977
02024 U_STABLE int32_t U_EXPORT2
02025 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02026 UChar *dest, int32_t destSize,
02027 uint16_t options,
02028 UErrorCode *pErrorCode);
02029
02030
02033 #endif