class TKeyArrayVar : public TKey |
Defines the characteristics of a key used to access the elements of arrays of variable length objects.
An object of this type can represent three categories of key, depending on the constructor used:
1. a descriptor key
2. a text key
3. a numeric key.
The Sort(), InsertIsqL(), Find() and FindIsqL() member functions of the CArrayVarFlat and CArrayVarSeg class hierarchies need a TKeyArrayVar object as an argument to define the location and type of key within an array element.
A TKeyArrayVar object is also required for sorting a packed array. The implementation of the SortL() member function of the CArrayPakFlat class constructs a temporary CArrayVarFlat object which requires the TKeyArrayVar object.
Public Member Functions | |
---|---|
TKeyArrayVar ( TInt , TKeyCmpText ) | |
TKeyArrayVar ( TInt , TKeyCmpText , TInt ) | |
TKeyArrayVar ( TInt , TKeyCmpNumeric ) |
Protected Member Functions | |
---|---|
IMPORT_C TAny * | At ( TInt ) |
IMPORT_C void | Set ( CBufBase *) |
Inherited Functions | |
---|---|
TKey::Compare(TInt,TInt)const | |
TKey::SetPtr(const TAny *) | |
TKey::TKey() | |
TKey::TKey(TInt,TKeyCmpNumeric) | |
TKey::TKey(TInt,TKeyCmpText) | |
TKey::TKey(TInt,TKeyCmpText,TInt) |
Protected Attributes | |
---|---|
CBufBase * | iBase |
Inherited Attributes | |
---|---|
TKey::iCmpType | |
TKey::iKeyLength | |
TKey::iKeyOffset | |
TKey::iPtr |
IMPORT_C | TKeyArrayVar | ( | TInt | anOffset, |
TKeyCmpText | aType | |||
) |
Constructs the characteristics of a descriptor key.
No length value is passed as this is taken from the descriptor type key.
TInt anOffset | The offset of the key from the start of an array element. |
TKeyCmpText aType | An enumeration which defines the type of comparison to be made between two descriptor keys. |
IMPORT_C | TKeyArrayVar | ( | TInt | anOffset, |
TKeyCmpText | aType, | |||
TInt | aLength | |||
) |
Constructs the characteristics of a text key.
TInt anOffset | The offset of the key from the start of an array element. |
TKeyCmpText aType | An enumeration which defines the type of comparison to be made between two text keys. |
TInt aLength | The length of the text key. |
IMPORT_C | TKeyArrayVar | ( | TInt | anOffset, |
TKeyCmpNumeric | aType | |||
) |
Constructs the characteristics of a numeric key.
TInt anOffset | The offset of the key from the start of an array element. |
TKeyCmpNumeric aType | An enumeration which defines the type of the numeric key. |
IMPORT_C TAny * | At | ( | TInt | anIndex | ) | const [protected, virtual] |
Gets a pointer to the key of a specified array element.
The default implementation raises a USER 35 panic.
The function is called by TKey::Compare() to compare the keys of two elements.
The implementation provided by a derived class must convert the index to a pointer to the key within the corresponding element. The implementation depends on the design of the array but, as general rule, use the index value to get a pointer to the corresponding element and then add the TKey protected data member iKeyOffset to this pointer to get a pointer to the key itself.
By convention, the index value is relative to zero; i.e. a zero value refers to the first element in the array. By this convention, the index can take any value between zero and the number of elements within the array minus one.
The function must also handle the special index value KIndexPtr. When this value is passed, the function should return a pointer to the key within the sample element. A pointer to the sample element is held in the protected data member iPtr and can be set up using SetPtr() .
The implementation of this function also assumes that the derived class has a pointer to the array itself or has a function for finding it.
TInt anIndex | The index of the array element or the special index value KIndexPtr. |
IMPORT_C void | Set | ( | CBufBase * | aBase | ) | [protected, virtual] |
CBufBase * aBase |
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.