Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Dictionary object for FreePascal?

It's incredibly impossible to find things for FreePascal because all searches end up at some sort of Delphi related site.

Is there a built-in Dictionary object?

This page references "TDictionary" under the Generic Classes section, but I have no idea what unit it might be in, or if it even exists.

like image 946
Name McChange Avatar asked Apr 02 '13 21:04

Name McChange


2 Answers

The unit fgl contains the basic generic classes for freepascal.

Among those classes, the closest to a TDictionary is TFPGMap.

An example how to use this class can be found here: Class Map or Dictionary, anyone?.

like image 56
LU RD Avatar answered Nov 05 '22 01:11

LU RD


You can use very compatible TDictionary from Generics.Collections unit:

  • https://github.com/dathox/generics.collections
  • http://bugs.freepascal.org/view.php?id=27206

works for FPC trunk rev. 30239 and newer.

Edit 05.08.2016

Generics.Collections library has been added to FPC trunk as rtl-generics package in r34229. Latest version of precompiled FPC trunk (with Generics.Collections) for Win32 + Lazarus trunk available at http://newpascal.org . The repository of Generics.Collections ( https://github.com/dathox/generics.collections ) will be still used for maintenance (should be synced often with FPC trunk).

like image 21
HNB Avatar answered Nov 04 '22 23:11

HNB