class TBidirectionalState |
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.
Private Member Functions | |
---|---|
TCategory | Pop() |
TCategory | Push(TCategory) |
const TStackItem & | State() |
Private Member Enumerations | |
---|---|
enum | anonymous { EMaxExplicitLevel = 61, EMaxLevel = 63, EMaxStackLevels = 62 } |
enum | TCategory { ELeftToRight = 1 << TChar::ELeftToRight, ELeftToRightEmbedding = 1 << TChar::ELeftToRightEmbedding, ELeftToRightOverride = 1 << TChar::ELeftToRightOverride, ERightToLeft = 1 << TChar::ERightToLeft, ERightToLeftArabic = 1 << TChar::ERightToLeftArabic, ERightToLeftEmbedding = 1 << TChar::ERightToLeftEmbedding, ERightToLeftOverride = 1 << TChar::ERightToLeftOverride, EPopDirectionalFormat = 1 << TChar::EPopDirectionalFormat, EEuropeanNumber = 1 << TChar::EEuropeanNumber, EEuropeanNumberSeparator = 1 << TChar::EEuropeanNumberSeparator, EEuropeanNumberTerminator = 1 << TChar::EEuropeanNumberTerminator, EArabicNumber = 1 << TChar::EArabicNumber, ECommonNumberSeparator = 1 << TChar::ECommonNumberSeparator, ENonSpacingMark = 1 << TChar::ENonSpacingMark, EBoundaryNeutral = 1 << TChar::EBoundaryNeutral, EParagraphSeparator = 1 << TChar::EParagraphSeparator, ESegmentSeparator = 1 << TChar::ESegmentSeparator, EWhitespace = 1 << TChar::EWhitespace, EOtherNeutral = 1 << TChar::EOtherNeutral, EBdControlsGroup = ELeftToRightEmbedding | ERightToLeftEmbedding | ELeftToRightOverride | ERightToLeftOverride | EPopDirectionalFormat, ELeftToRightGroup = ELeftToRight | EEuropeanNumber | ELeftToRightOverride | ELeftToRightEmbedding, ERightToLeftGroup = ERightToLeft | EArabicNumber | ERightToLeftArabic | ERightToLeftOverride | ERightToLeftEmbedding, EStrongGroup = ELeftToRightEmbedding | ERightToLeftEmbedding | ELeftToRightOverride | ERightToLeftOverride | ELeftToRight | ERightToLeft | ERightToLeftArabic, ENoCategory = 0 } |
enum | TOverrideState { ENoOverrideState = 0, ELeftToRightOverrideState = ELeftToRightOverride, ERightToLeftOverrideState = ERightToLeftOverride } |
Private Attributes | |
---|---|
TCategory | iPreviousCategory |
TCategory | iPreviousStrongCategory |
TInt8 | iPushesBeyond60 |
TInt8 | iPushesBeyond61 |
TStackItem | iStack |
TInt16 | iStackLevel |
TBidirectionalState | ( | TChar::TBdCategory | aPrevCat, |
TChar::TBdCategory | aPrevStrongCat, | ||
TBool | aParRightToLeft | ||
) |
Constructor suitable for test code.
TChar::TBdCategory aPrevCat | |
TChar::TBdCategory aPrevStrongCat | |
TBool aParRightToLeft |
TInt | CatToNumber | ( | TInt | aCat | ) | [static] |
Finds the highest bit set in the input. Used to convert TBidirectionalState::TCategory into TChar::TBdCategory.
TInt aCat | a TBidirectionalState::TCategory. |
TCategory | CharToBdCat | ( | TChar::TBdCategory | aCat | ) | [static] |
TChar::TBdCategory aCat |
void | DeneutralizeRuns | ( | TRunInfo * | aStart, |
TRunInfo * | aEnd, | |||
TCategory | aStartCategory, | |||
TCategory | aEndCategory | |||
) | [static] |
Turn all ON (Other Neutral) into non-neutrals according to the rules N1 and N2.
TRunInfo * aStart | The start of the run array to be altered. |
TRunInfo * aEnd | One past the end of the run array to be altered. |
TCategory aStartCategory | The last non-neutral before the run, must be ELeftToRight or ERightToLeft. |
TCategory aEndCategory | The first non-neutral after the run, must be ELeftToRight or ERightToLeft. |
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aDest | ) |
Serializes a bidirectional state to an output stream.
RWriteStream & aDest | An output stream. |
TInt | GenerateBdRunArray | ( | const TText * | aText, |
TInt | aLength, | |||
TBidirectionalState::TRunInfo * | aRun, | |||
TInt | aMaxRuns | |||
) | [static] |
Analyse the input text for runs of characters that share the same bidirectional class. Categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator are kept as singletons due to a limitation in the reordering logic.
const TText * aText | The text to be analysed. |
TInt aLength | The length of the text to be analysed. |
TBidirectionalState::TRunInfo * aRun | Output buffer for the runs after analysis. May be null if there is to be no output. |
TInt aMaxRuns | The size of the aRun array. No more than this number of runs will be output. |
void | HandleBdControls | ( | TReorderContext & | aContext | ) |
Handle LRO, RLO, LRE, RLE and PDF. After this phase, these categories will no longer be found.
This corresponds to Unicode(3.2) Bidirectional Algorithm phases X1-X7. Phase X8 is not required as the run is assumed to be all in one paragraph. Phases X9-X10 are implicit in other functions.
TReorderContext & aContext |
IMPORT_C void | InternalizeL | ( | RReadStream & | aSource | ) |
Reads a bidirectional state from an input stream, translating it from its serialized form.
RReadStream & aSource | A source stream. |
void | PrepareForNextLine | ( | const TReorderContext & | aContext | ) |
Fold context information back into TBidirectionalState.
const TReorderContext & aContext |
IMPORT_C void | ReorderLine | ( | TRunInfo * | aRunInfo, |
TInt | aRuns, | |||
TBool | aParStart, | |||
TBool | aParEnd, | |||
TBool | aParRightToLeft, | |||
TChar::TBdCategory | aNextCategory, | |||
TChar::TBdCategory | aNextStrongCategory, | |||
TBool & | aVisualEndIsAmbiguous | |||
) |
Reorders a line of text and updates the bidirectional state for the next line.
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. |
IMPORT_C void | ReorderLine | ( | TRunInfo * | aRunInfo, |
TInt | aRuns, | |||
TBool | aParStart, | |||
TBool | aParEnd, | |||
TBool | aParRightToLeft, | |||
TChar::TBdCategory | aNextCategory, | |||
TChar::TBdCategory | aNextStrongCategory | |||
) |
Reorders a line of text and updates the bidirectional state for the next line.
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. |
void | ReorderRuns | ( | TReorderContext & | aContext | ) |
Phase L2.
TReorderContext & aContext |
IMPORT_C TInt | ReorderText | ( | const TText * | aText, |
TInt | aLength, | |||
TBool | aParRightToLeft, | |||
TText *& | aNewText | |||
) | [static] |
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).
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()). |
void | ResolveImplicitLevels | ( | TReorderContext & | aContext | ) |
Phases I1 and I2.
TReorderContext & aContext |
void | ResolveNeutralTypes | ( | TReorderContext & | aContext | ) |
This phase removes the ON (Other Neutral) category, leaving only L, R, EN, and AN; no need to update aContext.iCategories.
TReorderContext & aContext |
void | ResolveWeakTypesW1W2W3 | ( | TReorderContext & | aContext | ) |
Unicode(3.2) Bidirectional Algorithm phases W1, W2 and W3.
TReorderContext & aContext |
void | ResolveWeakTypesW4W5W6 | ( | TReorderContext & | aContext | ) |
This phase removes categories NSM, AL, ES, ET, CS, BS, S, WS and BN, leaving only L, R, EN, AN and ON.
TReorderContext & aContext |
void | ResolveWeakTypesW7 | ( | TReorderContext & | aContext | ) |
TReorderContext & aContext |
IMPORT_C void | ReverseGroups | ( | TText * | aStart, |
TInt | aLength | |||
) | [static] |
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.
IMPORT_C TBool | operator== | ( | const TBidirectionalState & | aState | ) | const |
Return ETrue if two bidirectional states are identical.
const TBidirectionalState & aState | A bidirectional state. |
ELeftToRight = 1 << TChar::ELeftToRight | |
ELeftToRightEmbedding = 1 << TChar::ELeftToRightEmbedding | |
ELeftToRightOverride = 1 << TChar::ELeftToRightOverride | |
ERightToLeft = 1 << TChar::ERightToLeft | |
ERightToLeftArabic = 1 << TChar::ERightToLeftArabic | |
ERightToLeftEmbedding = 1 << TChar::ERightToLeftEmbedding | |
ERightToLeftOverride = 1 << TChar::ERightToLeftOverride | |
EPopDirectionalFormat = 1 << TChar::EPopDirectionalFormat | |
EEuropeanNumber = 1 << TChar::EEuropeanNumber | |
EEuropeanNumberSeparator = 1 << TChar::EEuropeanNumberSeparator | |
EEuropeanNumberTerminator = 1 << TChar::EEuropeanNumberTerminator | |
EArabicNumber = 1 << TChar::EArabicNumber | |
ECommonNumberSeparator = 1 << TChar::ECommonNumberSeparator | |
ENonSpacingMark = 1 << TChar::ENonSpacingMark | |
EBoundaryNeutral = 1 << TChar::EBoundaryNeutral | |
EParagraphSeparator = 1 << TChar::EParagraphSeparator | |
ESegmentSeparator = 1 << TChar::ESegmentSeparator | |
EWhitespace = 1 << TChar::EWhitespace | |
EOtherNeutral = 1 << TChar::EOtherNeutral | |
EBdControlsGroup = ELeftToRightEmbedding | ERightToLeftEmbedding | ELeftToRightOverride | ERightToLeftOverride | EPopDirectionalFormat | |
ELeftToRightGroup = ELeftToRight | EEuropeanNumber | ELeftToRightOverride | ELeftToRightEmbedding | |
ERightToLeftGroup = ERightToLeft | EArabicNumber | ERightToLeftArabic | ERightToLeftOverride | ERightToLeftEmbedding | |
EStrongGroup = ELeftToRightEmbedding | ERightToLeftEmbedding | ELeftToRightOverride | ERightToLeftOverride | ELeftToRight | ERightToLeft | ERightToLeftArabic | |
ENoCategory = 0 |
ENoOverrideState = 0 | |
ELeftToRightOverrideState = ELeftToRightOverride | |
ERightToLeftOverrideState = ERightToLeftOverride |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.