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
[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 ()
virtual ~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)

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.


Member Enumeration Documentation

Enumerator:
DIRECTION_LTR 
DIRECTION_RTL 
Enumerator:
ORDER_VISUAL 
ORDER_LOGICAL 

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)

logical

visual

1

ABC abc DEF

FED abc CBA

2

ABC abc DEF def

def FED abc CBA

3

abc ABC def

abc CBA def

4

abc ABC def DEF def

abc 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 Sun Oct 7 21:33:13 2012 for TNTsdk 2012 by  doxygen 1.6.1