ICU 4.6 4.6
ubidi.h
Go to the documentation of this file.
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1999-2010, 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 #include "unicode/localpointer.h"
00023 
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 {
00429   UBIDI_LTR,
00441   UBIDI_RTL,
00448   UBIDI_MIXED,
00455   UBIDI_NEUTRAL
00456 };
00457 
00459 typedef enum UBiDiDirection UBiDiDirection;
00460 
00471 struct UBiDi;
00472 
00474 typedef struct UBiDi UBiDi;
00475 
00491 U_STABLE UBiDi * U_EXPORT2
00492 ubidi_open(void);
00493 
00528 U_STABLE UBiDi * U_EXPORT2
00529 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
00530 
00551 U_STABLE void U_EXPORT2
00552 ubidi_close(UBiDi *pBiDi);
00553 
00554 #if U_SHOW_CPLUSPLUS_API
00555 
00556 U_NAMESPACE_BEGIN
00557 
00567 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
00568 
00569 U_NAMESPACE_END
00570 
00571 #endif
00572 
00621 U_STABLE void U_EXPORT2
00622 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
00623 
00640 U_STABLE UBool U_EXPORT2
00641 ubidi_isInverse(UBiDi *pBiDi);
00642 
00663 U_STABLE void U_EXPORT2
00664 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
00665 
00677 U_STABLE UBool U_EXPORT2
00678 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi);
00679 
00687 typedef enum UBiDiReorderingMode {
00691     UBIDI_REORDER_DEFAULT = 0,
00695     UBIDI_REORDER_NUMBERS_SPECIAL,
00699     UBIDI_REORDER_GROUP_NUMBERS_WITH_R,
00707     UBIDI_REORDER_RUNS_ONLY,
00712     UBIDI_REORDER_INVERSE_NUMBERS_AS_L,
00716     UBIDI_REORDER_INVERSE_LIKE_DIRECT,
00720     UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL,
00723     UBIDI_REORDER_COUNT
00724 } UBiDiReorderingMode;
00725 
00877 U_STABLE void U_EXPORT2
00878 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
00879 
00888 U_STABLE UBiDiReorderingMode U_EXPORT2
00889 ubidi_getReorderingMode(UBiDi *pBiDi);
00890 
00898 typedef enum UBiDiReorderingOption {
00905     UBIDI_OPTION_DEFAULT = 0,
00906 
00951     UBIDI_OPTION_INSERT_MARKS = 1,
00952 
00969     UBIDI_OPTION_REMOVE_CONTROLS = 2,
00970 
01017     UBIDI_OPTION_STREAMING = 4
01018 } UBiDiReorderingOption;
01019 
01033 U_STABLE void U_EXPORT2
01034 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
01035 
01044 U_STABLE uint32_t U_EXPORT2
01045 ubidi_getReorderingOptions(UBiDi *pBiDi);
01046 
01126 U_STABLE void U_EXPORT2
01127 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
01128               UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
01129               UErrorCode *pErrorCode);
01130 
01177 U_STABLE void U_EXPORT2
01178 ubidi_setLine(const UBiDi *pParaBiDi,
01179               int32_t start, int32_t limit,
01180               UBiDi *pLineBiDi,
01181               UErrorCode *pErrorCode);
01182 
01198 U_STABLE UBiDiDirection U_EXPORT2
01199 ubidi_getDirection(const UBiDi *pBiDi);
01200 
01228 U_DRAFT UBiDiDirection U_EXPORT2
01229 ubidi_getBaseDirection(const UChar *text,  int32_t length );
01230 
01242 U_STABLE const UChar * U_EXPORT2
01243 ubidi_getText(const UBiDi *pBiDi);
01244 
01253 U_STABLE int32_t U_EXPORT2
01254 ubidi_getLength(const UBiDi *pBiDi);
01255 
01271 U_STABLE UBiDiLevel U_EXPORT2
01272 ubidi_getParaLevel(const UBiDi *pBiDi);
01273 
01282 U_STABLE int32_t U_EXPORT2
01283 ubidi_countParagraphs(UBiDi *pBiDi);
01284 
01319 U_STABLE int32_t U_EXPORT2
01320 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
01321                    int32_t *pParaLimit, UBiDiLevel *pParaLevel,
01322                    UErrorCode *pErrorCode);
01323 
01351 U_STABLE void U_EXPORT2
01352 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
01353                           int32_t *pParaStart, int32_t *pParaLimit,
01354                           UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
01355 
01371 U_STABLE UBiDiLevel U_EXPORT2
01372 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
01373 
01392 U_STABLE const UBiDiLevel * U_EXPORT2
01393 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
01394 
01419 U_STABLE void U_EXPORT2
01420 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
01421                     int32_t *pLogicalLimit, UBiDiLevel *pLevel);
01422 
01438 U_STABLE int32_t U_EXPORT2
01439 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
01440 
01497 U_STABLE UBiDiDirection U_EXPORT2
01498 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
01499                    int32_t *pLogicalStart, int32_t *pLength);
01500 
01538 U_STABLE int32_t U_EXPORT2
01539 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
01540 
01573 U_STABLE int32_t U_EXPORT2
01574 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
01575 
01616 U_STABLE void U_EXPORT2
01617 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01618 
01652 U_STABLE void U_EXPORT2
01653 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
01654 
01675 U_STABLE void U_EXPORT2
01676 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01677 
01698 U_STABLE void U_EXPORT2
01699 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
01700 
01733 U_STABLE void U_EXPORT2
01734 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
01735 
01745 #define UBIDI_KEEP_BASE_COMBINING       1
01746 
01755 #define UBIDI_DO_MIRRORING              2
01756 
01769 #define UBIDI_INSERT_LRM_FOR_NUMERIC    4
01770 
01782 #define UBIDI_REMOVE_BIDI_CONTROLS      8
01783 
01798 #define UBIDI_OUTPUT_REVERSE            16
01799 
01838 U_STABLE int32_t U_EXPORT2
01839 ubidi_getProcessedLength(const UBiDi *pBiDi);
01840 
01868 U_STABLE int32_t U_EXPORT2
01869 ubidi_getResultLength(const UBiDi *pBiDi);
01870 
01871 U_CDECL_BEGIN
01878 #define U_BIDI_CLASS_DEFAULT  U_CHAR_DIRECTION_COUNT
01879 
01900 typedef UCharDirection U_CALLCONV
01901 UBiDiClassCallback(const void *context, UChar32 c);
01902 
01903 U_CDECL_END
01904 
01920 U_STABLE UCharDirection U_EXPORT2
01921 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c);
01922 
01950 U_STABLE void U_EXPORT2
01951 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
01952                        const void *newContext, UBiDiClassCallback **oldFn,
01953                        const void **oldContext, UErrorCode *pErrorCode);
01954 
01967 U_STABLE void U_EXPORT2
01968 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
01969 
02035 U_STABLE int32_t U_EXPORT2
02036 ubidi_writeReordered(UBiDi *pBiDi,
02037                      UChar *dest, int32_t destSize,
02038                      uint16_t options,
02039                      UErrorCode *pErrorCode);
02040 
02087 U_STABLE int32_t U_EXPORT2
02088 ubidi_writeReverse(const UChar *src, int32_t srcLength,
02089                    UChar *dest, int32_t destSize,
02090                    uint16_t options,
02091                    UErrorCode *pErrorCode);
02092 
02093 /*#define BIDI_SAMPLE_CODE*/
02096 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines