Class TCasScriptExpression
Unit
Declaration
type TCasScriptExpression = class(TObject)
Description
Hierarchy
- TObject
- TCasScriptExpression
Overview
Methods
function CoreExecute: TCasScriptValue; virtual; abstract; |
|
function Execute: TCasScriptValue; |
|
function TryExecuteMath: TCasScriptValue; |
|
function AsFloat(const ADefaultValue: Float = 0): Float; |
|
function AsInt(const ADefaultValue: Int64 = 0): Int64; |
|
function AsString(const ADefaultValue: string = ''): string; |
|
function AsBool(const ADefaultValue: boolean = false): boolean; |
|
procedure FreeByParentExpression; |
Properties
property Environment: TCasScriptEnvironment read FEnvironment write FEnvironment; |
Description
Methods
function CoreExecute: TCasScriptValue; virtual; abstract; |
|
More internal version of Execute. This doesn't necessarily check floating-point exceptions. Execute actually calls Also this doesn't try to convert EIntError and EMathError to ECasScriptAnyMathError. This is done by Execute. When one CastleScript |
function Execute: TCasScriptValue; |
|
Execute and calculate this expression. Returned value is owned by this object. Which should be comfortable for you usually, as you do not have to worry about freeing it. Also, it allows us to make various optimizations to avoid creating/destroying lots of temporary TCasScriptExpression instances during calculation of complex expression. The disadvantage of this is that returned object value is valid only until you executed this same expression again, or until you freed this expression. If you need to remember the execute result for longer, you have to copy it somewhere. For example you can do { This will always work, thanks to virtual TCasScriptValue.Create and AssignValue methods. } Copy := TCasScriptValue(ReturnedValue.ClassType).Create; Copy.AssignValue(ReturnedValue);
Exceptions raised
|
function TryExecuteMath: TCasScriptValue; |
|
Try to execute expression, or return This is useful to secure you against math arguments errors ('ln(-3)', 'sqrt(-3)') but still raises normal exception on other ECasScriptError errors (like invalid argument type for function). |
function AsFloat(const ADefaultValue: Float = 0): Float; |
|
Execute expression, return the result as a simple float value. It assumes that the expression is written to always return float. To easily create such expression, use ParseFloatExpression. |
function AsInt(const ADefaultValue: Int64 = 0): Int64; |
|
Execute expression, return the result as a simple integer value. It assumes that the expression is written to always return integer. To easily create such expression, use ParseIntExpression. |
function AsString(const ADefaultValue: string = ''): string; |
|
Execute expression, return the result as a simple string value. It assumes that the expression is written to always return string. To easily create such expression, use ParseStringExpression. |
function AsBool(const ADefaultValue: boolean = false): boolean; |
|
Execute expression, return the result as a simple boolean value. It assumes that the expression is written to always return boolean. To easily create such expression, use ParseBoolExpression. |
procedure FreeByParentExpression; |
|
Call Free, but only if this is not TCasScriptValue with OwnedByParentExpression = false. (This cannot be implemented cleanly, as virtual procedure, since it must work when Self is |
Properties
property Environment: TCasScriptEnvironment read FEnvironment write FEnvironment; |
|
Environment (outside information) for this expression. May be |
Generated by PasDoc 0.16.0.