TChar Class Reference

class TChar

Holds a character value and provides a number of utility functions to manipulate it and test its properties.

For example, there are functions to convert the character to uppercase and test whether or not it is a control character.

The character value is stored as a 32-bit unsigned integer. The shorthand "TChar value" is used to describe the character value wrapped by a TChar object.

TChar can be used to represent Unicode values outside plane 0 (that is, the extended Unicode range from 0x10000 to 0xFFFFF). This differentiates it from TText which can only be used for 16-bit Unicode character values.

TText

Nested Classes and Structures

Public Member Functions
TChar()
TChar(TUint)
IMPORT_C TBoolCompose(TUint &, const TDesC16 &)
IMPORT_C TBoolDecompose(TPtrC16 &)
TBool Eos()
voidFold()
voidFold(TInt)
IMPORT_C TBdCategoryGetBdCategory()
IMPORT_C TCategoryGetCategory()
IMPORT_C TCjkWidthGetCjkWidth()
IMPORT_C TIntGetCombiningClass()
IMPORT_C voidGetInfo(TCharInfo &)
IMPORT_C TUintGetLowerCase()
IMPORT_C TIntGetNumericValue()
IMPORT_C TUintGetTitleCase()
IMPORT_C TUintGetUpperCase()
IMPORT_C TBoolIsAlpha()
IMPORT_C TBoolIsAlphaDigit()
IMPORT_C TBoolIsAssigned()
IMPORT_C TBoolIsControl()
IMPORT_C TBoolIsDigit()
IMPORT_C TBoolIsGraph()
IMPORT_C TBoolIsHexDigit()
IMPORT_C TBoolIsLower()
IMPORT_C TBoolIsMirrored()
IMPORT_C TBoolIsPrint()
IMPORT_C TBoolIsPunctuation()
IMPORT_C TBoolIsSpace()
IMPORT_C TBoolIsTitle()
IMPORT_C TBoolIsUpper()
voidLowerCase()
voidTitleCase()
voidUpperCase()
operator TUint()
TChar operator+(TUint)
TChar &operator+=(TUint)
TChar operator-(TUint)
TChar &operator-=(TUint)
Protected Member Functions
voidSetChar(TUint)
Public Member Enumerations
enumanonymous {
EFoldCase = 1, EFoldAccents = 2, EFoldDigits = 4, EFoldSpaces = 8, EFoldKana = 16, EFoldWidth = 32, EFoldStandard = EFoldCase | EFoldAccents | EFoldDigits | EFoldSpaces, EFoldAll = -1
}
enumTBdCategory {
ELeftToRight, ELeftToRightEmbedding, ELeftToRightOverride, ERightToLeft, ERightToLeftArabic, ERightToLeftEmbedding, ERightToLeftOverride, EPopDirectionalFormat, EEuropeanNumber, EEuropeanNumberSeparator, EEuropeanNumberTerminator, EArabicNumber, ECommonNumberSeparator, ENonSpacingMark, EBoundaryNeutral, EParagraphSeparator, ESegmentSeparator, EWhitespace, EOtherNeutral
}
enumTCategory {
EAlphaGroup = 0x00, ELetterOtherGroup = 0x10, ELetterModifierGroup = 0x20, EMarkGroup = 0x30, ENumberGroup = 0x40, EPunctuationGroup = 0x50, ESymbolGroup = 0x60, ESeparatorGroup = 0x70, EControlGroup = 0x80, EMaxAssignedGroup = 0xE0, EUnassignedGroup = 0xF0, ELuCategory = EAlphaGroup | 0, ELlCategory = EAlphaGroup | 1, ELtCategory = EAlphaGroup | 2, ELoCategory = ELetterOtherGroup | 0, EMaxLetterCategory = ELetterOtherGroup | 0x0F, ELmCategory = ELetterModifierGroup | 0, EMaxLetterOrLetterModifierCategory = ELetterModifierGroup | 0x0F, EMnCategory = EMarkGroup | 0, EMcCategory = EMarkGroup | 1, EMeCategory = EMarkGroup | 2, ENdCategory = ENumberGroup | 0, ENlCategory = ENumberGroup | 1, ENoCategory = ENumberGroup | 2, EPcCategory = EPunctuationGroup | 0, EPdCategory = EPunctuationGroup | 1, EPsCategory = EPunctuationGroup | 2, EPeCategory = EPunctuationGroup | 3, EPiCategory = EPunctuationGroup | 4, EPfCategory = EPunctuationGroup | 5, EPoCategory = EPunctuationGroup | 6, ESmCategory = ESymbolGroup | 0, EScCategory = ESymbolGroup | 1, ESkCategory = ESymbolGroup | 2, ESoCategory = ESymbolGroup | 3, EMaxGraphicCategory = ESymbolGroup | 0x0F, EZsCategory = ESeparatorGroup | 0, EMaxPrintableCategory = EZsCategory, EZlCategory = ESeparatorGroup | 1, EZpCategory = ESeparatorGroup | 2, ECcCategory = EControlGroup | 0, ECfCategory = EControlGroup | 1, EMaxAssignedCategory = EMaxAssignedGroup | 0x0F, ECsCategory = EUnassignedGroup | 0, ECoCategory = EUnassignedGroup | 1, ECnCategory = EUnassignedGroup | 2
}
enumTCjkWidth { ENeutralWidth, EHalfWidth, EFullWidth, ENarrow, EWide }
enumTEncoding { EUnicode, EShiftJIS }
Private Attributes
__DECLARE_TEST
TUint iChar

Constructor & Destructor Documentation

TChar()

TChar()[inline]

Default constructor.

Constructs this character object with an undefined value.

TChar(TUint)

TChar(TUintaChar)[inline]

Constructs this character object and initialises it with the specified value.

Parameters

TUint aCharThe initialisation value.

Member Functions Documentation

Compose(TUint &, const TDesC16 &)

IMPORT_C TBoolCompose(TUint &aResult,
const TDesC16 &aSource
)[static]

Parameters

TUint & aResult
const TDesC16 & aSource

Decompose(TPtrC16 &)

IMPORT_C TBoolDecompose(TPtrC16 &aResult)const

Parameters

TPtrC16 & aResult

Eos()

TBool Eos()const [inline]

Tests whether the character is the C/C++ end-of-string character - 0.

True, if the character is 0; false, otherwise.

Fold()

voidFold()[inline]

Converts the character to a form which can be used in tolerant comparisons without control over the operations performed.

Tolerant comparisons are those which ignore character differences like case and accents.

This function can be used when searching for a string in a text file or a file in a directory. Folding performs the following conversions: converts to lowercase, strips accents, converts all digits representing the values 0..9 to the ordinary digit characters '0'..'9', converts all spaces (standard, non-break, fixed-width, ideographic, etc.) to the ordinary space character (0x0020), converts Japanese characters in the hiragana syllabary to katakana, and converts East Asian halfwidth and fullwidth variants to their ordinary forms. You can choose to perform any subset of these operations by using the other function overload.

User::Fold

Fold(TInt)

voidFold(TIntaFlags)[inline]

Converts the character to a form which can be used in tolerant comparisons allowing selection of the specific fold operations to be performed.

TChar::EFoldCase

User::Fold

Parameters

TInt aFlagsFlags which define the operations to be performed. The values are defined in the enum beginning with EFoldCase.

GetBdCategory()

IMPORT_C TBdCategoryGetBdCategory()const

GetCategory()

IMPORT_C TCategoryGetCategory()const

GetCjkWidth()

IMPORT_C TCjkWidthGetCjkWidth()const

GetCombiningClass()

IMPORT_C TIntGetCombiningClass()const

GetInfo(TCharInfo &)

IMPORT_C voidGetInfo(TCharInfo &aInfo)const

Parameters

TCharInfo & aInfo

GetLowerCase()

IMPORT_C TUintGetLowerCase()const

GetNumericValue()

IMPORT_C TIntGetNumericValue()const

GetTitleCase()

IMPORT_C TUintGetTitleCase()const

GetUpperCase()

IMPORT_C TUintGetUpperCase()const

IsAlpha()

IMPORT_C TBoolIsAlpha()const

IsAlphaDigit()

IMPORT_C TBoolIsAlphaDigit()const

IsAssigned()

IMPORT_C TBoolIsAssigned()const

IsControl()

IMPORT_C TBoolIsControl()const

IsDigit()

IMPORT_C TBoolIsDigit()const

IsGraph()

IMPORT_C TBoolIsGraph()const

IsHexDigit()

IMPORT_C TBoolIsHexDigit()const

IsLower()

IMPORT_C TBoolIsLower()const

IsMirrored()

IMPORT_C TBoolIsMirrored()const

IsPrint()

IMPORT_C TBoolIsPrint()const

IsPunctuation()

IMPORT_C TBoolIsPunctuation()const

IsSpace()

IMPORT_C TBoolIsSpace()const

IsTitle()

IMPORT_C TBoolIsTitle()const

IsUpper()

IMPORT_C TBoolIsUpper()const

LowerCase()

voidLowerCase()[inline]

Converts the character to its lowercase form.

Characters lacking a lowercase form are unchanged.

User::LowerCase

SetChar(TUint)

voidSetChar(TUintaChar)[protected, inline]

Parameters

TUint aChar

TitleCase()

voidTitleCase()[inline]

Converts the character to its titlecase form.

The titlecase form of a character is identical to its uppercase form unless a specific titlecase form exists. Characters lacking a titlecase form are unchanged.

UpperCase()

voidUpperCase()[inline]

Converts the character to its uppercase form.

Characters lacking an uppercase form are unchanged.

User::UpperCase

operator TUint()

operator TUint()const [inline]

Gets the value of the character as an unsigned integer.

The operator casts a TChar to a TUint, returning the TUint value wrapped by this character object.

operator+(TUint)

TChar operator+(TUintaChar)[inline]

Gets the result of adding an unsigned integer value to this character object.

This character object is not changed.

A character object whose value is the result of the addition operation.

Parameters

TUint aCharThe value to be added.

operator+=(TUint)

TChar &operator+=(TUintaChar)[inline]

Adds an unsigned integer value to this character object.

This character object is changed by the operation.

A reference to this character object.

Parameters

TUint aCharThe value to be added.

operator-(TUint)

TChar operator-(TUintaChar)[inline]

Gets the result of subtracting an unsigned integer value from this character object.

This character object is not changed.

A character object whose value is the result of the subtraction operation.

Parameters

TUint aCharThe value to be subtracted.

operator-=(TUint)

TChar &operator-=(TUintaChar)[inline]

Subtracts an unsigned integer value from this character object.

This character object is changed by the operation.

A reference to this character object.

Parameters

TUint aCharThe value to be subtracted.

Member Enumerations Documentation

Enum anonymous

Flags defining operations to be performed using TChar::Fold().

The flag values are passed to the Fold() funtion.

TChar::Fold

Enumerators

EFoldCase = 1

Convert characters to their lower case form if any.

EFoldAccents = 2

Strip accents

EFoldDigits = 4

Convert digits representing values 0..9 to characters '0'..'9'

EFoldSpaces = 8

Convert all spaces (ordinary, fixed-width, ideographic, etc.) to ' '

EFoldKana = 16

Convert hiragana to katakana.

EFoldWidth = 32

Fold fullwidth and halfwidth variants to their standard forms

EFoldStandard = EFoldCase | EFoldAccents | EFoldDigits | EFoldSpaces

Perform standard folding operations, i.e.those done by Fold() with no argument

EFoldAll = -1

Perform all possible folding operations

Enum TBdCategory

The bi-directional Unicode character category.

For more information on the bi-directional algorithm, see Unicode Technical Report No. 9 available at: http://www.unicode.org/unicode/reports/tr9.

Enumerators

ELeftToRight

Left to right.

ELeftToRightEmbedding

Left to right embedding.

ELeftToRightOverride

Left-to-Right Override.

ERightToLeft

Right to left.

ERightToLeftArabic

Right to left Arabic.

ERightToLeftEmbedding

Right to left embedding.

ERightToLeftOverride

Right-to-Left Override.

EPopDirectionalFormat

Pop Directional Format.

EEuropeanNumber

European number.

EEuropeanNumberSeparator

European number separator.

EEuropeanNumberTerminator

European number terminator.

EArabicNumber

Arabic number.

ECommonNumberSeparator

Common number separator.

ENonSpacingMark

Non Spacing Mark.

EBoundaryNeutral

Boundary Neutral.

EParagraphSeparator

Paragraph Separator.

ESegmentSeparator

Segment separator.

EWhitespace

Whitespace

EOtherNeutral

Other neutrals; all other characters: punctuation, symbols.

Enum TCategory

General Unicode character category.

The high nibble encodes the major category (Mark, Number, etc.) and a low nibble encodes the subdivisions of that category.

The category codes can be used in three ways:

(i) as unique constants: there is one for each Unicode category, with a name of the form
    E<XX>Category
where
    <XX>
is the category name given by the Unicode database (e.g., the constant ELuCategory is used for lowercase letters, category Lu);

(ii) as numbers in certain ranges: letter categories are all <= EMaxLetterCategory;

(iii) as codes in which the upper nibble gives the category group (e.g., punctuation categories all yield TRUE for the test (category & 0xF0) ==EPunctuationGroup).

Enumerators

EAlphaGroup = 0x00

Alphabetic letters.

Includes ELuCategory, ELlCategory and ELtCategory.

ELetterOtherGroup = 0x10

Other letters.

Includes ELoCategory.

ELetterModifierGroup = 0x20

Letter modifiers.

Includes ELmCategory.

EMarkGroup = 0x30

Marks group.

Includes EMnCategory, EMcCategory and EMeCategory.

ENumberGroup = 0x40

Numbers group.

Includes ENdCategory, ENlCategory and ENoCategory.

EPunctuationGroup = 0x50

Punctuation group.

IncludesEPcCategory, PdCategory, EpeCategory, EPsCategory and EPoCategory.

ESymbolGroup = 0x60

Symbols group.

Includes ESmCategory, EScCategory, ESkCategory and ESoCategory.

ESeparatorGroup = 0x70

Separators group.

Includes EZsCategory, EZlCategory and EZlpCategory.

EControlGroup = 0x80

Control, format, private use, unassigned.

Includes ECcCategory, ECtCategory, ECsCategory, ECoCategory and ECnCategory.

EMaxAssignedGroup = 0xE0

The highest possible groups category.

EUnassignedGroup = 0xF0

Unassigned to any other group.

ELuCategory = EAlphaGroup | 0

Letter, Uppercase.

ELlCategory = EAlphaGroup | 1

Letter, Lowercase.

ELtCategory = EAlphaGroup | 2

Letter, Titlecase.

ELoCategory = ELetterOtherGroup | 0

Letter, Other.

EMaxLetterCategory = ELetterOtherGroup | 0x0F

The highest possible (non-modifier) letter category.

ELmCategory = ELetterModifierGroup | 0

Letter, Modifier.

EMaxLetterOrLetterModifierCategory = ELetterModifierGroup | 0x0F

The highest possible letter category.

EMnCategory = EMarkGroup | 0

Mark, Non-Spacing

EMcCategory = EMarkGroup | 1

Mark, Combining.

EMeCategory = EMarkGroup | 2

Mark, Enclosing.

ENdCategory = ENumberGroup | 0

Number, Decimal Digit.

ENlCategory = ENumberGroup | 1

Number, Letter.

ENoCategory = ENumberGroup | 2

Number, Other.

EPcCategory = EPunctuationGroup | 0

Punctuation, Connector.

EPdCategory = EPunctuationGroup | 1

Punctuation, Dash.

EPsCategory = EPunctuationGroup | 2

Punctuation, Open.

EPeCategory = EPunctuationGroup | 3

Punctuation, Close.

EPiCategory = EPunctuationGroup | 4

Punctuation, Initial Quote

EPfCategory = EPunctuationGroup | 5

Punctuation, Final Quote

EPoCategory = EPunctuationGroup | 6

Punctuation, Other.

ESmCategory = ESymbolGroup | 0

Symbol, Math.

EScCategory = ESymbolGroup | 1

Symbol, Currency.

ESkCategory = ESymbolGroup | 2

Symbol, Modifier.

ESoCategory = ESymbolGroup | 3

Symbol, Other.

EMaxGraphicCategory = ESymbolGroup | 0x0F

The highest possible graphic character category.

EZsCategory = ESeparatorGroup | 0

Separator, Space.

EMaxPrintableCategory = EZsCategory

The highest possible printable character category.

EZlCategory = ESeparatorGroup | 1

Separator, Line.

EZpCategory = ESeparatorGroup | 2

Separator, Paragraph.

ECcCategory = EControlGroup | 0

Other, Control.

ECfCategory = EControlGroup | 1

Other, Format.

EMaxAssignedCategory = EMaxAssignedGroup | 0x0F

The highest possible category for assigned 16-bit characters; does not include surrogates, which are interpreted as pairs and have no meaning on their own.

ECsCategory = EUnassignedGroup | 0

Other, Surrogate.

ECoCategory = EUnassignedGroup | 1

Other, Private Use.

ECnCategory = EUnassignedGroup | 2

Other, Not Assigned.

Enum TCjkWidth

Notional character width as known to East Asian (Chinese, Japanese, Korean (CJK)) coding systems.

Enumerators

ENeutralWidth

Includes 'ambiguous width' defined in Unicode Technical Report 11: East Asian Width

EHalfWidth

Character which occupies a single cell.

EFullWidth

Character which occupies 2 cells.

ENarrow

Characters that are always narrow and have explicit full-width counterparts. All of ASCII is an example of East Asian Narrow characters.

EWide

Characters that are always wide. This category includes characters that have explicit half-width counterparts.

Enum TEncoding

Encoding systems used by the translation functions.

Enumerators

EUnicode

The Unicode encoding.

EShiftJIS

The shift-JIS encoding (used in Japan).

Member Data Documentation

__DECLARE_TEST

__DECLARE_TEST[private]

TUint iChar

TUint iChar[private]