- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- Search for |

- File List
- Globals

# ubidi.h

Go to the documentation of this file.

    00001 /*
    00002 ******************************************************************************
    00003 *
    00004 *   Copyright (C) 1999-2007, 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, updated by Matitiahu Allouche
    00015 */
    00016
    00017 #ifndef UBIDI_H
    00018 #define UBIDI_H
    00019
    00020 #include "unicode/utypes.h"
    00021 #include "unicode/uchar.h"
    00022
    00287 /*DOCXX_TAG*/
    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
    01410 U_STABLE UBiDiDirection U_EXPORT2
    01411 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
    01412                    int32_t *pLogicalStart, int32_t *pLength);
    01413
    01448 U_STABLE int32_t U_EXPORT2
    01449 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
    01450
    01483 U_STABLE int32_t U_EXPORT2
    01484 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
    01485
    01519 U_STABLE void U_EXPORT2
    01520 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
    01521
    01555 U_STABLE void U_EXPORT2
    01556 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
    01557
    01578 U_STABLE void U_EXPORT2
    01579 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
    01580
    01601 U_STABLE void U_EXPORT2
    01602 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
    01603
    01636 U_STABLE void U_EXPORT2
    01637 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
    01638
    01648 #define UBIDI_KEEP_BASE_COMBINING       1
    01649
    01658 #define UBIDI_DO_MIRRORING              2
    01659
    01672 #define UBIDI_INSERT_LRM_FOR_NUMERIC    4
    01673
    01685 #define UBIDI_REMOVE_BIDI_CONTROLS      8
    01686
    01701 #define UBIDI_OUTPUT_REVERSE            16
    01702
    01741 U_STABLE int32_t U_EXPORT2
    01742 ubidi_getProcessedLength(const UBiDi *pBiDi);
    01743
    01771 U_STABLE int32_t U_EXPORT2
    01772 ubidi_getResultLength(const UBiDi *pBiDi);
    01773
    01774 U_CDECL_BEGIN
    01781 #define U_BIDI_CLASS_DEFAULT  U_CHAR_DIRECTION_COUNT
    01782
    01803 typedef UCharDirection U_CALLCONV
    01804 UBiDiClassCallback(const void *context, UChar32 c);
    01805
    01806 U_CDECL_END
    01807
    01823 U_STABLE UCharDirection U_EXPORT2
    01824 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
    01825
    01853 U_STABLE void U_EXPORT2
    01854 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
    01855                        const void *newContext, UBiDiClassCallback **oldFn,
    01856                        const void **oldContext, UErrorCode *pErrorCode);
    01857
    01870 U_STABLE void U_EXPORT2
    01871 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
    01872
    01938 U_STABLE int32_t U_EXPORT2
    01939 ubidi_writeReordered(UBiDi *pBiDi,
    01940                      UChar *dest, int32_t destSize,
    01941                      uint16_t options,
    01942                      UErrorCode *pErrorCode);
    01943
    01990 U_STABLE int32_t U_EXPORT2
    01991 ubidi_writeReverse(const UChar *src, int32_t srcLength,
    01992                    UChar *dest, int32_t destSize,
    01993                    uint16_t options,
    01994                    UErrorCode *pErrorCode);
    01995
    01996 /*#define BIDI_SAMPLE_CODE*/
    01999 #endif