Explorar el Código

RTTI small fixes

Unknown hace 6 años
padre
commit
da531502ba
Se han modificado 2 ficheros con 9 adiciones y 3 borrados
  1. 6 3
      Quick.RTTI.Utils.pas
  2. 3 0
      Quick.Value.RTTI.pas

+ 6 - 3
Quick.RTTI.Utils.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Author      : Kike Pérez
   Version     : 1.4
   Version     : 1.4
   Created     : 09/03/2018
   Created     : 09/03/2018
-  Modified    : 21/05/2019
+  Modified    : 27/05/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -411,9 +411,12 @@ begin
   Result := fCtx.GetType(aTypeInfo);
   Result := fCtx.GetType(aTypeInfo);
 end;
 end;
 
 
-class function TRTTI.PropertyExists(aTypeInfo: Pointer; const aPropertyName: string): Boolean;
+class function TRTTI.PropertyExists(aTypeInfo: Pointer; const aPropertyName: string) : Boolean;
+var
+  rtype : TRttiType;
 begin
 begin
-  Result := fCtx.GetType(aTypeInfo).GetProperty(aPropertyName) <> nil;
+  rtype := fCtx.GetType(aTypeInfo);
+  if rtype <> nil then Result := rtype.GetProperty(aPropertyName) <> nil;
 end;
 end;
 
 
 class procedure TRTTI.SetPropertyValue(aInstance: TObject; const aPropertyName: string; aValue: TValue);
 class procedure TRTTI.SetPropertyValue(aInstance: TObject; const aPropertyName: string; aValue: TValue);

+ 3 - 0
Quick.Value.RTTI.pas

@@ -82,11 +82,14 @@ begin
     tkChar,
     tkChar,
     {$IFNDEF FPC}
     {$IFNDEF FPC}
     tkString,
     tkString,
+    tkUstring,
     {$ELSE}
     {$ELSE}
     tkAstring,
     tkAstring,
     {$ENDIF}
     {$ENDIF}
     tkWideString,
     tkWideString,
     tkWideChar : AsString := Value.AsString;
     tkWideChar : AsString := Value.AsString;
+    tkEnumeration,
+    tkSet : AsInteger := Value.AsInteger;
     {$IFNDEF FPC}
     {$IFNDEF FPC}
     else AsVariant := Value.AsVariant;
     else AsVariant := Value.AsVariant;
     {$ENDIF}
     {$ENDIF}