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 #include "unicode/localpointer.h"
00025
00289
00336 typedef uint8_t UBiDiLevel;
00337
00362 #define UBIDI_DEFAULT_LTR 0xfe
00363
00389 #define UBIDI_DEFAULT_RTL 0xff
00390
00398 #define UBIDI_MAX_EXPLICIT_LEVEL 125
00399
00404 #define UBIDI_LEVEL_OVERRIDE 0x80
00405
00419 #define UBIDI_MAP_NOWHERE (-1)
00420
00425 enum UBiDiDirection {
00437 UBIDI_LTR,
00449 UBIDI_RTL,
00456 UBIDI_MIXED,
00463 UBIDI_NEUTRAL
00464 };
00465
00467 typedef enum UBiDiDirection UBiDiDirection;
00468
00479 struct UBiDi;
00480
00482 typedef struct UBiDi UBiDi;
00483
00499 U_STABLE UBiDi * U_EXPORT2
00500 ubidi_open(void);
00501
00536 U_STABLE UBiDi * U_EXPORT2
00537 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00538
00559 U_STABLE void U_EXPORT2
00560 ubidi_close(UBiDi *pBiDi);
00561
00562 #if U_SHOW_CPLUSPLUS_API
00563
00564 U_NAMESPACE_BEGIN
00565
00575 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
00576
00577 U_NAMESPACE_END
00578
00579 #endif
00580
00629 U_STABLE void U_EXPORT2
00630 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00631
00648 U_STABLE UBool U_EXPORT2
00649 ubidi_isInverse(UBiDi *pBiDi);
00650
00671 U_STABLE void U_EXPORT2
00672 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00673
00685 U_STABLE UBool U_EXPORT2
00686 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00687
00695 typedef enum UBiDiReorderingMode {
00699 UBIDI_REORDER_DEFAULT = 0,
00703 UBIDI_REORDER_NUMBERS_SPECIAL,
00707 UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00715 UBIDI_REORDER_RUNS_ONLY,
00720 UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00724 UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00728 UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00729 #ifndef U_HIDE_DEPRECATED_API
00730
00734 UBIDI_REORDER_COUNT
00735 #endif // U_HIDE_DEPRECATED_API
00736 } UBiDiReorderingMode;
00737
00889 U_STABLE void U_EXPORT2
00890 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00891
00900 U_STABLE UBiDiReorderingMode U_EXPORT2
00901 ubidi_getReorderingMode(UBiDi *pBiDi);
00902
00910 typedef enum UBiDiReorderingOption {
00917 UBIDI_OPTION_DEFAULT = 0,
00918
00963 UBIDI_OPTION_INSERT_MARKS = 1,
00964
00981 UBIDI_OPTION_REMOVE_CONTROLS = 2,
00982
01029 UBIDI_OPTION_STREAMING = 4
01030 } UBiDiReorderingOption;
01031
01045 U_STABLE void U_EXPORT2
01046 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
01047
01056 U_STABLE uint32_t U_EXPORT2
01057 ubidi_getReorderingOptions(UBiDi *pBiDi);
01058
01143 U_STABLE void U_EXPORT2
01144 ubidi_setContext(UBiDi *pBiDi,
01145 const UChar *prologue, int32_t proLength,
01146 const UChar *epilogue, int32_t epiLength,
01147 UErrorCode *pErrorCode);
01148
01231 U_STABLE void U_EXPORT2
01232 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01233 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01234 UErrorCode *pErrorCode);
01235
01282 U_STABLE void U_EXPORT2
01283 ubidi_setLine(const UBiDi *pParaBiDi,
01284 int32_t start, int32_t limit,
01285 UBiDi *pLineBiDi,
01286 UErrorCode *pErrorCode);
01287
01303 U_STABLE UBiDiDirection U_EXPORT2
01304 ubidi_getDirection(const UBiDi *pBiDi);
01305
01333 U_STABLE UBiDiDirection U_EXPORT2
01334 ubidi_getBaseDirection(const UChar *text, int32_t length );
01335
01347 U_STABLE const UChar * U_EXPORT2
01348 ubidi_getText(const UBiDi *pBiDi);
01349
01358 U_STABLE int32_t U_EXPORT2
01359 ubidi_getLength(const UBiDi *pBiDi);
01360
01376 U_STABLE UBiDiLevel U_EXPORT2
01377 ubidi_getParaLevel(const UBiDi *pBiDi);
01378
01387 U_STABLE int32_t U_EXPORT2
01388 ubidi_countParagraphs(UBiDi *pBiDi);
01389
01424 U_STABLE int32_t U_EXPORT2
01425 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01426 int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01427 UErrorCode *pErrorCode);
01428
01456 U_STABLE void U_EXPORT2
01457 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01458 int32_t *pParaStart, int32_t *pParaLimit,
01459 UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01460
01476 U_STABLE UBiDiLevel U_EXPORT2
01477 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01478
01497 U_STABLE const UBiDiLevel * U_EXPORT2
01498 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01499
01524 U_STABLE void U_EXPORT2
01525 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01526 int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01527
01543 U_STABLE int32_t U_EXPORT2
01544 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01545
01602 U_STABLE UBiDiDirection U_EXPORT2
01603 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01604 int32_t *pLogicalStart, int32_t *pLength);
01605
01643 U_STABLE int32_t U_EXPORT2
01644 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01645
01678 U_STABLE int32_t U_EXPORT2
01679 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01680
01721 U_STABLE void U_EXPORT2
01722 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01723
01757 U_STABLE void U_EXPORT2
01758 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01759
01780 U_STABLE void U_EXPORT2
01781 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01782
01803 U_STABLE void U_EXPORT2
01804 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01805
01838 U_STABLE void U_EXPORT2
01839 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01840
01850 #define UBIDI_KEEP_BASE_COMBINING 1
01851
01860 #define UBIDI_DO_MIRRORING 2
01861
01874 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
01875
01887 #define UBIDI_REMOVE_BIDI_CONTROLS 8
01888
01903 #define UBIDI_OUTPUT_REVERSE 16
01904
01943 U_STABLE int32_t U_EXPORT2
01944 ubidi_getProcessedLength(const UBiDi *pBiDi);
01945
01973 U_STABLE int32_t U_EXPORT2
01974 ubidi_getResultLength(const UBiDi *pBiDi);
01975
01976 U_CDECL_BEGIN
01977
01978 #ifndef U_HIDE_DEPRECATED_API
01979
01988 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
01989 #endif // U_HIDE_DEPRECATED_API
01990
02011 typedef UCharDirection U_CALLCONV
02012 UBiDiClassCallback(const void *context, UChar32 c);
02013
02014 U_CDECL_END
02015
02031 U_STABLE UCharDirection U_EXPORT2
02032 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
02033
02061 U_STABLE void U_EXPORT2
02062 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
02063 const void *newContext, UBiDiClassCallback **oldFn,
02064 const void **oldContext, UErrorCode *pErrorCode);
02065
02078 U_STABLE void U_EXPORT2
02079 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
02080
02146 U_STABLE int32_t U_EXPORT2
02147 ubidi_writeReordered(UBiDi *pBiDi,
02148 UChar *dest, int32_t destSize,
02149 uint16_t options,
02150 UErrorCode *pErrorCode);
02151
02198 U_STABLE int32_t U_EXPORT2
02199 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02200 UChar *dest, int32_t destSize,
02201 uint16_t options,
02202 UErrorCode *pErrorCode);
02203
02204
02207 #endif