[fpc-pascal] Container class for key-value pairs

Marc Santhoff M.Santhoff at web.de
Tue Sep 12 00:19:37 CEST 2017

On Mo, 2017-09-11 at 09:22 +0200, Michael Van Canneyt wrote:
> On Mon, 11 Sep 2017, Marc Santhoff wrote:
> > Hi,
> >
> > since I'm programming Pascal only on occasion I'd like to know:
> >
> > Which container class ist the easiest to use for key-value pairs?
> >
> > The goal is to store a configuration set from a hardware measuring
> > device having 81 items. This item set is fixed, no change. The values
> > are parsed from json data (text) and have to be stored in memory (for
> > now).
> You have several options. Plain TStringlist is easy to use:
> https://www.freepascal.org/docs-html/current/rtl/classes/tstringlist.html

Used all the time without thinking about it. ;)

> contnrs unit contains TFPStringHashTable:
> https://www.freepascal.org/docs-html/current/fcl/contnrs/tfpstringhashtable.html
> TFPGMap from unit fgl can be used to create key/value map.

Two intresting alternatives to look at.

> No doubt there are other options still.

I think so, too. My first action will be to have a deep look at the unit
fpjson. Hopefully I can re-use the containers therein without any extra
pushing around of data bits in memory.

Thanks for showing some directions,

More information about the fpc-pascal mailing list