mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 16:29:31 +02:00
* Removed the restriction that ParseString could only be called 100 times
git-svn-id: trunk@15190 -
This commit is contained in:
parent
3759ad8963
commit
62592322e1
@ -64,6 +64,7 @@ Type
|
|||||||
function GetValue(Key : String): String;
|
function GetValue(Key : String): String;
|
||||||
procedure SetDelimiter(Index: integer; const AValue: TParseDelimiter);
|
procedure SetDelimiter(Index: integer; const AValue: TParseDelimiter);
|
||||||
procedure SetValue(Key : String; const AValue: String);
|
procedure SetValue(Key : String; const AValue: String);
|
||||||
|
Function IntParseString(Src : String) : String;
|
||||||
Public
|
Public
|
||||||
Constructor Create;
|
Constructor Create;
|
||||||
Destructor Destroy; override;
|
Destructor Destroy; override;
|
||||||
@ -290,7 +291,7 @@ begin
|
|||||||
FOnGetParam(Self,Key,AValue);
|
FOnGetParam(Self,Key,AValue);
|
||||||
end;
|
end;
|
||||||
If Result and Recursive then
|
If Result and Recursive then
|
||||||
AValue:=ParseString(AValue);
|
AValue:=IntParseString(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTemplateParser.ReplaceTag(const Key: String; TagParams:TStringList; out ReplaceWith: String): Boolean;
|
function TTemplateParser.ReplaceTag(const Key: String; TagParams:TStringList; out ReplaceWith: String): Boolean;
|
||||||
@ -405,6 +406,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TTemplateParser.ParseString(Src: String): String;
|
function TTemplateParser.ParseString(Src: String): String;
|
||||||
|
begin
|
||||||
|
FParseLevel:=0;
|
||||||
|
Result:=IntParseString(Src);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TTemplateParser.IntParseString(Src: String): String;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
PN,PV,ReplaceWith : String;
|
PN,PV,ReplaceWith : String;
|
||||||
@ -529,7 +536,6 @@ begin
|
|||||||
Finally
|
Finally
|
||||||
SS.Free;
|
SS.Free;
|
||||||
end;
|
end;
|
||||||
FParseLevel := 0;
|
|
||||||
R:=ParseString(S);
|
R:=ParseString(S);
|
||||||
Result:=Length(R);
|
Result:=Length(R);
|
||||||
If (Result>0) then
|
If (Result>0) then
|
||||||
@ -543,10 +549,7 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
For I:=0 to Src.Count-1 do
|
For I:=0 to Src.Count-1 do
|
||||||
begin
|
|
||||||
FParseLevel := 0;
|
|
||||||
Dest.Add(ParseString(Src[i]));
|
Dest.Add(ParseString(Src[i]));
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFPCustomTemplate }
|
{ TFPCustomTemplate }
|
||||||
@ -619,7 +622,7 @@ begin
|
|||||||
Result:=S.DataString;
|
Result:=S.DataString;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result:=P.ParseString(FTemplate);
|
Result:=P.IntParseString(FTemplate);
|
||||||
Finally
|
Finally
|
||||||
P.Free;
|
P.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user