浏览代码

+ Added overloaded stringtoset which starts from typinfo, not propinfo

git-svn-id: trunk@492 -
michael 20 年之前
父节点
当前提交
64f1948f3e
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      rtl/objpas/typinfo.pp

+ 8 - 2
rtl/objpas/typinfo.pp

@@ -275,6 +275,7 @@ function SetToString(TypeInfo: PTypeInfo; Value: Integer; Brackets: Boolean) : S
 function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
 function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
 function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
 function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
 function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
 function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
+function StringToSet(TypeInfo: PTypeInfo; const Value: string): Integer;
 
 
 const
 const
     BooleanIdents: array[Boolean] of String = ('False', 'True');
     BooleanIdents: array[Boolean] of String = ('False', 'True');
@@ -412,8 +413,13 @@ begin
     end;
     end;
 end;
 end;
 
 
-
 Function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
 Function StringToSet(PropInfo: PPropInfo; const Value: string): Integer;
+
+begin
+  Result:=StringToSet(PropInfo^.PropType,Value);
+end;
+
+Function StringToSet(TypeInfo: PTypeInfo; const Value: string): Integer;
 Var
 Var
   S,T : String;
   S,T : String;
   I : Integer;
   I : Integer;
@@ -421,7 +427,7 @@ Var
 
 
 begin
 begin
   Result:=0;
   Result:=0;
-  PTI:=GetTypeData(PropInfo^.PropType)^.Comptype;
+  PTI:=GetTypeData(TypeInfo)^.Comptype;
   S:=Value;
   S:=Value;
   I:=1;
   I:=1;
   If Length(S)>0 then
   If Length(S)>0 then