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

Inifiles contains a tstrings descendent which is optimized for name/value pairs:
https://www.freepascal.org/docs-html/current/fcl/inifiles/thashedstringlist.html

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.

No doubt there are other options still.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to