* made ifthen() declaration in strutils Delphi-compatible (removed overloads

that cause various problems, added "overload" directive so it gets
    overloaded next to the routines in the "math" unit) (based on patch
    by Alexander S. Klenin, mantis #13619)
  - removed "inline" from that function because all the reference increasing/
    decreasing in its body mainly cause code bloat and little if any speed
    increase

git-svn-id: trunk@13084 -
This commit is contained in:
Jonas Maebe 2009-05-02 15:50:41 +00:00
parent 4da38a7723
commit 445c842db3
3 changed files with 13 additions and 18 deletions

1
.gitattributes vendored
View File

@ -8842,6 +8842,7 @@ tests/webtbs/tw13563.pp svneol=native#text/plain
tests/webtbs/tw13583.pp svneol=native#text/plain
tests/webtbs/tw13596.pp svneol=native#text/plain
tests/webtbs/tw13596a.pp svneol=native#text/plain
tests/webtbs/tw13619.pp svneol=native#text/plain
tests/webtbs/tw13622.pp svneol=native#text/plain
tests/webtbs/tw13628a.pp svneol=native#text/plain
tests/webtbs/tw13628b.pp svneol=native#text/plain

View File

@ -54,9 +54,7 @@ Function ReverseString(const AText: string): string;
Function AnsiReverseString(const AText: AnsiString): AnsiString;inline;
Function StuffString(const AText: string; AStart, ALength: Cardinal; const ASubText: string): string;
Function RandomFrom(const AValues: array of string): string; overload;
Function IfThen(AValue: Boolean; const ATrue: string; AFalse: string): string;inline;
Function IfThen(AValue: Boolean; const ATrue: string): string;inline; // ; AFalse: string = ''
Function IfThen(AValue: Boolean; const ATrue: shortString ; const Afalse: shortString ='') :shortString; inline;
Function IfThen(AValue: Boolean; const ATrue: string; const AFalse: string = ''): string; overload;
{ ---------------------------------------------------------------------
VB emulations.
@ -396,7 +394,7 @@ begin
result:=Avalues[random(High(AValues)+1)];
end;
Function IfThen(AValue: Boolean; const ATrue: string; AFalse: string): string;inline;
Function IfThen(AValue: Boolean; const ATrue: string; const AFalse: string = ''): string; overload;
begin
if avalue then
@ -405,20 +403,6 @@ begin
result:=afalse;
end;
Function IfThen(AValue: Boolean; const ATrue: string): string;inline; // ; AFalse: string = ''
begin
if avalue then
result:=atrue
else
result:='';
end;
Function IfThen(AValue:boolean;const ATrue:shortString ; const AFalse:shortString ='') :shortString; inline;
begin
if AValue then result:=ATrue else result:=AFalse;
end;
{ ---------------------------------------------------------------------
VB emulations.
---------------------------------------------------------------------}

10
tests/webtbs/tw13619.pp Normal file
View File

@ -0,0 +1,10 @@
uses
Math, StrUtils;
begin
if (IfThen(1 > 2, 1, 2) <> 2) then
halt(1);
if (IfThen(1 > 2, '1', '2') <> '2') then
halt(2);
if (IfThen(1 > 2, '123', '456') <> '456') then
halt(3);
end.