summaryrefslogtreecommitdiff
path: root/packages/fcl-base
diff options
context:
space:
mode:
authorjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-05-03 14:30:11 +0000
committerjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-05-03 14:30:11 +0000
commite4b2de6c78058e80253c91f808d108c9d3351e61 (patch)
tree3fdc3f50f957be44af2fc52bb92bf63be3acf0e9 /packages/fcl-base
parenta5ee45ea3511b0d897c77e3d40920fbe1f2b54b1 (diff)
downloadfpc-e4b2de6c78058e80253c91f808d108c9d3351e61.tar.gz
* Added ability to list values by index instead of name
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15215 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-base')
-rw-r--r--packages/fcl-base/src/fptemplate.pp28
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/fcl-base/src/fptemplate.pp b/packages/fcl-base/src/fptemplate.pp
index 79398b2c4b..bf1d6664aa 100644
--- a/packages/fcl-base/src/fptemplate.pp
+++ b/packages/fcl-base/src/fptemplate.pp
@@ -61,7 +61,10 @@ Type
FOnGetParam: TGetParamEvent; //Event handler to use for templates containing simple tags only (ex: {Name})
FOnReplaceTag: TReplaceTagEvent; //Event handler to use for templates containing tags with parameters (ex: <#TagName paramname1="paramvalue1" paramname2="paramvalue2">)
function GetDelimiter(Index: integer): TParseDelimiter;
+ function GetNameByIndex(index : Integer): String;
function GetValue(Key : String): String;
+ function GetValueByIndex(index : Integer): String;
+ function GetValueCount: Integer;
procedure SetDelimiter(Index: integer; const AValue: TParseDelimiter);
procedure SetValue(Key : String; const AValue: String);
Function IntParseString(Src : String) : String;
@@ -83,6 +86,9 @@ Type
Property ParamEndDelimiter : TParseDelimiter Index 4 Read GetDelimiter Write SetDelimiter;
Property ParamValueSeparator : TParseDelimiter Index 5 Read GetDelimiter Write SetDelimiter;
Property Values[Key : String] : String Read GetValue Write SetValue; // Contains static values. //used only when AllowTagParams = false
+ Property ValuesByIndex[index : Integer] : String Read GetValueByIndex; // Contains static values. //used only when AllowTagParams = false
+ Property NamesByIndex[index : Integer] : String Read GetNameByIndex; // Contains static values. //used only when AllowTagParams = false
+ Property ValueCount: Integer Read GetValueCount; //used only when AllowTagParams = false
Property Recursive : Boolean Read FRecursive Write FRecursive; //used only when AllowTagParams = false
Property AllowTagParams : Boolean Read FAllowTagParams Write FAllowTagParams;
end;
@@ -178,6 +184,21 @@ begin
end;
end;
+function TTemplateParser.GetValueByIndex(index : Integer): String;
+begin
+ Result:='';
+ If Assigned(FValues) then
+ Result:=TStringItem(FValues.Objects[index]).Value;
+end;
+
+function TTemplateParser.GetValueCount: Integer;
+begin
+ if assigned(FValues) then
+ result := FValues.Count
+ else
+ result := 0;
+end;
+
function TTemplateParser.GetDelimiter(Index: integer): TParseDelimiter;
begin
case Index of
@@ -190,6 +211,13 @@ begin
end;
end;
+function TTemplateParser.GetNameByIndex(index : Integer): String;
+begin
+ Result:='';
+ If Assigned(FValues) then
+ Result:=FValues.ValueFromIndex[index];
+end;
+
procedure TTemplateParser.SetDelimiter(Index: integer;
const AValue: TParseDelimiter);
begin