00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef UBIDI_H
00020 #define UBIDI_H
00021
00022 #include "unicode/utypes.h"
00023 #include "unicode/uchar.h"
00024
00025 #if U_SHOW_CPLUSPLUS_API
00026 #include "unicode/localpointer.h"
00027 #endif // U_SHOW_CPLUSPLUS_API
00028
00293
00340 typedef uint8_t UBiDiLevel;
00341
00366 #define UBIDI_DEFAULT_LTR 0xfe
00367
00393 #define UBIDI_DEFAULT_RTL 0xff
00394
00402 #define UBIDI_MAX_EXPLICIT_LEVEL 125
00403
00408 #define UBIDI_LEVEL_OVERRIDE 0x80
00409
00423 #define UBIDI_MAP_NOWHERE (-1)
00424
00429 enum UBiDiDirection {
00441 UBIDI_LTR,
00453 UBIDI_RTL,
00460 UBIDI_MIXED,
00467 UBIDI_NEUTRAL
00468 };
00469
00471 typedef enum UBiDiDirection UBiDiDirection;
00472
00483 struct UBiDi;
00484
00486 typedef struct UBiDi UBiDi;
00487
00503 U_CAPI UBiDi * U_EXPORT2
00504 ubidi_open(void);
00505
00540 U_CAPI UBiDi * U_EXPORT2
00541 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00542
00563 U_CAPI void U_EXPORT2
00564 ubidi_close(UBiDi *pBiDi);
00565
00566 #if U_SHOW_CPLUSPLUS_API
00567
00568 U_NAMESPACE_BEGIN
00569
00579 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
00580
00581 U_NAMESPACE_END
00582
00583 #endif
00584
00633 U_CAPI void U_EXPORT2
00634 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00635
00652 U_CAPI UBool U_EXPORT2
00653 ubidi_isInverse(UBiDi *pBiDi);
00654
00675 U_CAPI void U_EXPORT2
00676 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00677
00689 U_CAPI UBool U_EXPORT2
00690 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00691
00699 typedef enum UBiDiReorderingMode {
00703 UBIDI_REORDER_DEFAULT = 0,
00707 UBIDI_REORDER_NUMBERS_SPECIAL,
00711 UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00719 UBIDI_REORDER_RUNS_ONLY,
00724 UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00728 UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00732 UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00733 #ifndef U_HIDE_DEPRECATED_API
00734
00738 UBIDI_REORDER_COUNT
00739 #endif // U_HIDE_DEPRECATED_API
00740 } UBiDiReorderingMode;
00741
00893 U_CAPI void U_EXPORT2
00894 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00895
00904 U_CAPI UBiDiReorderingMode U_EXPORT2
00905 ubidi_getReorderingMode(UBiDi *pBiDi);
00906
00914 typedef enum UBiDiReorderingOption {
00921 UBIDI_OPTION_DEFAULT = 0,
00922
00967 UBIDI_OPTION_INSERT_MARKS = 1,
00968
00985 UBIDI_OPTION_REMOVE_CONTROLS = 2,
00986
01033 UBIDI_OPTION_STREAMING = 4
01034 } UBiDiReorderingOption;
01035
01049 U_CAPI void U_EXPORT2
01050 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
01051
01060 U_CAPI uint32_t U_EXPORT2
01061 ubidi_getReorderingOptions(UBiDi *pBiDi);
01062
01147 U_CAPI void U_EXPORT2
01148 ubidi_setContext(UBiDi *pBiDi,
01149 const UChar *prologue, int32_t proLength,
01150 const UChar *epilogue, int32_t epiLength,
01151 UErrorCode *pErrorCode);
01152
01235 U_CAPI void U_EXPORT2
01236 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01237 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01238 UErrorCode *pErrorCode);
01239
01286 U_CAPI void U_EXPORT2
01287 ubidi_setLine(const UBiDi *pParaBiDi,
01288 int32_t start, int32_t limit,
01289 UBiDi *pLineBiDi,
01290 UErrorCode *pErrorCode);
01291
01307 U_CAPI UBiDiDirection U_EXPORT2
01308 ubidi_getDirection(const UBiDi *pBiDi);
01309
01337 U_CAPI UBiDiDirection U_EXPORT2
01338 ubidi_getBaseDirection(const UChar *text, int32_t length );
01339
01351 U_CAPI const UChar * U_EXPORT2
01352 ubidi_getText(const UBiDi *pBiDi);
01353
01362 U_CAPI int32_t U_EXPORT2
01363 ubidi_getLength(const UBiDi *pBiDi);
01364
01380 U_CAPI UBiDiLevel U_EXPORT2
01381 ubidi_getParaLevel(const UBiDi *pBiDi);
01382
01391 U_CAPI int32_t U_EXPORT2
01392 ubidi_countParagraphs(UBiDi *pBiDi);
01393
01428 U_CAPI int32_t U_EXPORT2
01429 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01430 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01431 UErrorCode *pErrorCode);
01432
01460 U_CAPI void U_EXPORT2
01461 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01462 int32_t *pParaStart, int32_t *pParaLimit,
01463 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01464
01480 U_CAPI UBiDiLevel U_EXPORT2
01481 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01482
01501 U_CAPI const UBiDiLevel * U_EXPORT2
01502 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01503
01528 U_CAPI void U_EXPORT2
01529 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01530 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01531
01547 U_CAPI int32_t U_EXPORT2
01548 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01549
01606 U_CAPI UBiDiDirection U_EXPORT2
01607 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01608 int32_t *pLogicalStart, int32_t *pLength);
01609
01647 U_CAPI int32_t U_EXPORT2
01648 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01649
01682 U_CAPI int32_t U_EXPORT2
01683 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01684
01725 U_CAPI void U_EXPORT2
01726 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01727
01761 U_CAPI void U_EXPORT2
01762 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01763
01784 U_CAPI void U_EXPORT2
01785 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01786
01807 U_CAPI void U_EXPORT2
01808 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01809
01842 U_CAPI void U_EXPORT2
01843 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01844
01854 #define UBIDI_KEEP_BASE_COMBINING 1
01855
01864 #define UBIDI_DO_MIRRORING 2
01865
01878 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01879
01891 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01892
01907 #define UBIDI_OUTPUT_REVERSE 16
01908
01947 U_CAPI int32_t U_EXPORT2
01948 ubidi_getProcessedLength(const UBiDi *pBiDi);
01949
01977 U_CAPI int32_t U_EXPORT2
01978 ubidi_getResultLength(const UBiDi *pBiDi);
01979
01980 U_CDECL_BEGIN
01981
01982 #ifndef U_HIDE_DEPRECATED_API
01983
01992 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01993 #endif // U_HIDE_DEPRECATED_API
01994
02015 typedef UCharDirection U_CALLCONV
02016 UBiDiClassCallback(const void *context, UChar32 c);
02017
02018 U_CDECL_END
02019
02035 U_CAPI UCharDirection U_EXPORT2
02036 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
02037
02065 U_CAPI void U_EXPORT2
02066 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
02067 const void *newContext, UBiDiClassCallback **oldFn,
02068 const void **oldContext, UErrorCode *pErrorCode);
02069
02082 U_CAPI void U_EXPORT2
02083 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
02084
02150 U_CAPI int32_t U_EXPORT2
02151 ubidi_writeReordered(UBiDi *pBiDi,
02152 UChar *dest, int32_t destSize,
02153 uint16_t options,
02154 UErrorCode *pErrorCode);
02155
02202 U_CAPI int32_t U_EXPORT2
02203 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02204 UChar *dest, int32_t destSize,
02205 uint16_t options,
02206 UErrorCode *pErrorCode);
02207
02208
02211 #endif