Added TMVCStringPairList as object list

This commit is contained in:
Daniele Teti 2024-11-08 12:34:58 +01:00
parent 00c095d090
commit 61f7470593

View File

@ -539,15 +539,33 @@ type
constructor Create;
end;
TMVCViewDataSet = class(TObjectDictionary<string, TDataset>)
TMVCStringPair = class
private
{ private declarations }
protected
{ protected declarations }
FKey: String;
FValue: String;
procedure SetKey(const Value: String);
procedure SetValue(const Value: String);
public
constructor Create;
property Key: String read FKey write SetKey;
property Value: String read FValue write SetValue;
constructor Create(const Key, Value: String);
end;
TMVCStringPairList = class(TObjectList<TMVCStringPair>)
public
constructor Create; virtual;
function AddPair(const Key, Value: String): TMVCStringPairList;
end;
// TMVCViewDataSet = class(TObjectDictionary<string, TDataset>)
// private
// { private declarations }
// protected
// { protected declarations }
// public
// constructor Create;
// end;
TMVCCriticalSectionHelper = class helper for TCriticalSection
public
procedure DoWithLock(const AAction: TProc);
@ -1478,10 +1496,10 @@ end;
{ TMVCViewDataSet }
constructor TMVCViewDataSet.Create;
begin
inherited Create([]);
end;
//constructor TMVCViewDataSet.Create;
//begin
// inherited Create([]);
//end;
{ TMVCStreamHelper }
@ -1959,6 +1977,38 @@ begin
Result := fSqids.EncodeSingle(ANumber);
end;
{ TMVCStringPair }
constructor TMVCStringPair.Create(const Key, Value: String);
begin
inherited Create;
FKey := Key;
FValue := Value;
end;
procedure TMVCStringPair.SetKey(const Value: String);
begin
FKey := Value;
end;
procedure TMVCStringPair.SetValue(const Value: String);
begin
FValue := Value;
end;
{ TMVCStringPairList }
function TMVCStringPairList.AddPair(const Key, Value: String): TMVCStringPairList;
begin
Add(TMVCStringPair.Create(Key, Value));
Result := Self;
end;
constructor TMVCStringPairList.Create;
begin
inherited Create(True);
end;
initialization
gLock := TObject.Create;