00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 1999, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ******************************************************************************* 00008 * file name: ubidi.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 1999jul27 00014 * created by: Markus W. Scherer 00015 */ 00016 00017 #ifndef UBIDI_H 00018 #define UBIDI_H 00019 00020 #include "unicode/utypes.h" 00021 #include "unicode/uchar.h" 00022 00023 /* 00024 * javadoc-style comments are intended to be transformed into HTML 00025 * using DOC++ - see 00026 * http://www.zib.de/Visual/software/doc++/index.html . 00027 * 00028 * The HTML documentation is created with 00029 * doc++ -H ubidi.h 00030 * 00031 * The following #define trick allows us to do it all in one file 00032 * and still be able to compile it. 00033 */ 00034 #define DOCXX_TAG 00035 #define BIDI_SAMPLE_CODE 00036 00066 DOCXX_TAG 00067 /*@{*/ 00068 00107 typedef uint8_t UBiDiLevel; 00108 00112 #define UBIDI_DEFAULT_LTR 0xfe 00113 00117 #define UBIDI_DEFAULT_RTL 0xff 00118 00124 #define UBIDI_MAX_EXPLICIT_LEVEL 61 00125 00129 #define UBIDI_LEVEL_OVERRIDE 0x80 00130 00134 enum UBiDiDirection { 00136 UBIDI_LTR, 00138 UBIDI_RTL, 00140 UBIDI_MIXED 00141 }; 00142 00143 typedef enum UBiDiDirection UBiDiDirection; 00144 00154 struct UBiDi; 00155 00156 typedef struct UBiDi UBiDi; 00157 00171 U_CAPI UBiDi * U_EXPORT2 00172 ubidi_open(void); 00173 00208 U_CAPI UBiDi * U_EXPORT2 00209 ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErrorCode); 00210 00228 U_CAPI void U_EXPORT2 00229 ubidi_close(UBiDi *pBiDi); 00230 00266 U_CAPI void U_EXPORT2 00267 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); 00268 00276 U_CAPI UBool U_EXPORT2 00277 ubidi_isInverse(UBiDi *pBiDi); 00278 00349 U_CAPI void U_EXPORT2 00350 ubidi_setPara(UBiDi *pBiDi, const UChar *text, UTextOffset length, 00351 UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, 00352 UErrorCode *pErrorCode); 00353 00396 U_CAPI void U_EXPORT2 00397 ubidi_setLine(const UBiDi *pParaBiDi, 00398 UTextOffset start, UTextOffset limit, 00399 UBiDi *pLineBiDi, 00400 UErrorCode *pErrorCode); 00401 00413 U_CAPI UBiDiDirection U_EXPORT2 00414 ubidi_getDirection(const UBiDi *pBiDi); 00415 00426 U_CAPI const UChar * U_EXPORT2 00427 ubidi_getText(const UBiDi *pBiDi); 00428 00436 U_CAPI UTextOffset U_EXPORT2 00437 ubidi_getLength(const UBiDi *pBiDi); 00438 00448 U_CAPI UBiDiLevel U_EXPORT2 00449 ubidi_getParaLevel(const UBiDi *pBiDi); 00450 00462 U_CAPI UBiDiLevel U_EXPORT2 00463 ubidi_getLevelAt(const UBiDi *pBiDi, UTextOffset charIndex); 00464 00481 U_CAPI const UBiDiLevel * U_EXPORT2 00482 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); 00483 00505 U_CAPI void U_EXPORT2 00506 ubidi_getLogicalRun(const UBiDi *pBiDi, UTextOffset logicalStart, 00507 UTextOffset *pLogicalLimit, UBiDiLevel *pLevel); 00508 00524 U_CAPI UTextOffset U_EXPORT2 00525 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); 00526 00575 U_CAPI UBiDiDirection U_EXPORT2 00576 ubidi_getVisualRun(UBiDi *pBiDi, UTextOffset runIndex, 00577 UTextOffset *pLogicalStart, UTextOffset *pLength); 00578 00601 U_CAPI UTextOffset U_EXPORT2 00602 ubidi_getVisualIndex(UBiDi *pBiDi, UTextOffset logicalIndex, UErrorCode *pErrorCode); 00603 00624 U_CAPI UTextOffset U_EXPORT2 00625 ubidi_getLogicalIndex(UBiDi *pBiDi, UTextOffset visualIndex, UErrorCode *pErrorCode); 00626 00644 U_CAPI void U_EXPORT2 00645 ubidi_getLogicalMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode); 00646 00664 U_CAPI void U_EXPORT2 00665 ubidi_getVisualMap(UBiDi *pBiDi, UTextOffset *indexMap, UErrorCode *pErrorCode); 00666 00686 U_CAPI void U_EXPORT2 00687 ubidi_reorderLogical(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap); 00688 00708 U_CAPI void U_EXPORT2 00709 ubidi_reorderVisual(const UBiDiLevel *levels, UTextOffset length, UTextOffset *indexMap); 00710 00724 U_CAPI void U_EXPORT2 00725 ubidi_invertMap(const UTextOffset *srcMap, UTextOffset *destMap, UTextOffset length); 00726 00735 #define UBIDI_KEEP_BASE_COMBINING 1 00736 00744 #define UBIDI_DO_MIRRORING 2 00745 00754 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4 00755 00763 #define UBIDI_REMOVE_BIDI_CONTROLS 8 00764 00778 #define UBIDI_OUTPUT_REVERSE 16 00779 00836 U_CAPI UTextOffset U_EXPORT2 00837 ubidi_writeReordered(UBiDi *pBiDi, 00838 UChar *dest, int32_t destSize, 00839 uint16_t options, 00840 UErrorCode *pErrorCode); 00841 00888 U_CAPI UTextOffset U_EXPORT2 00889 ubidi_writeReverse(const UChar *src, int32_t srcLength, 00890 UChar *dest, int32_t destSize, 00891 uint16_t options, 00892 UErrorCode *pErrorCode); 00893 01120 BIDI_SAMPLE_CODE 01121 /*@{*/ 01122 /*@}*/ 01123 01124 /*@}*/ 01125 01126 #endif