|
@@ -346,6 +346,7 @@ type
|
|
FAttributesResolved: boolean;
|
|
FAttributesResolved: boolean;
|
|
FAttributes: TCustomAttributeArray;
|
|
FAttributes: TCustomAttributeArray;
|
|
FMethods: TRttiMethodArray;
|
|
FMethods: TRttiMethodArray;
|
|
|
|
+ FFields : TRttiFieldArray;
|
|
function GetAsInstance: TRttiInstanceType;
|
|
function GetAsInstance: TRttiInstanceType;
|
|
protected
|
|
protected
|
|
FTypeData: PTypeData;
|
|
FTypeData: PTypeData;
|
|
@@ -367,6 +368,7 @@ type
|
|
function GetFields: TRttiFieldArray; virtual;
|
|
function GetFields: TRttiFieldArray; virtual;
|
|
function GetField(const aName: String): TRttiField; virtual;
|
|
function GetField(const aName: String): TRttiField; virtual;
|
|
function GetDeclaredMethods: TRttiMethodArray; virtual;
|
|
function GetDeclaredMethods: TRttiMethodArray; virtual;
|
|
|
|
+ function GetDeclaredFields: TRttiFieldArray; virtual;
|
|
function GetProperties: TRttiPropertyArray; virtual;
|
|
function GetProperties: TRttiPropertyArray; virtual;
|
|
function GetProperty(const AName: string): TRttiProperty; virtual;
|
|
function GetProperty(const AName: string): TRttiProperty; virtual;
|
|
function GetMethods: TRttiMethodArray; virtual;
|
|
function GetMethods: TRttiMethodArray; virtual;
|
|
@@ -762,8 +764,8 @@ type
|
|
function GetMetaClassType: TClass;
|
|
function GetMetaClassType: TClass;
|
|
procedure ResolveClassicProperties;
|
|
procedure ResolveClassicProperties;
|
|
procedure ResolveExtendedProperties;
|
|
procedure ResolveExtendedProperties;
|
|
- procedure ResolveFields;
|
|
|
|
- procedure ResolveMethods;
|
|
|
|
|
|
+ procedure ResolveDeclaredFields;
|
|
|
|
+ procedure ResolveDeclaredMethods;
|
|
protected
|
|
protected
|
|
function GetIsInstance: boolean; override;
|
|
function GetIsInstance: boolean; override;
|
|
function GetTypeSize: integer; override;
|
|
function GetTypeSize: integer; override;
|
|
@@ -785,7 +787,7 @@ type
|
|
FPropertiesResolved: Boolean;
|
|
FPropertiesResolved: Boolean;
|
|
FProperties: TRttiPropertyArray;
|
|
FProperties: TRttiPropertyArray;
|
|
FFieldsResolved: Boolean;
|
|
FFieldsResolved: Boolean;
|
|
- FFields: TRttiFieldArray;
|
|
|
|
|
|
+ FDeclaredFields: TRttiFieldArray;
|
|
FDeclaredMethods : TRttiMethodArray;
|
|
FDeclaredMethods : TRttiMethodArray;
|
|
FMethodsResolved : Boolean;
|
|
FMethodsResolved : Boolean;
|
|
protected
|
|
protected
|
|
@@ -795,7 +797,7 @@ type
|
|
function GetTypeSize: Integer; override;
|
|
function GetTypeSize: Integer; override;
|
|
public
|
|
public
|
|
function GetProperties: TRttiPropertyArray; override;
|
|
function GetProperties: TRttiPropertyArray; override;
|
|
- function GetFields: TRttiFieldArray; override;
|
|
|
|
|
|
+ function GetDeclaredFields: TRttiFieldArray; override;
|
|
function GetDeclaredMethods: TRttiMethodArray;
|
|
function GetDeclaredMethods: TRttiMethodArray;
|
|
function GetAttributes: TCustomAttributeArray;
|
|
function GetAttributes: TCustomAttributeArray;
|
|
// property ManagedFields: TRttiManagedFieldArray read GetManagedFields;
|
|
// property ManagedFields: TRttiManagedFieldArray read GetManagedFields;
|
|
@@ -5942,7 +5944,7 @@ begin
|
|
result := FProperties;
|
|
result := FProperties;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TRttiInstanceType.ResolveFields;
|
|
|
|
|
|
+procedure TRttiInstanceType.ResolveDeclaredFields;
|
|
|
|
|
|
Var
|
|
Var
|
|
Tbl : PExtendedFieldInfoTable;
|
|
Tbl : PExtendedFieldInfoTable;
|
|
@@ -5953,8 +5955,8 @@ Var
|
|
|
|
|
|
begin
|
|
begin
|
|
Tbl:=Nil;
|
|
Tbl:=Nil;
|
|
- Len:=GetFieldList(FTypeInfo,Tbl,False);
|
|
|
|
- SetLength(FFields,Len);
|
|
|
|
|
|
+ Len:=GetFieldList(FTypeInfo,Tbl,[],False);
|
|
|
|
+ SetLength(FDeclaredFields,Len);
|
|
FFieldsResolved:=True;
|
|
FFieldsResolved:=True;
|
|
if Len=0 then
|
|
if Len=0 then
|
|
begin
|
|
begin
|
|
@@ -5989,7 +5991,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TRttiInstanceType.ResolveMethods;
|
|
|
|
|
|
+procedure TRttiInstanceType.ResolveDeclaredMethods;
|
|
|
|
|
|
Var
|
|
Var
|
|
Tbl : PExtendedMethodInfoTable;
|
|
Tbl : PExtendedMethodInfoTable;
|
|
@@ -6044,14 +6046,14 @@ end;
|
|
function TRttiInstanceType.GetDeclaredFields: TRttiFieldArray;
|
|
function TRttiInstanceType.GetDeclaredFields: TRttiFieldArray;
|
|
begin
|
|
begin
|
|
if not FFieldsResolved then
|
|
if not FFieldsResolved then
|
|
- ResolveFields;
|
|
|
|
- Result:=FFields;
|
|
|
|
|
|
+ ResolveDeclaredFields;
|
|
|
|
+ Result:=FDeclaredFields;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiInstanceType.GetDeclaredMethods: TRttiMethodArray;
|
|
function TRttiInstanceType.GetDeclaredMethods: TRttiMethodArray;
|
|
begin
|
|
begin
|
|
if not FMethodsResolved then
|
|
if not FMethodsResolved then
|
|
- ResolveMethods;
|
|
|
|
|
|
+ ResolveDeclaredMethods;
|
|
Result:=FDeclaredMethods;
|
|
Result:=FDeclaredMethods;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6199,11 +6201,11 @@ begin
|
|
Result:=FProperties;
|
|
Result:=FProperties;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TRttiRecordType.GetFields: TRttiFieldArray;
|
|
|
|
|
|
+function TRttiRecordType.GetDeclaredFields: TRttiFieldArray;
|
|
begin
|
|
begin
|
|
If not FFieldsResolved then
|
|
If not FFieldsResolved then
|
|
ResolveFields;
|
|
ResolveFields;
|
|
- Result:=FFields;
|
|
|
|
|
|
+ Result:=FDeclaredFields;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRecordType.GetDeclaredMethods: TRttiMethodArray;
|
|
function TRttiRecordType.GetDeclaredMethods: TRttiMethodArray;
|
|
@@ -6718,8 +6720,24 @@ end;
|
|
|
|
|
|
function TRttiType.GetFields: TRttiFieldArray;
|
|
function TRttiType.GetFields: TRttiFieldArray;
|
|
|
|
|
|
|
|
+var
|
|
|
|
+ parentfields, selffields: TRttiFieldArray;
|
|
|
|
+ parent: TRttiType;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
- Result:=Nil;
|
|
|
|
|
|
+ if Assigned(fFields) then
|
|
|
|
+ Exit(fFields);
|
|
|
|
+
|
|
|
|
+ selffields := GetDeclaredFields;
|
|
|
|
+
|
|
|
|
+ parent := GetBaseType;
|
|
|
|
+ if Assigned(parent) then begin
|
|
|
|
+ parentfields := parent.GetFields;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ fFields := Concat(parentfields, selffields);
|
|
|
|
+
|
|
|
|
+ Result := fFields;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiType.GetField(const aName: String): TRttiField;
|
|
function TRttiType.GetField(const aName: String): TRttiField;
|
|
@@ -6812,6 +6830,11 @@ begin
|
|
Result := Nil;
|
|
Result := Nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TRttiType.GetDeclaredFields: TRttiFieldArray;
|
|
|
|
+begin
|
|
|
|
+ Result:=Nil;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TRttiNamedObject }
|
|
{ TRttiNamedObject }
|
|
|
|
|
|
function TRttiNamedObject.GetName: string;
|
|
function TRttiNamedObject.GetName: string;
|