|
@@ -281,6 +281,7 @@ type
|
|
|
|
|
|
TRttiStructuredType = class abstract(TRttiType)
|
|
TRttiStructuredType = class abstract(TRttiType)
|
|
private
|
|
private
|
|
|
|
+ FFields: TRttiFieldArray;
|
|
FMethods: TRttiMethodArray;
|
|
FMethods: TRttiMethodArray;
|
|
FProperties: TRttiPropertyArray;
|
|
FProperties: TRttiPropertyArray;
|
|
protected
|
|
protected
|
|
@@ -291,8 +292,10 @@ type
|
|
|
|
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
|
|
|
|
|
|
+ function GetDeclaredFields: TRttiFieldArray; override;
|
|
function GetDeclaredMethods: TRttiMethodArray; override;
|
|
function GetDeclaredMethods: TRttiMethodArray; override;
|
|
function GetDeclaredProperties: TRttiPropertyArray; override;
|
|
function GetDeclaredProperties: TRttiPropertyArray; override;
|
|
|
|
+ function GetFields: TRttiFieldArray; override;
|
|
function GetMethod(const aName: String): TRttiMethod; override;
|
|
function GetMethod(const aName: String): TRttiMethod; override;
|
|
function GetMethods: TRttiMethodArray; override;
|
|
function GetMethods: TRttiMethodArray; override;
|
|
function GetMethods(const aName: String): TRttiMethodArray; override;
|
|
function GetMethods(const aName: String): TRttiMethodArray; override;
|
|
@@ -306,8 +309,6 @@ type
|
|
|
|
|
|
TRttiInstanceType = class(TRttiStructuredType)
|
|
TRttiInstanceType = class(TRttiStructuredType)
|
|
private
|
|
private
|
|
- FFields: TRttiFieldArray;
|
|
|
|
-
|
|
|
|
function GetClassTypeInfo: TTypeInfoClass;
|
|
function GetClassTypeInfo: TTypeInfoClass;
|
|
function GetMetaClassType: TClass;
|
|
function GetMetaClassType: TClass;
|
|
protected
|
|
protected
|
|
@@ -315,9 +316,6 @@ type
|
|
public
|
|
public
|
|
constructor Create(ATypeInfo: PTypeInfo);
|
|
constructor Create(ATypeInfo: PTypeInfo);
|
|
|
|
|
|
- function GetFields: TRttiFieldArray; override;
|
|
|
|
- function GetDeclaredFields: TRttiFieldArray; override;
|
|
|
|
-
|
|
|
|
property ClassTypeInfo: TTypeInfoClass read GetClassTypeInfo;
|
|
property ClassTypeInfo: TTypeInfoClass read GetClassTypeInfo;
|
|
property MetaClassType: TClass read GetMetaClassType;
|
|
property MetaClassType: TClass read GetMetaClassType;
|
|
end;
|
|
end;
|
|
@@ -992,31 +990,7 @@ begin
|
|
Result := FMethods;
|
|
Result := FMethods;
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ TRttiInstanceType }
|
|
|
|
-
|
|
|
|
-function TRttiInstanceType.GetClassTypeInfo: TTypeInfoClass;
|
|
|
|
-begin
|
|
|
|
- Result:=TTypeInfoClass(FTypeInfo);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TRttiInstanceType.GetMetaClassType: TClass;
|
|
|
|
-begin
|
|
|
|
- Result:=ClassTypeInfo.ClassType;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TRttiInstanceType.GetAncestor: TRttiStructuredType;
|
|
|
|
-begin
|
|
|
|
- Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiStructuredType;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-constructor TRttiInstanceType.Create(ATypeInfo: PTypeInfo);
|
|
|
|
-begin
|
|
|
|
- if not (TTypeInfo(ATypeInfo) is TTypeInfoClass) then
|
|
|
|
- raise EInvalidCast.Create('');
|
|
|
|
- inherited Create(ATypeInfo);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TRttiInstanceType.GetDeclaredFields: TRttiFieldArray;
|
|
|
|
|
|
+function TRttiStructuredType.GetDeclaredFields: TRttiFieldArray;
|
|
var
|
|
var
|
|
A, FieldCount: Integer;
|
|
A, FieldCount: Integer;
|
|
|
|
|
|
@@ -1034,7 +1008,7 @@ begin
|
|
Result := FFields;
|
|
Result := FFields;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TRttiInstanceType.GetFields: TRttiFieldArray;
|
|
|
|
|
|
+function TRttiStructuredType.GetFields: TRttiFieldArray;
|
|
var
|
|
var
|
|
A, Start: Integer;
|
|
A, Start: Integer;
|
|
|
|
|
|
@@ -1060,6 +1034,30 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ TRttiInstanceType }
|
|
|
|
+
|
|
|
|
+function TRttiInstanceType.GetClassTypeInfo: TTypeInfoClass;
|
|
|
|
+begin
|
|
|
|
+ Result:=TTypeInfoClass(FTypeInfo);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TRttiInstanceType.GetMetaClassType: TClass;
|
|
|
|
+begin
|
|
|
|
+ Result:=ClassTypeInfo.ClassType;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TRttiInstanceType.GetAncestor: TRttiStructuredType;
|
|
|
|
+begin
|
|
|
|
+ Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiStructuredType;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+constructor TRttiInstanceType.Create(ATypeInfo: PTypeInfo);
|
|
|
|
+begin
|
|
|
|
+ if not (TTypeInfo(ATypeInfo) is TTypeInfoClass) then
|
|
|
|
+ raise EInvalidCast.Create('');
|
|
|
|
+ inherited Create(ATypeInfo);
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TRttiInterfaceType }
|
|
{ TRttiInterfaceType }
|
|
|
|
|
|
constructor TRttiInterfaceType.Create(ATypeInfo: PTypeInfo);
|
|
constructor TRttiInterfaceType.Create(ATypeInfo: PTypeInfo);
|
|
@@ -1291,7 +1289,7 @@ end;
|
|
|
|
|
|
function TRttiField.GetFieldType: TRttiType;
|
|
function TRttiField.GetFieldType: TRttiType;
|
|
begin
|
|
begin
|
|
- Result := GRttiContext.GetType(FTypeInfo);
|
|
|
|
|
|
+ Result := GRttiContext.GetType(FieldTypeInfo.TypeInfo);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiField.GetFieldTypeInfo: TTypeMemberField;
|
|
function TRttiField.GetFieldTypeInfo: TTypeMemberField;
|