|
@@ -38,7 +38,7 @@ unit typinfo;
|
|
|
tkSet,tkMethod,tkSString,tkLString,tkAString,
|
|
|
tkWString,tkVariant,tkArray,tkRecord,tkInterface,
|
|
|
tkClass,tkObject,tkWChar,tkBool,tkInt64,tkQWord,
|
|
|
- tkDynArray,tkInterfaceRaw);
|
|
|
+ tkDynArray,tkInterfaceRaw,tkProcVar,tkUString,tkUChar);
|
|
|
|
|
|
TOrdType = (otSByte,otUByte,otSWord,otUWord,otSLong,otULong);
|
|
|
|
|
@@ -85,7 +85,7 @@ unit typinfo;
|
|
|
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
|
|
|
record
|
|
|
case TTypeKind of
|
|
|
- tkUnKnown,tkLString,tkWString,tkAString,tkVariant:
|
|
|
+ tkUnKnown,tkLString,tkWString,tkAString,tkVariant,tkUString:
|
|
|
();
|
|
|
tkInteger,tkChar,tkEnumeration,tkWChar,tkSet:
|
|
|
(OrdType : TOrdType;
|
|
@@ -252,6 +252,11 @@ Function GetWideStrProp(Instance: TObject; const PropName: string): WideString;
|
|
|
Procedure SetWideStrProp(Instance: TObject; const PropName: string; const Value: WideString);
|
|
|
Procedure SetWideStrProp(Instance: TObject; PropInfo: PPropInfo; const Value: WideString);
|
|
|
|
|
|
+Function GetUnicodeStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString;
|
|
|
+Function GetUnicodeStrProp(Instance: TObject; const PropName: string): UnicodeString;
|
|
|
+Procedure SetUnicodeStrProp(Instance: TObject; const PropName: string; const Value: UnicodeString);
|
|
|
+Procedure SetUnicodeStrProp(Instance: TObject; PropInfo: PPropInfo; const Value: UnicodeString);
|
|
|
+
|
|
|
{$ifndef FPUNONE}
|
|
|
Function GetFloatProp(Instance: TObject; PropInfo : PPropInfo) : Extended;
|
|
|
Function GetFloatProp(Instance: TObject; const PropName: string): Extended;
|
|
@@ -1397,6 +1402,91 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+Function GetUnicodeStrProp(Instance: TObject; const PropName: string): UnicodeString;
|
|
|
+begin
|
|
|
+ Result:=GetUnicodeStrProp(Instance, FindPropInfo(Instance, PropName));
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+procedure SetUnicodeStrProp(Instance: TObject; const PropName: string; const Value: UnicodeString);
|
|
|
+begin
|
|
|
+ SetUnicodeStrProp(Instance,FindPropInfo(Instance,PropName),Value);
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+Function GetUnicodeStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString;
|
|
|
+type
|
|
|
+ TGetUnicodeStrProcIndex=function(index:longint):UnicodeString of object;
|
|
|
+ TGetUnicodeStrProc=function():UnicodeString of object;
|
|
|
+var
|
|
|
+ AMethod : TMethod;
|
|
|
+begin
|
|
|
+ Result:='';
|
|
|
+ case Propinfo^.PropType^.Kind of
|
|
|
+ tkSString,tkAString:
|
|
|
+ Result:=GetStrProp(Instance,PropInfo);
|
|
|
+ tkWString:
|
|
|
+ Result:=GetWideStrProp(Instance,PropInfo);
|
|
|
+ tkUString:
|
|
|
+ begin
|
|
|
+ case (PropInfo^.PropProcs) and 3 of
|
|
|
+ ptField:
|
|
|
+ Result := PUnicodeString(Pointer(Instance)+PtrUInt(PropInfo^.GetProc))^;
|
|
|
+ ptstatic,
|
|
|
+ ptvirtual :
|
|
|
+ begin
|
|
|
+ if (PropInfo^.PropProcs and 3)=ptStatic then
|
|
|
+ AMethod.Code:=PropInfo^.GetProc
|
|
|
+ else
|
|
|
+ AMethod.Code:=PPointer(Pointer(Instance.ClassType)+PtrUInt(PropInfo^.GetProc))^;
|
|
|
+ AMethod.Data:=Instance;
|
|
|
+ if ((PropInfo^.PropProcs shr 6) and 1)<>0 then
|
|
|
+ Result:=TGetUnicodeStrProcIndex(AMethod)(PropInfo^.Index)
|
|
|
+ else
|
|
|
+ Result:=TGetUnicodeStrProc(AMethod)();
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+Procedure SetUnicodeStrProp(Instance: TObject; PropInfo: PPropInfo; const Value: UnicodeString);
|
|
|
+type
|
|
|
+ TSetUnicodeStrProcIndex=procedure(index:longint;s:UnicodeString) of object;
|
|
|
+ TSetUnicodeStrProc=procedure(s:UnicodeString) of object;
|
|
|
+var
|
|
|
+ AMethod : TMethod;
|
|
|
+begin
|
|
|
+ case Propinfo^.PropType^.Kind of
|
|
|
+ tkSString,tkAString:
|
|
|
+ SetStrProp(Instance,PropInfo,Value);
|
|
|
+ tkWString:
|
|
|
+ SetWideStrProp(Instance,PropInfo,Value);
|
|
|
+ tkUString:
|
|
|
+ begin
|
|
|
+ case (PropInfo^.PropProcs shr 2) and 3 of
|
|
|
+ ptField:
|
|
|
+ PUnicodeString(Pointer(Instance)+PtrUInt(PropInfo^.SetProc))^:=Value;
|
|
|
+ ptstatic,
|
|
|
+ ptvirtual :
|
|
|
+ begin
|
|
|
+ if ((PropInfo^.PropProcs shr 2) and 3)=ptStatic then
|
|
|
+ AMethod.Code:=PropInfo^.SetProc
|
|
|
+ else
|
|
|
+ AMethod.Code:=PPointer(Pointer(Instance.ClassType)+PtrUInt(PropInfo^.SetProc))^;
|
|
|
+ AMethod.Data:=Instance;
|
|
|
+ if ((PropInfo^.PropProcs shr 6) and 1)<>0 then
|
|
|
+ TSetUnicodeStrProcIndex(AMethod)(PropInfo^.Index,Value)
|
|
|
+ else
|
|
|
+ TSetUnicodeStrProc(AMethod)(Value);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
{$ifndef FPUNONE}
|
|
|
|