TTemplateParser class
A class to parse templates.
Declaration
TTemplateParser = class(TObject)Inheritance
- TTemplateParser
- TObject
Description
TTemplateParser is a class that can parse a text and substitute template variables with their values.
The template variables are enclosed in delimiters, by default { and }.
Whenever a variable is found, its value is looked up in the Values property.
If it is not found there, the OnGetParam event is called to obtain a value for the variable.
The delimiters can be set using the various delimiter properties.
Errors
If the text is deeply nested, an ETemplateParser exception may be raised.
See also
Properties
StartDelimiter | public | Start delimiter for a template variable. |
EndDelimiter | public | End delimiter for a template variable. |
ParamStartDelimiter | public | Start delimiter for a template variable parameter. |
ParamEndDelimiter | public | End delimiter for a template variable parameter. |
ParamValueSeparator | public | Separator for a template variable parameter and its value. |
Values | public | List of values for template variables. |
ValuesByIndex | public | Access to values by index. |
NamesByIndex | public | Access to variable names by index. |
ValueCount | public | Number of values in the list. |
Recursive | public | Enable recursive parsing. |
AllowTagParams | public | Allow tags with parameters. |
Methods
Create | public | Create a new instance of the template parser. |
Destroy | public | Frees the template parser instance. |
Clear | public | Clear the list of values. |
ReplaceTag | public | Replace a tag with a value. |
GetParam | public | Get a value for a parameter. |
GetTagParams | public | Extract tag parameters from a tag name. |
ParseString | public | Parse a string and substitute variables. |
ParseStream | public | Parse a stream and substitute variables. |
ParseStrings | public | Parse a stringlist and substitute variables. |
ParseFiles | public | Parse a file and substitute variables. |
Events
OnGetParam | public | Event to get a value for a template variable. |
OnReplaceTag | public | Event to replace a tag. |
Inherited
From TObject (40)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
