Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: BIDI.H
Link against: gdi.lib

Class TBidirectionalState

class TBidirectionalState;

Description

The bidirectional state class. This class contains functions that implement the Unicode Bidirectional Algorithm, which changes text from logical order to display order for the correct display of right-to-left scripts, like Arabic and Hebrew. A TBidirectionalState object carries the embedding level and stack from one line to the next. On construction it is in its 'start of paragraph' state.

Members

Defined in TBidirectionalState:
ExternalizeL(), InternalizeL(), IsDefault(), ParRightToLeft(), ReorderLine(), ReorderLine(), ReorderText(), Reset(), ReverseGroups(), TBidirectionalState(), TRunInfo, operator==()


Construction and destruction


TBidirectionalState()

IMPORT_C TBidirectionalState();

Description

Standard constructor.

[Top]


Member functions


ReorderLine()

IMPORT_C void ReorderLine(TRunInfo *aRunInfo, TInt aRuns, TBool aParStart, TBool aParEnd, TBool aParRightToLeft, TChar::TBdCategory aNextCategory, TChar::TBdCategory aNextStrongCategory, TBool &aVisualEndIsAmbiguous);

Description

Reorders a line of text and updates the bidirectional state for the next line.

Parameters

TRunInfo *aRunInfo

An array of objects representing runs of characters with the same bidirectional category. Any number of characters can be combined into a run if they have the same category, except for the categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator, which should be put into single-character runs because the reordering logic depends on this.

TInt aRuns

Number of 'run info' objects.

TBool aParStart

Tells the function whether the line is the first line of a paragraph.

TBool aParEnd

Tells the function whether the line is the last line of a paragraph.

TBool aParRightToLeft

ETrue if the default directionality of the text to be re-ordered is right-to-left.

TChar::TBdCategory aNextCategory

The category of the character immediately after the end of the line. This is ignored if aParEnd is ETrue.

TChar::TBdCategory aNextStrongCategory

The category of the first strong character (one of the categories ELeftToRight, ELeftToRightEmbedding, ELeftToRightOverride, ERightToLeft, ERightToLeftArabic, ERightToLeftEmbedding or ERightToLeftOverride) after the end of the line. This is ignored if aParEnd is ETrue.

TBool &aVisualEndIsAmbiguous

EFalse if the logical end of this line is at the visual end and the logical beginning of the next line is at the visual beginning.


ReorderLine()

IMPORT_C void ReorderLine(TRunInfo *aRunInfo, TInt aRuns, TBool aParStart, TBool aParEnd, TBool aParRightToLeft, TChar::TBdCategory aNextCategory, TChar::TBdCategory aNextStrongCategory);

Description

Reorders a line of text and updates the bidirectional state for the next line.

Parameters

TRunInfo *aRunInfo

An array of objects representing runs of characters with the same bidirectional category. Any number of characters can be combined into a run if they have the same category, except for the categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator, which should be put into single-character runs because the reordering logic depends on this.

TInt aRuns

Number of 'run info' objects.

TBool aParStart

Tells the function whether the line is the first line of a paragraph.

TBool aParEnd

Tells the function whether the line is the last line of a paragraph.

TBool aParRightToLeft

ETrue if the default directionality of the text to be re-ordered is right-to-left.

TChar::TBdCategory aNextCategory

The category of the character immediately after the end of the line. This is ignored if aParEnd is ETrue.

TChar::TBdCategory aNextStrongCategory

The category of the first strong character (one of the categories ELeftToRight, ELeftToRightEmbedding, ELeftToRightOverride, ERightToLeft, ERightToLeftArabic, ERightToLeftEmbedding or ERightToLeftOverride) after the end of the line. This is ignored if aParEnd is ETrue.


ReorderText()

static IMPORT_C TInt ReorderText(const TText *aText, TInt aLength, TBool aParRightToLeft, TText *&aNewText);

Description

Reorders text according to the Unicode Bidirectional Reordering algorithm.

Reorders the input text from logical order (which may be bidirectional) to display order (strictly left to right).

Parameters

const TText *aText

The input text in logical order.

TInt aLength

The length of the input text.

TBool aParRightToLeft

ETrue if the default directionality of the text to be re-ordered is right-to-left.

TText *&aNewText

Returns the re-ordered text. If the text did not need re-ordering, or if there was an error, aText will be returned. Otherwise, ownership of a newly allocated buffer will be returned to the caller. This buffer must be deleted with delete[] (or CleanupArrayDeletePushL()) and not delete (or CleanupStack::PushL()).

Return value

TInt

A system-wide error value if there has been an error; KErrNone if there has not.


ReverseGroups()

static IMPORT_C void ReverseGroups(TText *aStart, TInt aLength);

Description

A utility to reverse text apart from combining characters, which remains after their base characters. This is what is needed when drawing right-to-left text.

Parameters

TText *aStart

Start position of text to be reversed.

TInt aLength

Length of text to be reversed.


Reset()

IMPORT_C void Reset();

Description

Sets the object to its default 'start of paragraph' state.


IsDefault()

IMPORT_C TBool IsDefault() const;

Description

Returns Gets the default 'start of paragraph' state.

Return value

TBool

ETrue if the object is in its default 'start of paragraph' state.


operator==()

IMPORT_C TBool operator==(const TBidirectionalState &aState) const;

Description

Return ETrue if two bidirectional states are identical.

Parameters

const TBidirectionalState &aState

A bidirectional state.

Return value

TBool

ETrue if two bidirectional states are identical.


ExternalizeL()

IMPORT_C void ExternalizeL(RWriteStream &aDest);

Description

Serializes a bidirectional state to an output stream.

Parameters

RWriteStream &aDest

An output stream.


InternalizeL()

IMPORT_C void InternalizeL(RReadStream &aSource);

Description

Reads a bidirectional state from an input stream, translating it from its serialized form.

Parameters

RReadStream &aSource

A source stream.


ParRightToLeft()

inline TBool ParRightToLeft() const;

Description

Return value

TBool

[Top]


Member classes


Class TRunInfo

class TRunInfo;

Description

Information about a run of characters with the same bidirectional category.

An array of these representing a line is passed into, and reordered by, ReorderLine().

Members

Defined in TBidirectionalState::TRunInfo:
iCategory, iDirection, iEmbeddingLevel, iIndex, iLength, iStart

Member data


iCategory

TUint iCategory;

Description

Category of a run of text: passed to ReorderLine(); these are passed in as TChar::TBdCategory values but are modified for internal use.


iEmbeddingLevel

TUint8 iEmbeddingLevel;

Description

Embedding level of this run: used internally by ReorderLine().


iDirection

TUint8 iDirection;

Description

Resolved direction of this run: 0 for left to right, 1 for right to left.


iIndex

TInt iIndex;

Description

Index of this run after reordering.


iStart

TInt iStart;

Description

Start of text; returned by ReorderText().


iLength

TInt iLength;

Description

Length of text; returned by ReorderText().