From 0dd86c13fcf4d64a247a95396f01340bcfa43631 Mon Sep 17 00:00:00 2001 From: inoussa Date: Wed, 11 Nov 2015 08:55:48 +0000 Subject: [PATCH] Simplify Save/Load as simple types for TBaseDateRemotable, TDurationRemotable and TTimeRemotable. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4386 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/base_service_intf.pas | 78 +++++++++------------------------ 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/wst/trunk/base_service_intf.pas b/wst/trunk/base_service_intf.pas index 726d41ecd..0d438c6be 100644 --- a/wst/trunk/base_service_intf.pas +++ b/wst/trunk/base_service_intf.pas @@ -6009,12 +6009,7 @@ var buffer : string; begin buffer := TBaseDateRemotable(AObject).AsString; - AStore.BeginObject(AName,ATypeInfo); - try - AStore.PutScopeInnerValue(TypeInfo(string),buffer); - finally - AStore.EndScope(); - end; + AStore.Put(AName,TypeInfo(string),buffer); end; class procedure TBaseDateRemotable.Load( @@ -6024,19 +6019,13 @@ class procedure TBaseDateRemotable.Load( const ATypeInfo : PTypeInfo ); var - strBuffer : string; + buffer : string; begin - if ( AStore.BeginObjectRead(AName,ATypeInfo) >= 0 ) then begin - try - strBuffer := ''; - AStore.GetScopeInnerValue(TypeInfo(string),strBuffer); - if ( AObject = nil ) then - AObject := Create(); - (AObject as TBaseDateRemotable).AsString := strBuffer - finally - AStore.EndScopeRead(); - end; - end; + buffer := ''; + AStore.Get(TypeInfo(string),AName,buffer); + if ( AObject = nil ) then + AObject := Create(); + TBaseDateRemotable(AObject).AsString := buffer; end; procedure TBaseDateRemotable.Assign(Source: TPersistent); @@ -6841,12 +6830,7 @@ var buffer : string; begin buffer := TDurationRemotable(AObject).AsString; - AStore.BeginObject(AName,ATypeInfo); - try - AStore.PutScopeInnerValue(TypeInfo(string),buffer); - finally - AStore.EndScope(); - end; + AStore.Put(AName,TypeInfo(string),buffer); end; class procedure TDurationRemotable.Load( @@ -6856,19 +6840,13 @@ class procedure TDurationRemotable.Load( const ATypeInfo : PTypeInfo ); var - strBuffer : string; + buffer : string; begin - if ( AStore.BeginObjectRead(AName,ATypeInfo) >= 0 ) then begin - try - strBuffer := ''; - AStore.GetScopeInnerValue(TypeInfo(string),strBuffer); - if ( AObject = nil ) then - AObject := Create(); - TDurationRemotable(AObject).AsString := strBuffer; - finally - AStore.EndScopeRead(); - end; - end; + buffer := ''; + AStore.Get(TypeInfo(string),AName,buffer); + if ( AObject = nil ) then + AObject := Create(); + TDurationRemotable(AObject).AsString := buffer; end; procedure TDurationRemotable.Assign(Source : TPersistent); @@ -7253,12 +7231,7 @@ var buffer : string; begin buffer := TTimeRemotable(AObject).AsString; - AStore.BeginObject(AName,ATypeInfo); - try - AStore.PutScopeInnerValue(TypeInfo(string),buffer); - finally - AStore.EndScope(); - end; + AStore.Put(AName,TypeInfo(string),buffer); end; class procedure TTimeRemotable.Load( @@ -7268,22 +7241,13 @@ class procedure TTimeRemotable.Load( const ATypeInfo : PTypeInfo ); var - strBuffer : string; + buffer : string; begin - if ( AStore.BeginObjectRead(AName,ATypeInfo) >= 0 ) then begin - try - strBuffer := ''; - AStore.GetScopeInnerValue(TypeInfo(string),strBuffer); - if ( AObject = nil ) then - AObject := Create(); - if IsStrEmpty(strBuffer) then - (AObject as TTimeRemotable).Clear() - else - (AObject as TTimeRemotable).AsString := strBuffer; - finally - AStore.EndScopeRead(); - end; - end; + buffer := ''; + AStore.Get(TypeInfo(string),AName,buffer); + if ( AObject = nil ) then + AObject := Create(); + TTimeRemotable(AObject).AsString := buffer; end; procedure TTimeRemotable.Assign(Source: TPersistent);