This example creates a public method Triple in class TEmployees:
procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
Func: TCodeMemberMethod;
begin
case Args.CodeType.Name of
'TEmployees':
begin
Func := Args.CodeType.AddFunction('Triple', 'double', mvPublic);
Func.AddParameter('Value', 'double');
Func.AddSnippet('Result := Value * 3;');
end;
end;
end;
It will create the following method declaration and implementation:
function Triple(Value: double): double;
function TEmployees.Triple(Value: double): double;
begin
Result := Value * 3;
end;