From 61f74705933f5cb47507272367d251abe7cf93b4 Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Fri, 8 Nov 2024 12:34:58 +0100 Subject: [PATCH] Added TMVCStringPairList as object list --- sources/MVCFramework.Commons.pas | 68 +++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/sources/MVCFramework.Commons.pas b/sources/MVCFramework.Commons.pas index c62b956f..c69480a3 100644 --- a/sources/MVCFramework.Commons.pas +++ b/sources/MVCFramework.Commons.pas @@ -539,15 +539,33 @@ type constructor Create; end; - TMVCViewDataSet = class(TObjectDictionary) + 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) + public + constructor Create; virtual; + function AddPair(const Key, Value: String): TMVCStringPairList; + end; + +// TMVCViewDataSet = class(TObjectDictionary) +// 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;