class TKey |
Defines the characteristics of a key used to access the elements of an array.
The class is abstract and cannot be instantiated. A derived class must be defined and implemented.
The classes TKeyArrayFix, TKeyArrayVar and TKeyArrayPak, derived from TKey, are already supplied to implement keys for the fixed length element, variable length element and packed arrays.
A derived class would normally be written to define the characteristics of a key for a non standard array.
Public Member Functions | |
---|---|
IMPORT_C TAny * | At(TInt) |
IMPORT_C TInt | Compare(TInt, TInt) |
void | SetPtr(const TAny *) |
Protected Member Functions | |
---|---|
TKey() | |
TKey(TInt, TKeyCmpText) | |
TKey(TInt, TKeyCmpText, TInt) | |
TKey(TInt, TKeyCmpNumeric) |
Protected Attributes | |
---|---|
TInt | iCmpType |
TInt | iKeyLength |
TInt | iKeyOffset |
const TAny * | iPtr |
IMPORT_C | TKey | ( | TInt | aOffset, |
TKeyCmpText | aType | |||
) | [protected] |
TInt aOffset | |
TKeyCmpText aType |
IMPORT_C | TKey | ( | TInt | aOffset, |
TKeyCmpText | aType, | |||
TInt | aLength | |||
) | [protected] |
TInt aOffset | |
TKeyCmpText aType | |
TInt aLength |
IMPORT_C | TKey | ( | TInt | aOffset, |
TKeyCmpNumeric | aType | |||
) | [protected] |
TInt aOffset | |
TKeyCmpNumeric aType |
void | SetPtr | ( | const TAny * | aPtr | ) | [inline] |
Sets the pointer to a sample element whose key is to be used for comparison.
The element can be in an existing array or it can be located anywhere in addressable memory.
The At() member function supplied by a derived class must return a pointer to this sample element's key when passed an index value of KIndexPtr.
SetPtr() must be called before calling User::BinarySearch() because this algorithm uses the key of this sample element as the basis for searching the array.
const TAny * aPtr | A pointer to a sample element. |