mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 16:50:25 +02:00
+ support for tkUString in get/setpropvalue (mantis #14617)
git-svn-id: trunk@13829 -
This commit is contained in:
parent
be39c47d02
commit
93171fdc23
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -9316,6 +9316,7 @@ tests/webtbs/tw1451.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14514.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14536.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14553.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw14617.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1470.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1472.pp svneol=native#text/plain
|
||||
tests/webtbs/tw14740.pp svneol=native#text/plain
|
||||
|
@ -86,6 +86,8 @@ function VarToStr(const V: Variant): string;
|
||||
function VarToStrDef(const V: Variant; const ADefault: string): string;
|
||||
function VarToWideStr(const V: Variant): WideString;
|
||||
function VarToWideStrDef(const V: Variant; const ADefault: WideString): WideString;
|
||||
function VarToUnicodeStr(const V: Variant): UnicodeString;
|
||||
function VarToUnicodeStrDef(const V: Variant; const ADefault: UnicodeString): UnicodeString;
|
||||
|
||||
{$ifndef FPUNONE}
|
||||
function VarToDateTime(const V: Variant): TDateTime;
|
||||
@ -2942,6 +2944,23 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function VarToUnicodeStr(const V: Variant): UnicodeString;
|
||||
|
||||
begin
|
||||
Result:=VarToUnicodeStrDef(V,'');
|
||||
end;
|
||||
|
||||
|
||||
function VarToUnicodeStrDef(const V: Variant; const ADefault: UnicodeString): UnicodeString;
|
||||
|
||||
begin
|
||||
If TVarData(V).vType<>varNull then
|
||||
Result:=V
|
||||
else
|
||||
Result:=ADefault;
|
||||
end;
|
||||
|
||||
|
||||
{$ifndef FPUNONE}
|
||||
|
||||
function VarToDateTime(const V: Variant): TDateTime;
|
||||
@ -4281,6 +4300,8 @@ begin
|
||||
Result := GetStrProp(Instance, PropInfo);
|
||||
tkWString:
|
||||
Result := GetWideStrProp(Instance, PropInfo);
|
||||
tkUString:
|
||||
Result := GetUnicodeStrProp(Instance, PropInfo);
|
||||
tkVariant:
|
||||
Result := GetVariantProp(Instance, PropInfo);
|
||||
tkInt64:
|
||||
@ -4355,6 +4376,8 @@ begin
|
||||
SetStrProp(Instance, PropInfo, VarToStr(Value));
|
||||
tkWString:
|
||||
SetWideStrProp(Instance, PropInfo, VarToWideStr(Value));
|
||||
tkUString:
|
||||
SetUnicodeStrProp(Instance, PropInfo, VarToUnicodeStr(Value));
|
||||
tkVariant:
|
||||
SetVariantProp(Instance, PropInfo, Value);
|
||||
tkInt64:
|
||||
|
29
tests/webtbs/tw14617.pp
Normal file
29
tests/webtbs/tw14617.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$endif}
|
||||
|
||||
{$r-}
|
||||
uses
|
||||
SysUtils, Classes, TypInfo, Variants;
|
||||
|
||||
type
|
||||
TBla = class(TPersistent)
|
||||
private
|
||||
fustr: unicodestring;
|
||||
published
|
||||
property ustr: unicodestring read fustr write fustr;
|
||||
end;
|
||||
|
||||
var
|
||||
b: tbla;
|
||||
u: unicodestring;
|
||||
begin
|
||||
b:=tbla.create;
|
||||
SetPropValue(b, 'ustr', 'abc');
|
||||
if (b.ustr<>'abc') then
|
||||
halt(1);
|
||||
u:=getpropvalue(b,'ustr');
|
||||
if (u<>'abc') then
|
||||
halt(2);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user