Browse Source

[flexvalue] array support

Exilon 5 years ago
parent
commit
437b6fa6bf
1 changed files with 18 additions and 0 deletions
  1. 18 0
      Quick.Value.pas

+ 18 - 0
Quick.Value.pas

@@ -238,7 +238,13 @@ type
     procedure SetAsInterface(const Value: IInterface);
     procedure SetAsInterface(const Value: IInterface);
   public
   public
     constructor Create(const Value: TVarRec);
     constructor Create(const Value: TVarRec);
+    {$IFNDEF FPC}
+    property Data : IInterface read fDataIntf;
+    {$ELSE}
+    property Data : TValueData read fDataIntf;
+    {$ENDIF}
     property DataType : TValueDataType read fDataType;
     property DataType : TValueDataType read fDataType;
+    procedure SetAsCustom(aData : IInterface; aType : TValueDataType);
     property AsString : string read CastToString write SetAsString;
     property AsString : string read CastToString write SetAsString;
     {$IFDEF MSWINDOWS}
     {$IFDEF MSWINDOWS}
     property AsAnsiString : AnsiString read CastToAnsiString write SetAsAnsiString;
     property AsAnsiString : AnsiString read CastToAnsiString write SetAsAnsiString;
@@ -267,6 +273,7 @@ type
     function  IsObject : Boolean; inline;
     function  IsObject : Boolean; inline;
     function  IsPointer : Boolean; inline;
     function  IsPointer : Boolean; inline;
     function  IsVariant : Boolean; inline;
     function  IsVariant : Boolean; inline;
+    function IsArray : Boolean; inline;
     function IsRealInteger : Boolean;
     function IsRealInteger : Boolean;
     function IsRealExtended : Boolean;
     function IsRealExtended : Boolean;
     procedure Clear; inline;
     procedure Clear; inline;
@@ -872,6 +879,11 @@ begin
   Result := a.AsExtended <= b;
   Result := a.AsExtended <= b;
 end;
 end;
 
 
+function TFlexValue.IsArray: Boolean;
+begin
+  Result := fDataType = dtArray;
+end;
+
 function TFlexValue.IsBoolean: Boolean;
 function TFlexValue.IsBoolean: Boolean;
 begin
 begin
   Result := fDataType = dtBoolean;
   Result := fDataType = dtBoolean;
@@ -966,6 +978,12 @@ begin
   fDataType := TValueDataType.dtClass;
   fDataType := TValueDataType.dtClass;
 end;
 end;
 
 
+procedure TFlexValue.SetAsCustom(aData: IInterface; aType: TValueDataType);
+begin
+  fDataIntf := aData;
+  fDataType := aType;
+end;
+
 procedure TFlexValue.SetAsDateTime(const Value: TDateTime);
 procedure TFlexValue.SetAsDateTime(const Value: TDateTime);
 begin
 begin
   Clear;
   Clear;