This demo shows two ways of implementing lists of settings.
TIntIndexSettings shows how to implement a counted list of string settings:
ex. In the .ini file under [IntIndex]:
Count=3
Elem_0=Bla bla bla
Elem_1=Blabla
Elem_2=more bla
TEnumIndexSettings shows how to implement property Elems[en:TEnum]: string where TEnum is an enumerated type.
ex. In the .ini file under [EnumIndex]:
Enum_0=First string
Enum_1=
Enum_2=Third string
Enum_3=
In both classes, the bulk of the work is done in the methods Loaded and Saving.
In the Loaded method, we simply use the storages implementation of ISettingsStorageRead to read the values.
In the Saving method, we simply use the storages implementation of ISettingsStorageWrite to write the values.
The reason for not using the Loaded method in TIntIndexSettings is that the Count property will not have been set until after the loading.
This method of reading and writing settings explicitly could also be used for reading and writing settings whose names cannot be valid Delphi property names.