Project: Environment Variables Unit
Unit: PJEnvVars
Applies to: ~>3.0
type
TPJEnvVarsEnum =
{$IFNDEF Supports_Closures}
procedure(const VarName: string; Data: Pointer) of object;
{$ELSE}
reference to procedure(const VarName: string; Data: Pointer);
{$ENDIF}
TPJEnvVarsEnum defines the type of callback method that is called when enumerating environment variable names. Callbacks of this type are used in the TPJEnvironmentVars.EnumNames and deprecated TPJEnvVars.EnumNames methods.
If the compiler supports anonymous methods (a.k.a. closures) then the Supports_Closures
symbol is defined and TPJEnvVarsEnum is an anonymous method. Otherwise the Supports_Closures
symbol is undefined and TPJEnvVarsEnum is a normal method
Regardless of how TPJEnvVarsEnum is defined the parameters are the same.
Parameters:
-
VarName -- The name of the current environment variable in the enumeration.
-
Data -- User-specified value that was passed to TPJEnvironmentVars.EnumNames or TPJEnvVars.EnumNames. If or how this value is interpreted is left to the caller.
Important: Callback methods should not add, modify or delete environment variables since this can lead to obscure bugs in the enumeration.