ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ubidi.h
Go to the documentation of this file.
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2008, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 * file name: ubidi.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 1999jul27
14 * created by: Markus W. Scherer, updated by Matitiahu Allouche
15 */
16 
17 #ifndef UBIDI_H
18 #define UBIDI_H
19 
20 #include "unicode/utypes.h"
21 #include "unicode/uchar.h"
22 
287 /*DOCXX_TAG*/
331 
356 #define UBIDI_DEFAULT_LTR 0xfe
357 
383 #define UBIDI_DEFAULT_RTL 0xff
384 
390 #define UBIDI_MAX_EXPLICIT_LEVEL 61
391 
396 #define UBIDI_LEVEL_OVERRIDE 0x80
397 
411 #define UBIDI_MAP_NOWHERE (-1)
412 
424 };
425 
428 
439 struct UBiDi;
440 
442 typedef struct UBiDi UBiDi;
443 
460 ubidi_open(void);
461 
497 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
498 
519 U_STABLE void U_EXPORT2
520 ubidi_close(UBiDi *pBiDi);
521 
570 U_STABLE void U_EXPORT2
571 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse);
572 
590 ubidi_isInverse(UBiDi *pBiDi);
591 
612 U_STABLE void U_EXPORT2
613 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR);
614 
628 
636 typedef enum UBiDiReorderingMode {
674 
828 U_STABLE void U_EXPORT2
829 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode);
830 
841 
849 typedef enum UBiDiReorderingOption {
857 
903 
921 
970 
984 U_STABLE void U_EXPORT2
985 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions);
986 
997 
1077 U_STABLE void U_EXPORT2
1078 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
1079  UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
1080  UErrorCode *pErrorCode);
1081 
1128 U_STABLE void U_EXPORT2
1129 ubidi_setLine(const UBiDi *pParaBiDi,
1130  int32_t start, int32_t limit,
1131  UBiDi *pLineBiDi,
1132  UErrorCode *pErrorCode);
1133 
1149 ubidi_getDirection(const UBiDi *pBiDi);
1150 
1162 U_STABLE const UChar * U_EXPORT2
1163 ubidi_getText(const UBiDi *pBiDi);
1164 
1174 ubidi_getLength(const UBiDi *pBiDi);
1175 
1192 ubidi_getParaLevel(const UBiDi *pBiDi);
1193 
1204 
1240 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart,
1241  int32_t *pParaLimit, UBiDiLevel *pParaLevel,
1242  UErrorCode *pErrorCode);
1243 
1271 U_STABLE void U_EXPORT2
1272 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
1273  int32_t *pParaStart, int32_t *pParaLimit,
1274  UBiDiLevel *pParaLevel, UErrorCode *pErrorCode);
1275 
1292 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
1293 
1313 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
1314 
1339 U_STABLE void U_EXPORT2
1340 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
1341  int32_t *pLogicalLimit, UBiDiLevel *pLevel);
1342 
1359 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
1360 
1417 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
1418  int32_t *pLogicalStart, int32_t *pLength);
1419 
1458 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
1459 
1493 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
1494 
1535 U_STABLE void U_EXPORT2
1536 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
1537 
1571 U_STABLE void U_EXPORT2
1572 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
1573 
1594 U_STABLE void U_EXPORT2
1595 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
1596 
1617 U_STABLE void U_EXPORT2
1618 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
1619 
1652 U_STABLE void U_EXPORT2
1653 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
1654 
1664 #define UBIDI_KEEP_BASE_COMBINING 1
1665 
1674 #define UBIDI_DO_MIRRORING 2
1675 
1688 #define UBIDI_INSERT_LRM_FOR_NUMERIC 4
1689 
1701 #define UBIDI_REMOVE_BIDI_CONTROLS 8
1702 
1717 #define UBIDI_OUTPUT_REVERSE 16
1718 
1758 ubidi_getProcessedLength(const UBiDi *pBiDi);
1759 
1788 ubidi_getResultLength(const UBiDi *pBiDi);
1789 
1797 #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT
1798 
1819 typedef UCharDirection U_CALLCONV
1820 UBiDiClassCallback(const void *context, UChar32 c);
1821 
1823 
1841 
1869 U_STABLE void U_EXPORT2
1871  const void *newContext, UBiDiClassCallback **oldFn,
1872  const void **oldContext, UErrorCode *pErrorCode);
1873 
1886 U_STABLE void U_EXPORT2
1887 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context);
1888 
1956  UChar *dest, int32_t destSize,
1957  uint16_t options,
1958  UErrorCode *pErrorCode);
1959 
2007 ubidi_writeReverse(const UChar *src, int32_t srcLength,
2008  UChar *dest, int32_t destSize,
2009  uint16_t options,
2010  UErrorCode *pErrorCode);
2011 
2012 /*#define BIDI_SAMPLE_CODE*/
2015 #endif
Logical to Visual algorithm which handles numbers in a way which mimicks the behavior of Windows XP...
Definition: ubidi.h:644
UBiDi * ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
Allocate a UBiDi structure with preallocated memory for internal structures.
Reorder runs only to transform a Logical LTR string to the Logical RTL string with the same display...
Definition: ubidi.h:656
void ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode)
Get a logical-to-visual index map (array) for the characters in the UBiDi (paragraph or line) object...
void ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context)
Get the current callback function used for Bidi class determination.
int32_t ubidi_writeReverse(const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode)
Reverse a Right-To-Left run of Unicode text.
void ubidi_setLine(const UBiDi *pParaBiDi, int32_t start, int32_t limit, UBiDi *pLineBiDi, UErrorCode *pErrorCode)
ubidi_setLine() sets a UBiDi to contain the reordering information, especially the resolved levels...
option bit for ubidi_setReorderingOptions: process the output as part of a stream to be continued ...
Definition: ubidi.h:968
void ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode)
Get a paragraph, given the index of this paragraph.
void ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions)
Specify which of the reordering options should be applied during Bidi transformations.
int32_t ubidi_getLength(const UBiDi *pBiDi)
Get the length of the text.
void ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, int32_t *pLogicalLimit, UBiDiLevel *pLevel)
Get a logical run.
UBiDiLevel ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex)
Get the level for one character.
Number of values for reordering mode.
Definition: ubidi.h:672
UCharDirection UBiDiClassCallback(const void *context, UChar32 c)
Callback type declaration for overriding default Bidi class values with custom ones.
Definition: ubidi.h:1820
option bit for ubidi_setReorderingOptions: remove Bidi control characters
Definition: ubidi.h:920
UCharDirection ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
Retrieve the Bidi class for a given code point.
UBool ubidi_isOrderParagraphsLTR(UBiDi *pBiDi)
Is this Bidi object set to allocate level 0 to block separators so that successive paragraphs progres...
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition: utypes.h:254
Visual to Logical algorithm which handles numbers like L (same algorithm as selected by ubidi_setInve...
Definition: ubidi.h:661
UCharDirection
This specifies the language directional property of a character set.
Definition: uchar.h:764
void ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR)
Specify whether block separators must be allocated level zero, so that successive paragraphs will pro...
void ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode)
Modify the operation of the Bidi algorithm such that it implements some variant to the basic Bidi alg...
uint8_t UBiDiLevel
UBiDiLevel is the type of the level values in this Bidi implementation.
Definition: ubidi.h:330
Inverse Bidi (Visual to Logical) algorithm for the UBIDI_REORDER_NUMBERS_SPECIAL Bidi algorithm...
Definition: ubidi.h:669
Mixed-directional text.
Definition: ubidi.h:423
UBiDi * ubidi_open(void)
Allocate a UBiDi structure.
int32_t ubidi_getProcessedLength(const UBiDi *pBiDi)
Get the length of the source text processed by the last call to ubidi_setPara().
UBiDiReorderingOption
UBiDiReorderingOption values indicate which options are specified to affect the Bidi algorithm...
Definition: ubidi.h:849
unsigned char uint8_t
Define 64 bit limits.
Definition: pwin32.h:131
unsigned int uint32_t
Define 64 bit limits.
Definition: pwin32.h:147
option value for ubidi_setReorderingOptions: disable all the options which can be set with this funct...
Definition: ubidi.h:856
int32_t ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode)
Get a paragraph, given a position within the text.
UBiDiDirection
UBiDiDirection values indicate the text direction.
Definition: ubidi.h:417
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:101
void ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode)
Get a visual-to-logical index map (array) for the characters in the UBiDi (paragraph or line) object...
UBiDiDirection ubidi_getDirection(const UBiDi *pBiDi)
Get the directionality of the text.
int32_t ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode)
Get the logical text position from a visual position.
UBiDiReorderingMode ubidi_getReorderingMode(UBiDi *pBiDi)
What is the requested reordering mode for a given Bidi object?
int32_t ubidi_getResultLength(const UBiDi *pBiDi)
Get the length of the reordered text resulting from the last call to ubidi_setPara().
Regular Logical to Visual Bidi algorithm according to Unicode.
Definition: ubidi.h:640
const UBiDiLevel * ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode)
Get an array of levels for each character.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:319
void ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, const void *newContext, UBiDiClassCallback **oldFn, const void **oldContext, UErrorCode *pErrorCode)
Set the callback function and callback data used by the UBA implementation for Bidi class determinati...
void ubidi_close(UBiDi *pBiDi)
ubidi_close() must be called to free the memory associated with a UBiDi object.
void ubidi_setInverse(UBiDi *pBiDi, UBool isInverse)
Modify the operation of the Bidi algorithm such that it approximates an "inverse Bidi" algorithm...
UBiDiDirection ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, int32_t *pLogicalStart, int32_t *pLength)
Get one run's logical start, length, and directionality, which can be 0 for LTR or 1 for RTL...
UBiDiLevel ubidi_getParaLevel(const UBiDi *pBiDi)
Get the paragraph level of the text.
option bit for ubidi_setReorderingOptions: insert Bidi marks (LRM or RLM) when needed to ensure corre...
Definition: ubidi.h:902
#define U_EXPORT2
Definition: platform.h:338
int32_t ubidi_countParagraphs(UBiDi *pBiDi)
Get the number of paragraphs.
UBool ubidi_isInverse(UBiDi *pBiDi)
Is this Bidi object set to perform the inverse Bidi algorithm?
C API: Unicode Properties.
const UChar * ubidi_getText(const UBiDi *pBiDi)
Get the pointer to the text.
void ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap)
This is a convenience function that does not use a UBiDi object.
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
All left-to-right text.
Definition: ubidi.h:419
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:102
Visual to Logical algorithm equivalent to the regular Logical to Visual algorithm.
Definition: ubidi.h:665
uint32_t ubidi_getReorderingOptions(UBiDi *pBiDi)
What are the reordering options applied to a given Bidi object?
int32_t ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode)
Get the number of runs.
int32_t ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode)
Get the visual position from a logical text position.
struct UBiDi UBiDi
Definition: ubidi.h:442
int32_t ubidi_writeReordered(UBiDi *pBiDi, UChar *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode)
Take a UBiDi object containing the reordering information for a piece of text (one or more paragraphs...
void ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, UErrorCode *pErrorCode)
Perform the Unicode Bidi algorithm.
void ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap)
This is a convenience function that does not use a UBiDi object.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
Logical to Visual algorithm grouping numbers with adjacent R characters (reversible algorithm)...
Definition: ubidi.h:648
unsigned short uint16_t
Define 64 bit limits.
Definition: pwin32.h:139
void ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length)
Invert an index map.
Basic definitions for ICU, for both C and C++ APIs.
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
UBiDiReorderingMode
UBiDiReorderingMode values indicate which variant of the Bidi algorithm to use.
Definition: ubidi.h:636
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:117
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208
All right-to-left text.
Definition: ubidi.h:421