[Overview][Classes][Procedures and functions][Index] | Reference for unit 'JSONPropStorage' (#lcl)

# TCustomJSONPropStorage.StorageNeeded

Ensures that the TJSONConfig storage mechanism for the class instance is allocated and configured when needed.

## Declaration

Source position: jsonpropstorage.pas line 37

`public procedure TCustomJSONPropStorage.StorageNeeded(`
`ReadOnly: Boolean`
`); override;`

## Arguments

`ReadOnly` |  | True to create the storage mechanism using read-only permission.

## Description

Creates the TJSONCOnfig instance in JSONConf if it has not already been allocated, or when the value in ReadOnly differs from the value used when the storage mechanism was created. Uses values from Formatted and GetJSONFileName to configure the JSONConf member. Increments the internal usage counter for the storage mechanism.

StorageNeeded is called from methods like: Save, Restore, SaveProperties, RestoreProperties, ReadString, WriteString, ReadInteger, WriteInteger, and EraseSections.

See FreeStorage for the actions performed when the JSON storage mechanism in JSONConf is no longer needed.

## See also

TCustomJSONPropStorage.JSONConf |  | TJSONConfig instance used to store path/value pairs.
TCustomJSONPropStorage.Formatted |  | Controls whether formatted JSON is emitted in the JSONConf storage mechanism.
TCustomJSONPropStorage.GetJSONFileName |  | Gets the value for the JSONFileName property.
TCustomJSONPropStorage.FreeStorage |  | Frees the TJSONConfig storage mechanism when no longer needed.