Class TParamsFile
Unit
Declaration
type TParamsFile = class(TObject)
Description
TParamsFile work as an instance of a settings file. You can have more than one instance for more than 1 settings file.
Hierarchy
- TObject
- TParamsFile
Overview
Methods
![]() |
function getParamsFileName(ACreateFolder: boolean = False): string; |
![]() |
function getParamValue(key: string): TJSONValue; |
![]() |
procedure setParamValue(key: string; Value: TJSONValue); |
![]() |
constructor Create; overload; |
![]() |
constructor Create(AFilePath: string); overload; |
![]() |
destructor Destroy; override; |
![]() |
procedure Save; |
![]() |
procedure Load; |
![]() |
procedure Cancel; |
![]() |
procedure Delete(const ClearMemoryToo: boolean = true); |
![]() |
procedure Clear; |
![]() |
function getValue(key: string; default: string = ''): string; overload; |
![]() |
function getValue(key: string; default: boolean = False): boolean; overload; |
![]() |
function getValue(key: string; default: cardinal = 0): cardinal; overload; |
![]() |
function getValue(key: string; default: integer = 0): integer; overload; |
![]() |
function getValue(key: string; default: single = 0): single; overload; |
![]() |
function getValue(key: string; default: TDateTime = 0): TDateTime; overload; |
![]() |
function getValue(key: string; default: TJSONValue = nil) : TJSONValue; overload; |
![]() |
procedure setValue(key, Value: string); overload; |
![]() |
procedure setValue(key: string; Value: boolean); overload; |
![]() |
procedure setValue(key: string; Value: cardinal); overload; |
![]() |
procedure setValue(key: string; Value: integer); overload; |
![]() |
procedure setValue(key: string; Value: single); overload; |
![]() |
procedure setValue(key: string; Value: TDateTime); overload; |
![]() |
procedure setValue(key: string; Value: TJSONValue); overload; |
![]() |
procedure setFolderName(AFolderName: string; AReload: boolean = true); |
![]() |
procedure setFilePath(AFilePath: string; AReload: boolean = true); |
![]() |
procedure InitDefaultFileNameV2(Const AEditor, ASoftware: string; AReload: boolean = true); |
![]() |
procedure MoveToFilePath(ANewFilePath: string; ASave: boolean = true; ACreateFolder: boolean = False); |
![]() |
function getFilePath: string; |
![]() |
function ToJSON: string; |
![]() |
function AsJSONObject(AClone: boolean = true): TJSONObject; |
![]() |
procedure Remove(key: string); |
![]() |
function HasChanged: boolean; |
![]() |
procedure BeginUpdate; |
![]() |
procedure EndUpdate(const AutoSaveChanges: boolean = true); |
Properties
![]() |
property onBeforeLoadEvent: TParamsLoadSaveEvent read FonBeforeLoadEvent
write SetonBeforeLoadEvent; |
![]() |
property onBeforeLoadProc: TParamsLoadSaveProc read FonBeforeLoadProc
write SetonBeforeLoadProc; |
![]() |
property onAfterLoadEvent: TParamsLoadSaveEvent read FonAfterLoadEvent
write SetonAfterLoadEvent; |
![]() |
property onAfterLoadProc: TParamsLoadSaveProc read FonAfterLoadProc
write SetonAfterLoadProc; |
![]() |
property onBeforeSaveEvent: TParamsLoadSaveEvent read FonBeforeSaveEvent
write SetonBeforeSaveEvent; |
![]() |
property onBeforeSaveProc: TParamsLoadSaveProc read FonBeforeSaveProc
write SetonBeforeSaveProc; |
![]() |
property onAfterSaveEvent: TParamsLoadSaveEvent read FonAfterSaveEvent
write SetonAfterSaveEvent; |
![]() |
property onAfterSaveProc: TParamsLoadSaveProc read FonAfterSaveProc
write SetonAfterSaveProc; |
![]() |
property onCryptEvent: TParamsCryptEvent read FonCryptEvent
write SetonCryptEvent; |
![]() |
property onCryptProc: TParamsCryptProc read FonCryptProc
write SetonCryptProc; |
![]() |
property onDecryptEvent: TParamsDecryptEvent read FonDecryptEvent
write SetonDecryptEvent; |
![]() |
property onDecryptProc: TParamsDecryptProc read FonDecryptProc
write SetonDecryptProc; |
![]() |
property PortableMode: boolean read FPortableMode write SetPortableMode; |
Description
Methods
![]() |
function getParamsFileName(ACreateFolder: boolean = False): string; |
![]() |
function getParamValue(key: string): TJSONValue; |
![]() |
procedure setParamValue(key: string; Value: TJSONValue); |
![]() |
constructor Create; overload; |
Class constructor wich just initialize private fields. |
![]() |
destructor Destroy; override; |
Instance destructor |
![]() |
procedure Save; |
Save current parameters to actual parameter file |
![]() |
procedure Load; |
Load parameters from actual parameter file |
![]() |
procedure Cancel; |
Cancel current changes and reload previous saved values |
![]() |
procedure Delete(const ClearMemoryToo: boolean = true); |
Delete the file where settings are stored.
WARNING !!! No rollback. Deleting the file can't be canceled. |
![]() |
procedure Clear; |
Clear current parameters list |
![]() |
function getValue(key: string; default: string = ''): string; overload; |
Get the string value for key parameter with an empty string as default value |
![]() |
function getValue(key: string; default: boolean = False): boolean; overload; |
Get the boolean value for key parameter with False as default value |
![]() |
function getValue(key: string; default: cardinal = 0): cardinal; overload; |
Get the cardinal value for key parameter with zero as default value |
![]() |
function getValue(key: string; default: integer = 0): integer; overload; |
Get the integer value for key parameter with zero as default value |
![]() |
function getValue(key: string; default: single = 0): single; overload; |
Get the single value for key parameter with zero as default value |
![]() |
function getValue(key: string; default: TDateTime = 0): TDateTime; overload; |
Get the TDateTime value for key parameter with December 30th 1899 at 12:00 as default value |
![]() |
function getValue(key: string; default: TJSONValue = nil) : TJSONValue; overload; |
Get the JSON value for key parameter with nil as default value |
![]() |
procedure setValue(key, Value: string); overload; |
Set the value for key parameter as string |
![]() |
procedure setValue(key: string; Value: boolean); overload; |
Set the value for key parameter as boolean |
![]() |
procedure setValue(key: string; Value: cardinal); overload; |
Set the value for key parameter as cardinal |
![]() |
procedure setValue(key: string; Value: integer); overload; |
Set the value for key parameter as integer |
![]() |
procedure setValue(key: string; Value: single); overload; |
Set the value for key parameter as single |
![]() |
procedure setValue(key: string; Value: TDateTime); overload; |
Set the value for key parameter as TDateTime |
![]() |
procedure setValue(key: string; Value: TJSONValue); overload; |
Set the value for key parameter as TJSONValue |
![]() |
function getFilePath: string; |
Return the absolute path to the parameter file (drive+folder+file name+extension) |
![]() |
function ToJSON: string; |
Return the current parameters as a serialized JSON object. |
![]() |
procedure Remove(key: string); |
Retire une clé des paramètres |
![]() |
function HasChanged: boolean; |
Returns True if a setting has changed and not been saved. |
![]() |
procedure BeginUpdate; |
Allow parameters changes but delay the Save operation to the EndUpdate call.
If you call BeginUpdate you MUST call its EndUpdate. Use a try... finally... end ! |
Properties
![]() |
property onBeforeLoadEvent: TParamsLoadSaveEvent read FonBeforeLoadEvent
write SetonBeforeLoadEvent; |
Called before loading the settings file.
Also called for Cancel operation (which reload the file). |
![]() |
property onBeforeLoadProc: TParamsLoadSaveProc read FonBeforeLoadProc
write SetonBeforeLoadProc; |
![]() |
property onAfterLoadEvent: TParamsLoadSaveEvent read FonAfterLoadEvent
write SetonAfterLoadEvent; |
Called after loading the settings file
Also called for Cancel operation (which reload the file). |
![]() |
property onAfterLoadProc: TParamsLoadSaveProc read FonAfterLoadProc
write SetonAfterLoadProc; |
![]() |
property onBeforeSaveEvent: TParamsLoadSaveEvent read FonBeforeSaveEvent
write SetonBeforeSaveEvent; |
Called before saving the settings file |
![]() |
property onBeforeSaveProc: TParamsLoadSaveProc read FonBeforeSaveProc
write SetonBeforeSaveProc; |
![]() |
property onAfterSaveEvent: TParamsLoadSaveEvent read FonAfterSaveEvent
write SetonAfterSaveEvent; |
Called after saving the settings file |
![]() |
property onAfterSaveProc: TParamsLoadSaveProc read FonAfterSaveProc
write SetonAfterSaveProc; |
![]() |
property onCryptEvent: TParamsCryptEvent read FonCryptEvent
write SetonCryptEvent; |
Called before saving the parameters in a file (and after onBeforeSave). If crypted, the file is saved as a binary format. If uncrypted, the file is saved as a JSON text file. |
![]() |
property onCryptProc: TParamsCryptProc read FonCryptProc
write SetonCryptProc; |
![]() |
property onDecryptEvent: TParamsDecryptEvent read FonDecryptEvent
write SetonDecryptEvent; |
Called after loading the parameters from a file (and before onAfterLoad). If crypted, the file is saved as a binary format. If uncrypted, the file is saved as a JSON text file. |
![]() |
property onDecryptProc: TParamsDecryptProc read FonDecryptProc
write SetonDecryptProc; |
![]() |
property PortableMode: boolean read FPortableMode write SetPortableMode; |
Portable mode : if true nothing is saved nor loaded. Default value is false. |
Generated by PasDoc 0.16.0.