[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QMap bug ? (Re: kioslaves don't die?)
From:       Waldo Bastian <bastian () suse ! de>
Date:       1999-11-10 8:42:31
[Download RAW message or body]

On Wed, 10 Nov 1999, Alexander Feigl wrote:
> At Die, 09 Nov 1999 Rik Hemsley wrote:
> > Just as an aside, what's the problem with generating unique keys ?
> >
> 
> The keys are used are used for a "quick lookup". In this special case the key
> is the protocol (http,ftp,file). What unique key do you want to use? a serial
> numbers that are increased for each entry? we would lose the only real
> advantage of QMap I can see. Without a quick lookup for a special protocol we
> could use QList or similar - that is what we have to do if the current
> behaviour of QMap is not a bug.

Use a QMap in conjunction with a QList.

typedef QList<myItem>;

QDict<MyList> dict;

add(QString Key, myITem value)
{
   MyList *list = dict[key];
   if (!list)
   {
      list = new MyList();
      dict[key] = list;
   }
   list->append(value);
}

BTW. I have used this code in kcookiejar. Where is the cookie jar gone?
I can't find it anywere in CVS.

Cheers,
Waldo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic