smartinspectpython.sitoken
Module: sitoken.py
Revision History
Date | Version | Description |
---|---|---|
2023/05/30 | 3.0.0.0 | Initial Version. |
Represents a token in the pattern string of the SITextProtocol protocol.
This is the abstract base class for all available tokens. Derived classes are not documented for clarity reasons. To create a suitable token object for a given token string, you can use the SITokenFactory class.
Threadsafety:
This class is not guaranteed to be thread-safe.
Gets the Indent property value.
Indicates if this token supports indenting.
This property always returns false unless this token represents the title token of a pattern string. This property is used by the SIPatternParser.Expand method to determine if a token allows indenting.
Gets the Options property value.
Represents the optional options string for this token.
A variable token can have an optional options string. In the raw string representation of a token, an options string can be specified in curly braces after the variable name like this: %name{options}%. For a literal, this property is always set to an empty string.
Gets the Value property value.
Represents the raw string value of the parsed pattern string for this token.
This property represents the raw string of this token as found in the parsed pattern string. For a variable, this property is set to the variable name surrounded with '%' characters and an optional options string like this: %name{options}%. For a literal, this property can have any value.
Gets the Width property value.
Represents the minimum width of this token.
A variable token can have an optional width modifier. In the raw string representation of a token, a width modifier can be specified after the variable name like this: %name,width%. Width must be a valid positive or negative integer.
If the width is greater than 0, formatted values will be right-aligned. If the width is less than 0, they will be left-aligned.
For a literal, this property is always set to 0.
Creates a string representation of a variable or literal token.
Arguments:
- logEntry (SILogEntry): The Log Entry to use to create the string representation.
Returns:
The text representation of this token for the supplied Log Entry object.
With the help of the supplied Log Entry, this token is expanded into a string. For example, if this token represents the %session% variable of a pattern string, this Expand method simply returns the session name of the supplied Log Entry.
For a literal token, the supplied Log Entry argument is ignored and the Value property is returned.