Open delphidabbler opened 2 years ago
Although the Data parameter of the various TPJEnvironmentVars enumerator methods is useful on occasion, a lot of the time it isn't required.
Data
TPJEnvironmentVars
So how about a couple more enumerator overloads without the Data parameter? E.g.:
TPJEnvironmentVars = class(TObject) // ... public // ... type TEnumNamesCallback = reference to procedure (const VarName: string); TEnumVarsCallback = reference to procedure(const EnvVar: TPJEnvironmentVar); //.. class procedure EnumNames(Callback: TEnumNamesCallback); overload; class procedure EnumVars(Callback: TEnumVarsCallback); overload; // ... end; // ... class procedure TPJEnvironmentVars.EnumNames(Callback: TEnumNamesCallback) begin Assert(Assigned(Callback)); EnumNames<Integer>( procedure (const VarName: string; Data: Integer) begin Callback(VarName); end, 0 // Dummy value ); end; class procedure TPJEnvironmentVars.EnumVars(Callback: TEnumVarsCallback) begin Assert(Assigned(Callback)); EnumVars<Integer>( procedure (const EnvVar: TPJEnvironmentVar; Data: Integer) begin Callback(EnvVar); end, 0 // Dummy value ); end;
Although the
Data
parameter of the variousTPJEnvironmentVars
enumerator methods is useful on occasion, a lot of the time it isn't required.So how about a couple more enumerator overloads without the Data parameter? E.g.: