TCollate Class Reference

class TCollate

Provides low-level collation functions.

Constructor & Destructor Documentation

TCollate(const LCharSet *, TUint, TUint)

TCollate ( const LCharSet * aCharSet,
TUint aMask = 0,
TUint aFlags = 0xFFFFFFFF
)

Construct a TCollate object based on the collation method specified within aCharSet, if any. If there is none, or aCharSet is null, the standard collation method will be used. aMask and aFlags provide a method for overriding the flags in the collation method: Each flag set to 1 in aMask is a flag that will be overridden and set to the corresponding flag value in aFlags. Ownership of aCharSet is not passed.

Construct a TCollate object based on the collation method specified within aCharSet, if any. If there is none, or aCharSet is null, the standard collation method will be used. aMask and aFlags provide a method for overriding the flags in the collation method: Each flag set to 1 in aMask is a flag that will be overridden and set to the corresponding flag value in aFlags. Ownership of aCharSet is not passed.

Parameters

const LCharSet * aCharSet Locale-specific character attribute and collation data
TUint aMask = 0 Provides a method for overriding the flags in the collation method
TUint aFlags = 0xFFFFFFFF Provides a method for overriding the flags in the collation method

TCollate(const TCollationMethod &)

TCollate ( const TCollationMethod & aMethod )

Construct a TCollate object based on an already constructed TCollationMethod specified in aMethod. Ownership is not passed.

Construct a TCollate object based on an already constructed TCollationMethod specified in aMethod. Ownership is not passed.

Parameters

const TCollationMethod & aMethod Collation keys table

Member Functions Documentation

Compare(const TUint16 *, TInt, const TUint16 *, TInt, TInt)

TComparisonResult Compare ( const TUint16 * aString1,
TInt aLength1,
const TUint16 * aString2,
TInt aLength2,
TInt aMaxLevel = 3
) const

Compare the string beginning at aString1 of length aLength1 against the string beginning at aString2 of length aLength2. aMaxLevel determines the tightness of the collation. At level 0, only character identities are distinguished. At level 1 accents are distinguished as well. At level 2 case is distinguishes as well. At level 3 all valid different Unicode characters are considered different.

Compare the string beginning at aString1 of length aLength1 against the string beginning at aString2 of length aLength2.

Parameters

const TUint16 * aString1 First string to compare
TInt aLength1 Length of aString1
const TUint16 * aString2 Second string to compare
TInt aLength2 Length of aString2
TInt aMaxLevel = 3 Determines the tightness of the collation. At level 0, only character identities are distinguished. At level 1 accents are distinguished as well. At level 2 case is distinguished as well. At level 3 all non canonically equivalent Unicode characters are considered different. By default aMaxLevel is 3.

CompareKeySequences(TUTF32Iterator &, TUTF32Iterator &, TInt, TInt, TInt)

TComparisonResult CompareKeySequences ( TUTF32Iterator & aLeft,
TUTF32Iterator & aRight,
TInt aMaxLevel,
TInt aRightStringWildChar,
TInt aEscapeChar
) const [private]

Compare values output from the iterators. After the comparison, if ERightIsPrefixOfLeft or EStringsIdentical is returned, then aLeft and aRight will be pointing at the next key (at MaxLevel) after the match. If right is shown to be a prefix of left, this means that it has been checked at all requested levels. If it is reported that the right is a prefix of the left, then this will mean also that there are no unmatched combining characters on the left.

Compare values output from the iterators. After the comparison, if ERightIsPrefixOfLeft or EStringsIdentical is returned, then aLeft will be pointing at the next character (at MaxLevel) after the match. If right is shown to be a prefix of left, this means that it has been checked at all requested levels. If it is reported that the right is a prefix of the left, then this will mean also that there are no unmatched combining characters on the left.

Parameters

TUTF32Iterator & aLeft
TUTF32Iterator & aRight
TInt aMaxLevel
TInt aRightStringWildChar
TInt aEscapeChar

Find(const TUint16 *, TInt, const TUint16 *, TInt, TInt, TUint)

TInt Find ( const TUint16 * aString1,
TInt aLength1,
const TUint16 * aString2,
TInt aLength2,
TInt aMaxLevel,
TUint aString2WildChar = 0
) const

Find the string beginning at aString2 of length aLength2 in the string beginning at aString1 of length aLength1. aMaxLevel determines the tightness of the collation, see Compare for details.

Find the string beginning at aString2 of length aLength2 in the string beginning at aString1 of length aLength1.

Parameters

const TUint16 * aString1 String to search
TInt aLength1 Length of aString1
const TUint16 * aString2 String to search for
TInt aLength2 Length of aString2
TInt aMaxLevel Determines the tightness of the collation. At level 0, only character identities are distinguished. At level 1 accents are distinguished as well. At level 2 case is distinguishes as well. At level 3 all valid different Unicode characters are considered different.
TUint aString2WildChar = 0 Wild card character which may be specified for aString2. By default wild card character is not specified and not used.

Find(const TUint16 *, TInt, const TUint16 *, TInt, TInt &, TInt, TUint)

TInt Find ( const TUint16 * aString1,
TInt aLength1,
const TUint16 * aString2,
TInt aLength2,
TInt & aLengthFound,
TInt aMaxLevel,
TUint aString2WildChar = 0
) const

Find the string beginning at aString2 of length aLength2 in the string beginning at aString1 of length aLength1.

Parameters

const TUint16 * aString1 String to search
TInt aLength1 Length of aString1
const TUint16 * aString2 String to search for
TInt aLength2 Length of aString2
TInt & aLengthFound A refernce to the length of the match found in the candidate string
TInt aMaxLevel Determines the tightness of the collation. At level 0, only character identities are distinguished. At level 1 accents are distinguished as well. At level 2 case is distinguishes as well. At level 3 all valid different Unicode characters are considered different.
TUint aString2WildChar = 0 Wild card character which may be specified for aString2. By default wild card character is not specified and not used.

FindKeySequence(TUTF32Iterator &, TUTF32Iterator &, TInt, TInt, TInt, TInt &)

TInt FindKeySequence ( TUTF32Iterator & aCandidate,
TUTF32Iterator & aSearchTerm,
TInt aMaxLevel,
TInt aWildChar,
TInt aEscapeChar,
TInt & aLengthFound
) const [private]

Finds search term inside candidate string. Returns KErrNotFound if there is no match, returns the offset into the candidate string at which the search term was found (note that this is the offset from the start of the iteration, not from where the iteration was when the function was called). If a string was found, the search term iterator is left pointing at the end of the search term, and the candidate iterator is left pointing just after the matched keys. aMatchPos returns where in the candidate string the match was found.

Finds search term inside candidate string. Returns KErrNotFound if there is no match, returns the offset into the candidate string at which the search term was found. If a string was found, the search term iterator is left pointing at the end of the search term, and the candidate iterator is left pointing just after the matched keys. aMatchPos returns where in the candidate string the match was found.

Parameters

TUTF32Iterator & aCandidate
TUTF32Iterator & aSearchTerm
TInt aMaxLevel
TInt aWildChar
TInt aEscapeChar
TInt & aLengthFound

Match(const TUint16 *, TInt, const TUint16 *, TInt, TInt, TUint, TUint, TUint)

TInt Match ( const TUint16 * aCandidate,
TInt aCandidateLength,
const TUint16 * aSearchTerm,
TInt aSearchTermLength,
TInt aMaxLevel,
TUint aWildChar = '?',
TUint aWildSequenceChar = '*',
TUint aEscapeChar = 0
) const

Test if the string beginning at aSearchTerm of length aSearchTermLength matches the string beginning at aCandidate of length aCandidateLength. aMaxLevel determines the tightness of the collation, see Compare for details. The search term may have wild card characters as specified by aWildChar (for matching a single grapheme- i.e. character and any characters that combine with it, such as accents) and aWildSequenceChar (for matching any sequence of whole graphemes). The return value is KErrNotFound iff the search term does not match the candidate string exactly. To find a match within the candidate string, the search term must begin and end with a wild sequence character. If the search term does match the candidate string, 0 will be returned, unless the first character of the search term is a wild sequence character in which case the value returned will be the index into aCandidate at which the first non-wild sequence character matched. aWildSequenceChar must be a valid (non-surrogate) Unicode character below FFFE.

Match the pattern defined by aSearchTerm with aCandidate. Return the index in aCandidate of the start of the first pattern matched - that is, the first character in aSearchTerm after all wild-sequence characters have been matched. Return KErrNotFound if there is no match.

For example, if aCandidate is "abcdefghijkl", the following values of aSearchTerm yield the following results: "abc*" gives 0 "abc" gives KErrNotFound "xyz" gives KErrNotFound "*def" gives KErrNotFound "*def*" gives 3 "*d?f*" gives 3 "a*kl" gives 0 "*d*kl" gives 4

To match a pattern anywhere in aCandidate, aSearchTerm must both start and end with aString2WildSequenceChar

.

Parameters

const TUint16 * aCandidate String to search
TInt aCandidateLength Length of aCandidate
const TUint16 * aSearchTerm String to search for
TInt aSearchTermLength Length of aSearchTerm
TInt aMaxLevel Determines the tightness of the collation. At level 0, only character identities are distinguished. At level 1 accents are distinguished as well. At level 2 case is distinguishes as well. At level 3 all valid different Unicode characters are considered different.
TUint aWildChar = '?' Wild card character which may be specified for aSearchTerm. By default the wild card character used is '?'.
TUint aWildSequenceChar = '*' Wild card sequence character which may be specified for aSearchTerm. Its default value is '*'.
TUint aEscapeChar = 0 Escape character. If it is non-zero and precdes aWildChar and aWildSequenceChar characters in aCandidate string, then these characters should be treated as normal characters.

Member Enumerations Documentation

Enum TComparisonResult

Enumerators

ELeftComparesLessAndIsNotPrefix = -2
ELeftIsPrefixOfRight = -1
EStringsIdentical = 0
ERightIsPrefixOfLeft = 1
ERightComparesLessAndIsNotPrefix = 2

Member Data Documentation

TCollationMethod iMethod

TCollationMethod iMethod [private]