From 06630879304eddd547021461f40d30f6f7d10b26 Mon Sep 17 00:00:00 2001 From: inoussa Date: Mon, 29 Aug 2011 02:47:41 +0000 Subject: [PATCH] TComplexEnumContentRemotable implementation git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1854 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/base_service_intf.pas | 73 ++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/wst/trunk/base_service_intf.pas b/wst/trunk/base_service_intf.pas index 90fc44cf5..d359cf6ad 100644 --- a/wst/trunk/base_service_intf.pas +++ b/wst/trunk/base_service_intf.pas @@ -593,6 +593,16 @@ type end; TBaseComplexSimpleContentRemotableClass = class of TBaseComplexSimpleContentRemotable; + { TComplexEnumContentRemotable } + + TComplexEnumContentRemotable = class(TBaseComplexSimpleContentRemotable) + protected + class procedure SaveValue(AObject : TBaseRemotable; AStore : IFormatterBase);override; + class procedure LoadValue(var AObject : TObject; AStore : IFormatterBase);override; + class function GetEnumTypeInfo() : PTypeInfo;virtual;abstract; + function GetValueAddress() : Pointer;virtual;abstract; + end; + { TComplexInt8UContentRemotable } TComplexInt8UContentRemotable = class(TBaseComplexSimpleContentRemotable) @@ -1742,7 +1752,25 @@ uses type PObject = ^TObject; - + + TEnumBuffer = Record + Case TOrdType Of + otSByte : (ShortIntData : ShortInt); + otUByte : (ByteData : Byte); + otSWord : (SmallIntData : SmallInt); + otUWord : (WordData : Word); + otSLong : (SLongIntData : LongInt); + otULong : (ULongIntData : LongWord); + End; + TFloatBuffer = Record + Case TFloatType Of + ftSingle : (SingleData : Single); + ftDouble : (DoubleData : Double); + ftExtended : (ExtendedData : Extended); + ftCurr : (CurrencyData : Currency); + ftComp : (CompData : Comp); + End; + var TypeRegistryInstance : TTypeRegistry = Nil; @@ -1968,6 +1996,7 @@ begin Result := pstOptional; end; end; + {$ELSE} function IsStoredPropClass(AClass : TClass;PropInfo : PPropInfo) : TPropStoreType; {var @@ -2013,24 +2042,7 @@ begin end; { TBaseComplexRemotable } -Type - TEnumBuffer = Record - Case TOrdType Of - otSByte : (ShortIntData : ShortInt); - otUByte : (ByteData : Byte); - otSWord : (SmallIntData : SmallInt); - otUWord : (WordData : Word); - otSLong : (SLongIntData : LongInt); - otULong : (ULongIntData : LongWord); - End; - TFloatBuffer = Record - Case TFloatType Of - ftSingle : (SingleData : Single); - ftDouble : (DoubleData : Double); - ftExtended : (ExtendedData : Extended); - ftCurr : (CurrencyData : Currency); - ftComp : (CompData : Comp); - End; +Type { TSerializeOptions } @@ -5594,6 +5606,29 @@ begin end; {$ENDIF USE_SERIALIZE} +{ TComplexEnumContentRemotable } + +class procedure TComplexEnumContentRemotable.SaveValue( + AObject : TBaseRemotable; + AStore : IFormatterBase +); +begin + AStore.PutScopeInnerValue(GetEnumTypeInfo(),(AObject as TComplexEnumContentRemotable).GetValueAddress()^); +end; + +class procedure TComplexEnumContentRemotable.LoadValue( + var AObject : TObject; + AStore : IFormatterBase +); +var + locObject : TComplexEnumContentRemotable; + locBuffer : Pointer; +begin + locObject := AObject as TComplexEnumContentRemotable; + locBuffer := locObject.GetValueAddress(); + AStore.GetScopeInnerValue(GetEnumTypeInfo(),locBuffer^); +end; + { TComplexInt32SContentRemotable } class procedure TComplexInt32SContentRemotable.SaveValue(