Introduce "FreeObjectProperties()" method in TBaseComplexRemotable to allow its derived classes to clear (FreeAndNil) their object(s) and array(s) properties.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@910 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa 2009-07-16 11:18:21 +00:00
parent 1dbbf6ce7e
commit f597caeb28
4 changed files with 22 additions and 21 deletions

View File

@ -115,7 +115,7 @@ type
FProp_String : string;
public
constructor Create();override;
destructor Destroy();override;
procedure FreeObjectProperties();override;
class function GetNameSpace() : string;virtual;
published
property Prop_String : string Read FProp_String Write FProp_String;
@ -472,11 +472,11 @@ begin
FProp_B := TNameSpaceB_Class.Create();
end;
destructor TNameSpaceC_Class.Destroy();
procedure TNameSpaceC_Class.FreeObjectProperties();
begin
FreeAndNil(FProp_B);
FreeAndNil(FProp_A);
inherited Destroy();
inherited FreeObjectProperties();
end;
class function TNameSpaceC_Class.GetNameSpace() : string;

View File

@ -33,10 +33,10 @@ type
TWstBaseTest = class(TTestCase)
protected
procedure CheckEquals(expected, actual: TByteDynArray; msg: string = ''; const AStrict : Boolean = True); overload;
procedure CheckEquals(expected, actual: Currency; msg: string = ''); overload;
{$IFDEF FPC}
procedure CheckEquals(expected, actual: Int64; msg: string = ''; const AStrict : Boolean = True); overload;
procedure CheckEquals(expected, actual: QWord; msg: string = ''; const AStrict : Boolean = True); overload;
procedure CheckEquals(expected, actual: Currency; msg: string = ''); overload;
{$ENDIF FPC}
end;
@ -159,6 +159,12 @@ begin
if (expected <> actual) then
FailNotEquals(IntToStr(expected), IntToStr(actual), msg{$IFDEF WST_DELPHI}, CallerAddr{$ENDIF WST_DELPHI});
end;
procedure TWstBaseTest.CheckEquals(expected, actual : Currency; msg : string);
begin
if (expected <> actual) then
FailNotEquals(CurrToStr(expected), CurrToStr(actual), msg{$IFDEF WST_DELPHI}, CallerAddr{$ENDIF WST_DELPHI});
end;
{$ENDIF FPC}
procedure TWstBaseTest.CheckEquals(expected, actual: TByteDynArray;
@ -174,10 +180,5 @@ begin
end;
end;
procedure TWstBaseTest.CheckEquals(expected, actual : Currency; msg : string);
begin
if (expected <> actual) then
FailNotEquals(CurrToStr(expected), CurrToStr(actual), msg{$IFDEF WST_DELPHI}, CallerAddr{$ENDIF WST_DELPHI});
end;
end.

View File

@ -77,7 +77,7 @@ type
FVal_StringArray: TArrayOfStringRemotable;
public
constructor Create();override;
destructor Destroy();override;
procedure FreeObjectProperties();override;
Published
property Val_Enum : TTestEnum Read FVal_Enum Write FVal_Enum;
property Val_Bool : Boolean Read FVal_Bool Write FVal_Bool;
@ -888,11 +888,11 @@ begin
FVal_StringArray := TArrayOfStringRemotable.Create();
end;
destructor TClass_A.Destroy();
procedure TClass_A.FreeObjectProperties();
begin
FreeAndNil(FVal_StringArray);
FreeAndNil(FVal_Obj);
inherited Destroy();
inherited FreeObjectProperties();
end;
{ TTest_TBaseObjectArrayRemotable }

View File

@ -53,7 +53,7 @@ type
FVal_WideString: WideString;
public
constructor Create();override;
destructor Destroy();override;
procedure FreeObjectProperties();override;
Published
property Val_32S : LongInt Read FVal_32S Write FVal_32S;
property Val_Enum : TTestEnum Read FVal_Enum Write FVal_Enum;
@ -104,7 +104,7 @@ type
procedure SetObjProp(const AValue: TClass_A);
Public
constructor Create();override;
destructor Destroy();override;
procedure FreeObjectProperties();override;
Published
property Val_32S : LongInt Read FVal_32S Write FVal_32S;
property Val_Enum : TTestEnum Read FVal_Enum Write FVal_Enum;
@ -310,7 +310,7 @@ type
FVal_CplxWideString: T_ComplexWideStringContent;
public
constructor Create();override;
destructor Destroy();override;
procedure FreeObjectProperties();override;
published
property Val_CplxInt64S : T_ComplexInt64SContent read FVal_CplxInt64S write FVal_CplxInt64S;
property Val_CplxInt64U : T_ComplexInt64UContent read FVal_CplxInt64U write FVal_CplxInt64U;
@ -5037,10 +5037,10 @@ begin
FObjProp := TClass_A.Create();
end;
destructor TClass_B.Destroy();
procedure TClass_B.FreeObjectProperties();
begin
FreeAndNil(FObjProp);
inherited Destroy();
inherited FreeObjectProperties();
end;
{ TTestArray }
@ -5546,7 +5546,7 @@ begin
FVal_CplxInt8U := T_ComplexInt8UContent.Create();
end;
destructor TClass_CplxSimpleContent.Destroy();
procedure TClass_CplxSimpleContent.FreeObjectProperties();
begin
FreeAndNil(FVal_CplxInt64S);
FreeAndNil(FVal_CplxInt64U);
@ -5556,7 +5556,7 @@ begin
FreeAndNil(FVal_CplxInt16S);
FreeAndNil(FVal_CplxInt8U);
FreeAndNil(FVal_CplxInt8S);
inherited Destroy();
inherited FreeObjectProperties();
end;
{ TTestXmlRpcFormatterAttributes }
@ -6310,12 +6310,12 @@ begin
FVal_Time := TTimeRemotable.Create();
end;
destructor TClass_A.Destroy();
procedure TClass_A.FreeObjectProperties();
begin
FreeAndNil(FVal_Time);
FreeAndNil(FVal_Date);
FreeAndNil(FVal_DateTime);
inherited Destroy();
inherited FreeObjectProperties();
end;
initialization