typinfo: added GetStrProp, SetStrProp, GetOrdProp, SetStrProp

This commit is contained in:
mattias 2018-06-05 22:17:12 +00:00
parent bedaf2ef76
commit d3e2e69826
2 changed files with 65 additions and 10 deletions

View File

@ -99,7 +99,7 @@ begin
begin begin
case PropInfo.TypeInfo.Kind of case PropInfo.TypeInfo.Kind of
tkInteger: Value:=IntToStr(GetNativeIntProp(Instance,PropInfo)); tkInteger: Value:=IntToStr(GetNativeIntProp(Instance,PropInfo));
tkString: Value:=GetStringProp(Instance,PropInfo); tkString: Value:=GetStrProp(Instance,PropInfo);
end; end;
end; end;
writeln(' Name="',PropInfo.Name,'"', writeln(' Name="',PropInfo.Name,'"',

View File

@ -380,10 +380,20 @@ function GetNativeIntProp(Instance: TObject; const PropInfo: TTypeMemberProperty
procedure SetNativeIntProp(Instance: TObject; const PropName: String; Value: NativeInt); procedure SetNativeIntProp(Instance: TObject; const PropName: String; Value: NativeInt);
procedure SetNativeIntProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: NativeInt); procedure SetNativeIntProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: NativeInt);
function GetStringProp(Instance: TObject; const PropName: String): String; function GetOrdProp(Instance: TObject; const PropName: String): longint;
function GetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty): String; function GetOrdProp(Instance: TObject; const PropInfo: TTypeMemberProperty): longint;
procedure SetStringProp(Instance: TObject; const PropName: String; Value: String); procedure SetOrdProp(Instance: TObject; const PropName: String; Value: longint);
procedure SetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: String); procedure SetOrdProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: longint);
function GetStrProp(Instance: TObject; const PropName: String): String;
function GetStrProp(Instance: TObject; const PropInfo: TTypeMemberProperty): String;
procedure SetStrProp(Instance: TObject; const PropName: String; Value: String);
procedure SetStrProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: String);
function GetStringProp(Instance: TObject; const PropName: String): String; deprecated;
function GetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty): String; deprecated;
procedure SetStringProp(Instance: TObject; const PropName: String; Value: String); deprecated;
procedure SetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty; Value: String); deprecated;
function GetBoolProp(Instance: TObject; const PropName: String): boolean; function GetBoolProp(Instance: TObject; const PropName: String): boolean;
function GetBoolProp(Instance: TObject; const PropInfo: TTypeMemberProperty): boolean; function GetBoolProp(Instance: TObject; const PropInfo: TTypeMemberProperty): boolean;
@ -871,27 +881,72 @@ begin
SetJSValueProp(Instance,PropInfo,Value); SetJSValueProp(Instance,PropInfo,Value);
end; end;
function GetStringProp(Instance: TObject; const PropName: String): String; function GetOrdProp(Instance: TObject; const PropName: String): longint;
begin begin
Result:=GetStringProp(Instance,FindPropInfo(Instance,PropName)); Result:=longint(GetJSValueProp(Instance,PropName));
end; end;
function GetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty function GetOrdProp(Instance: TObject; const PropInfo: TTypeMemberProperty
): longint;
begin
Result:=longint(GetJSValueProp(Instance,PropInfo));
end;
procedure SetOrdProp(Instance: TObject; const PropName: String; Value: longint);
begin
SetJSValueProp(Instance,PropName,Value);
end;
procedure SetOrdProp(Instance: TObject; const PropInfo: TTypeMemberProperty;
Value: longint);
begin
SetJSValueProp(Instance,PropInfo,Value);
end;
function GetStrProp(Instance: TObject; const PropName: String): String;
begin
Result:=GetStrProp(Instance,FindPropInfo(Instance,PropName));
end;
function GetStrProp(Instance: TObject; const PropInfo: TTypeMemberProperty
): String; ): String;
begin begin
Result:=String(GetJSValueProp(Instance,PropInfo)); Result:=String(GetJSValueProp(Instance,PropInfo));
end; end;
procedure SetStrProp(Instance: TObject; const PropName: String; Value: String
);
begin
SetStrProp(Instance,FindPropInfo(Instance,PropName),Value);
end;
procedure SetStrProp(Instance: TObject; const PropInfo: TTypeMemberProperty;
Value: String);
begin
SetJSValueProp(Instance,PropInfo,Value);
end;
function GetStringProp(Instance: TObject; const PropName: String): String;
begin
Result:=GetStrProp(Instance,PropName);
end;
function GetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty
): String;
begin
Result:=GetStrProp(Instance,PropInfo);
end;
procedure SetStringProp(Instance: TObject; const PropName: String; Value: String procedure SetStringProp(Instance: TObject; const PropName: String; Value: String
); );
begin begin
SetStringProp(Instance,FindPropInfo(Instance,PropName),Value); SetStrProp(Instance,PropName,Value);
end; end;
procedure SetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty; procedure SetStringProp(Instance: TObject; const PropInfo: TTypeMemberProperty;
Value: String); Value: String);
begin begin
SetJSValueProp(Instance,PropInfo,Value); SetStrProp(Instance,PropInfo,Value);
end; end;
function GetBoolProp(Instance: TObject; const PropName: String): boolean; function GetBoolProp(Instance: TObject; const PropName: String): boolean;