Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-12

List indexed by string

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Daniel Mach

I need some list handling objects indexed by string. May I modifiy TObjectList or does it exist some better solution? I wish to make it compatible with Lazarus and Delphi.

Dan Mach

Reply by email

Mattias Gaertner
to Daniel Mach
I need some list handling objects indexed by string. May I modifiy TObjectList or does it exist some better solution? I wish to make it compatible with Lazarus and Delphi.

There is a TStringHashList in lcl/stringhashlist.pas based on Martin Waldenburgs hash list.

For example:
  TheList:=TStringHashList.Create;
  TheList['FirstItem']:=MyObject;
  AnotherObject:=TObject(TheList['FirstItem']);
  for i:=0 to List.Count-1 do
    with TheList.List[i] do
      writeln('Index=',i,' Key=',Key,' Data=',cardinal(Data));

Mattias

Reply by email