TLazy + Data-Endpoints refactoring

This commit is contained in:
Michael Schimmel
2025-07-17 00:48:46 +02:00
parent abad66ae52
commit b3359a4d73
8 changed files with 271 additions and 250 deletions
+32 -5
View File
@@ -10,7 +10,7 @@ uses
Myc.Mutable;
type
TMycNullMutable<T> = class(TInterfacedObject, TMutable<T>.IMutable)
TMycConstMutable<T> = class(TInterfacedObject, TMutable<T>.IMutable)
private
FValue: T;
function GetChanged: TSignal;
@@ -64,25 +64,34 @@ type
procedure SetValue(const Value: T);
end;
TMycConstLazy<T> = class(TInterfacedObject, TLazy<T>.ILazy)
private
FValue: T;
function GetChanged: TState;
function Update(var Value: T): Boolean;
public
constructor Create(AValue: T);
end;
implementation
uses
System.Generics.Defaults;
constructor TMycNullMutable<T>.Create(AValue: T);
constructor TMycConstMutable<T>.Create(AValue: T);
begin
inherited Create;
FValue := AValue;
end;
{ TMycNullMutable<T> }
{ TMycConstMutable<T> }
function TMycNullMutable<T>.GetChanged: TSignal;
function TMycConstMutable<T>.GetChanged: TSignal;
begin
Result := TSignal.Null;
end;
function TMycNullMutable<T>.GetValue: T;
function TMycConstMutable<T>.GetValue: T;
begin
Result := FValue;
end;
@@ -179,4 +188,22 @@ begin
end;
end;
constructor TMycConstLazy<T>.Create(AValue: T);
begin
inherited Create;
FValue := AValue;
end;
{ TMycConstLazy<T> }
function TMycConstLazy<T>.GetChanged: TState;
begin
Result := TState.Null;
end;
function TMycConstLazy<T>.Update(var Value: T): Boolean;
begin
Result := false;
end;
end.