struct TCollationMethod |
Defines a collation method.
Collation means sorting pieces of text. It needs to take into account characters, accents and case; spaces and punctuation are usually ignored. It differs from ordinary methods of sorting in that it is locale-dependent - different languages use different ordering methods. Additionally, multiple collation methods may exist within the same locale.
A collation method provides the collation keys and other data needed to customise collation; the Mem and TDesC16 collation functions (e.g. Mem::CompareC()) perform the collation. Note that these functions use the standard collation method for the current locale - you only need to specify an object of class TCollationMethod to customise this collation scheme. Collation methods can be retrieved using member functions of the Mem class. Each one has a unique identifier.
A collation method specifies a main table of collation keys, and optionally an overriding table that contains keys for which the values in the main table are overridden. A collation key table (TCollationKeyTable) is the set of collation keys: primary (basic character identity), secondary (accents and diacritics) and tertiary (case). The quaternary key is the Unicode character values themselves.
The simplest way to customise a collation method is to create a local copy of the standard collation method and change it. For example, you could use the standard method, but not ignore punctuation and spaces:
TCollationMethod m = *Mem::CollationMethodByIndex(0); // get the standard method m.iFlags |= TCollationMethod::EIgnoreNone; // dont ignore punctuation and spaces
Public Member Enumerations | |
---|---|
enum | anonymous { EIgnoreNone = 1, ESwapCase = 2, EAccentsBackwards = 4, ESwapKana = 8, EFoldCase = 16, EMatchingTable = 32, EIgnoreCombining = 64 } |
Public Attributes | |
---|---|
TUint | iFlags |
TUint | iId |
const TCollationKeyTable * | iMainTable |
const TCollationKeyTable * | iOverrideTable |
EIgnoreNone = 1 |
Don't ignore any keys (punctuation, etc. is normally ignored). |
ESwapCase = 2 |
Reverse the normal order for characters differing only in case |
EAccentsBackwards = 4 |
Compare secondary keys which represent accents in reverse order (from right to left); this is needed for French when comparing words that differ only in accents. |
ESwapKana = 8 |
Reverse the normal order for characters differing only in whether they are katakana or hiragana. |
EFoldCase = 16 |
Fold all characters to lower case before extracting keys; needed for comparison of filenames, for which case is ignored but other tertiary (level-2) distinctions are not. |
EMatchingTable = 32 |
Flag to indicate a collation method for matching purpose This flag is only needed if we wish to specify a particular collation method to be used for matching purpose. |
EIgnoreCombining = 64 |
Ignore the check for adjacent combining characters. A combining character effectively changes the character it combines with to something else and so a match doesn't occur. Setting this flag will allow character matching regardless of any combining characters. |
const TCollationKeyTable * | iMainTable |
The main collation key table; if NULL, use the standard table.
const TCollationKeyTable * | iOverrideTable |
If non-NULL, tailoring for collation keys.