Read-only archive of the All About Symbian forum (2001–2013) · About this archive

CArrayFixSeg + TKeyArrayFix + HBufC = PROBLEM!!!!!!!!

0 replies · 1,295 views · Started 19 April 2005

Hi All,
I have a data structure of the form as follows

typedef struct KeyVal
{
HBufC *iKey;
HBufC *iVal;
KeyVal()
{
iKey = NULL;
iVal = NULL;
}

} StructKeyVal;

typedef struct Dict
{
int iXMLNum;
CArrayFixSeg<StructKeyVal> *iKeyVal;
Dict()
{
iXMLNum = 0;
}
} StructDict;

CArrayFixSeg<StructDict> *fRDict;

The purpose is to allow fRDict contain different dictionaries identified by iXMLNum.Array iKeyVal contains the dictionary as key,value pairs for a particular iXMLNum.To sort & search a particular key in a dictionary,i am creating the key as follows:
TKeyArrayFix actNameKey(_FOFF(StructKeyVal,iKey),ECmpFolded);

There are 2 problems:
1) Sorting the array using above key has no effect,but creating the key as
TKeyArrayFix actNameKey(_FOFF(StructDict,iKeyVal),ECmpFolded);
sorts the array properly

2) Searching a particular entry "prakash" as:
_LIT(KTxt,"prakash"😉;
TBufC<10> CBuf = KTxt;
TInt yInd;
StructKeyVal yTT;
yTT.iKey = CBuf.AllocL();
(fRDict->At(0)).iKeyVal->FindIsq(yTT,actNameKey,yInd);

gives wrong answer.With "FindIsq" yInd is assigned 0 & with "Find" it gets 3 which is the number of elements in the array.

There is however no problem when i am sorting fRDict in a similar way using iXMlNum & finding a particular entry.

Probably i am missing something while dealing with descriptors

Thanx in advance
Regards
Chandra Prakash