BIDISTRING Class Reference

This class handles the Bi-Directional ("BiDi") issues of rendering strings which have a mixture of Left-To-Right and Right-To-Left text (such as Hebrew and Arabic). More...

#include <mi32/bidi.h>

Inheritance diagram for BIDISTRING:

Inheritance graph
BIDICURSOR
[legend]
List of all members.

Public Types

enum  DIRECTION { DIRECTION_LTR, DIRECTION_RTL }
enum  ORDER { ORDER_VISUAL, ORDER_LOGICAL }

Public Member Functions

 BIDISTRING (const MIUNICODE *source, DIRECTION DefaultDirection=DIRECTION_LTR, ORDER StringOrder=ORDER_LOGICAL)
 BIDISTRING ()
void Clear ()
DIRECTION GetStringDirection () const
MIUNICODEGetStringLogical () const
MIUNICODEGetStringVisual () const
void SetStringLogical (const MIUNICODE *source, DIRECTION DefaultDirection=DIRECTION_LTR, bool bForceDirection=false)
void SetStringVisual (const MIUNICODE *source, DIRECTION DefaultDirection=DIRECTION_LTR)
virtual ~BIDISTRING ()

Detailed Description

This class handles the Bi-Directional ("BiDi") issues of rendering strings which have a mixture of Left-To-Right and Right-To-Left text (such as Hebrew and Arabic).

Besides flipping the string as necessary, it can also keep track or a cursor position within the string and resolve the logical position of the cursor withing the string while moving in visual order.

Definition at line 74 of file bidi.h.


Member Enumeration Documentation

enum BIDISTRING::DIRECTION

Enumerator:
DIRECTION_LTR 
DIRECTION_RTL 

Definition at line 78 of file bidi.h.

enum BIDISTRING::ORDER

Enumerator:
ORDER_VISUAL 
ORDER_LOGICAL 

Definition at line 83 of file bidi.h.


Constructor & Destructor Documentation

BIDISTRING::BIDISTRING (  ) 

BIDISTRING::BIDISTRING ( const MIUNICODE source,
DIRECTION  DefaultDirection = DIRECTION_LTR,
ORDER  StringOrder = ORDER_LOGICAL 
)

Construct with initial values.

virtual BIDISTRING::~BIDISTRING (  )  [virtual]


Member Function Documentation

void BIDISTRING::Clear (  ) 

Clear the string.

DIRECTION BIDISTRING::GetStringDirection (  )  const

Get the primary direction of the string.

MIUNICODE* BIDISTRING::GetStringLogical (  )  const

Return a copy of the string in logical order.

Caller should free the returned string.

MIUNICODE* BIDISTRING::GetStringVisual (  )  const

Return a copy of the string in visual order.

Caller should free the returned string.

void BIDISTRING::SetStringLogical ( const MIUNICODE source,
DIRECTION  DefaultDirection = DIRECTION_LTR,
bool  bForceDirection = false 
)

Set the string from a logical order string.

Note: Normally, the directionality of a string is determined by the first strongly directional character in the string. In this case, the DefaultDirection is only used as a fallback, unless bForceDirection is true.

void BIDISTRING::SetStringVisual ( const MIUNICODE source,
DIRECTION  DefaultDirection = DIRECTION_LTR 
)

Set the string from a visual order string.

Nore: The DefaultDirection is VERY important with a visual order string. This is because it is impossible to tell by looking at a visual order string if it was supposed to be right-to-left or left-to-right. Take the following examples: (assume lowercase letters are left-to-right and capital letters are right to left)

logicalvisual
1ABC abc DEFFED abc CBA
2ABC abc DEF defdef FED abc CBA
3abc ABC defabc CBA def
4abc ABC def DEF defabc CBA def FED

Strings 1 and 2 are right-to-left, 3 and 4 are left to right (based on the first character in the logical order string). Without prior knowledge of the source strings, you can't tell what direction they were by looking at the visual order strings.


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 04:46:58 2007 for TNTsdk by  doxygen 1.5.2