Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What options exist to store configuration data in Delphi?

Tags:

storage

delphi

I want to store and load diverse program data in a Delphi project. This data ranges from simple strings to more complex recurring configuration object data.

As we all know ini files provide a fast and easy way to store program data but are limited to key-value representations.

XML is often the weapon of choice when it comes to requirements like this but I want to know if there is an alternative to XML.

Recently I found superobject for Delphi which seems to be a lot easier to handle than XML. Is there anything to be said against using JSON for such "non web task"?

Are you aware of other options that support data storage and load in plain text (like ini, xml, json) in Delphi?

like image 665
Erik Virtel Avatar asked Sep 09 '25 23:09

Erik Virtel


1 Answers

In fact it doesn't matter which storing format you choose (ini, xml, json, whatever). Build an abstract Configuration class that fits all your needs and after that think about the concrete class and the concrete storing format, and decide by how easy to implement and maybe human readability

In some cases you also want to have different configuration aspects (global, machine, user).

With your configuration class you can easily mix them together (use global if not user defined) and can also mix up storing formats (global-config from DB, machine-config from Registry, user-config from file).

like image 189
Sir Rufo Avatar answered Sep 12 '25 14:09

Sir Rufo