|
@@ -5,9 +5,9 @@
|
|
|
Unit : Quick.Lists
|
|
|
Description : Generic Lists functions
|
|
|
Author : Kike Pérez
|
|
|
- Version : 1.1
|
|
|
+ Version : 1.2
|
|
|
Created : 04/11/2018
|
|
|
- Modified : 07/04/2019
|
|
|
+ Modified : 11/05/2019
|
|
|
|
|
|
This file is part of QuickLib: https://github.com/exilon/QuickLib
|
|
|
|
|
@@ -38,12 +38,15 @@ uses
|
|
|
SysUtils,
|
|
|
RTTI,
|
|
|
TypInfo,
|
|
|
- System.Generics.Collections,
|
|
|
- System.Generics.Defaults,
|
|
|
+ Generics.Collections,
|
|
|
+ Generics.Defaults,
|
|
|
Quick.RTTI.Utils,
|
|
|
Quick.Arrays,
|
|
|
Quick.Value;
|
|
|
|
|
|
+ //enable use of property paths (like namespaces) in search
|
|
|
+ {$DEFINE PROPERTYPATH_MODE}
|
|
|
+
|
|
|
type
|
|
|
|
|
|
TClassField = (cfField, cfProperty);
|
|
@@ -135,7 +138,14 @@ begin
|
|
|
begin
|
|
|
try
|
|
|
if sindex.ClassField = TClassField.cfField then propvalue := TRTTI.GetFieldValue(TObject(Value),sindex.FieldName)
|
|
|
- else propvalue := TRTTI.GetPropertyValue(TObject(Value),sindex.FieldName);
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ {$IFNDEF PROPERTYPATH_MODE}
|
|
|
+ propvalue := TRTTI.GetPropertyValue(TObject(Value),sindex.FieldName);
|
|
|
+ {$ELSE}
|
|
|
+ propvalue := TRTTI.GetPathValue(TObject(Value),sindex.FieldName);
|
|
|
+ {$ENDIF}
|
|
|
+ end;
|
|
|
except
|
|
|
raise Exception.CreateFmt('Cannot add value to "%s" search dictionary!',[sindex.IndexName]);
|
|
|
end;
|
|
@@ -149,7 +159,14 @@ begin
|
|
|
begin
|
|
|
try
|
|
|
if sindex.ClassField = TClassField.cfField then propvalue := TRTTI.GetFieldValue(TObject(Value),sindex.FieldName)
|
|
|
- else propvalue := TRTTI.GetPropertyValue(TObject(Value),sindex.FieldName);
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ {$IFNDEF PROPERTYPATH_MODE}
|
|
|
+ propvalue := TRTTI.GetPropertyValue(TObject(Value),sindex.FieldName);
|
|
|
+ {$ELSE}
|
|
|
+ propvalue := TRTTI.GetPathValue(TObject(Value),sindex.FieldName);
|
|
|
+ {$ENDIF}
|
|
|
+ end;
|
|
|
except
|
|
|
raise Exception.CreateFmt('Cannot remove value to "%s" search dictionary!',[sindex.IndexName]);
|
|
|
end;
|