Description | Hierarchy | Fields | Methods | Properties |
type TRbwParser = class(TComponent)
TRbwParser
compiles expression in strings via the Compile method into TExpression objects that it owns.
It can also create TRealVariables, TIntegerVariables, TBooleanVariables, and TStringVariables that can be used in the TExpression via the CreateVariable method. Alternately, such variables created by another instance of TRbwParser can be used via the RegisterVariable method.
All variables and expressions created by an instance of TRbwParser
are owned by it.
If several TRbwParsers are used and variables owned by one are used in another one, ClearExpressions and ClearVariables should be called in all of them before any of them is destroyed.
See TFunctionStringList and OverloadedFunctionList for a list of the functions included by default.
![]() |
Operators: TStringList; |
![]() |
WordOperators: TStringList; |
![]() |
Signs: set of AnsiChar; |
![]() |
FSpecialImplementorList: TSpecialImplementorList; |
![]() |
FCurrentExpression: TExpression; |
![]() |
FExpressions: TStringList; |
![]() |
FFunctions: TFunctionStringList; |
![]() |
FVariables: TStringList; |
![]() |
FOwnedVariables: TObjectList; |
![]() |
FOpereratorDefinitions: TList; |
![]() |
FCachedFindResult: integer; |
![]() |
function GetExpressions(const Index: integer): TExpression; |
![]() |
function GetVariable(const Index: integer): TCustomValue; |
![]() |
procedure DefineNotOperator; |
![]() |
procedure DefinePlusSignOperator; |
![]() |
procedure DefineMinusSignOperator; |
![]() |
procedure DefineTimesOperator; |
![]() |
procedure DefineDivideOperator; |
![]() |
procedure DefineDivOperator; |
![]() |
procedure DefineModOperator; |
![]() |
procedure DefineAndOperator; |
![]() |
procedure DefinePlusOperator; |
![]() |
procedure DefineMinusOperator; |
![]() |
procedure DefineOrOperator; |
![]() |
procedure DefineXorOperator; |
![]() |
procedure DefineEqualsOperator; |
![]() |
procedure DefineNotEqualsOperator; |
![]() |
procedure DefineLessThanOperator; |
![]() |
procedure DefineGreaterThanOperator; |
![]() |
procedure DefineLessThanOrEqualsOperator; |
![]() |
procedure DefineGreaterThanOrEqualsOperator; |
![]() |
procedure AddOperator(OpDef: TOperatorDefinition); |
![]() |
procedure RemoveOperator(OperatorName: AnsiString); |
![]() |
procedure ClearExpressions; |
![]() |
procedure ClearVariables; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: boolean; const NameToDisplay: string): TBooleanVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: boolean; VariableClass: TBooleanVariableClass; const NameToDisplay: string): TBooleanVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: integer; const NameToDisplay: string): TIntegerVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: integer; VariableClass: TIntegerVariableClass; const NameToDisplay: string) : TIntegerVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: double; const NameToDisplay: string): TRealVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: double; VariableClass: TRealVariableClass; const NameToDisplay: string): TRealVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: string; const NameToDisplay: string): TStringVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: string; VariableClass: TStringVariableClass; const NameToDisplay: string): TStringVariable; overload; |
![]() |
function Compile(var AString: string): integer; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
procedure DeleteExpression(const Index: integer); |
![]() |
destructor Destroy; override; |
![]() |
function ExpressionCount: integer; |
![]() |
function IndexOfVariable(VariableName: string): integer; |
![]() |
procedure RegisterVariable(const Value: TCustomValue); |
![]() |
procedure RemoveExpression(const Expression: TExpression); |
![]() |
procedure RemoveVariable(const Variable: TCustomVariable); |
![]() |
procedure RenameVariable(var Index: integer; NewName: string; NewDisplayName: string); |
![]() |
function VariableCount: integer; |
![]() |
property SpecialImplementorList: TSpecialImplementorList
read FSpecialImplementorList; |
![]() |
property CurrentExpression: TExpression read FCurrentExpression; |
![]() |
property Expressions[constIndex:integer]: TExpression
read GetExpressions; |
![]() |
property Functions: TFunctionStringList read FFunctions; |
![]() |
property Variables[constIndex:integer]: TCustomValue read GetVariable; |
![]() |
Operators: TStringList; |
|
![]() |
WordOperators: TStringList; |
name contains the names of the operators that have two or more characters in their names. |
![]() |
Signs: set of AnsiChar; |
|
![]() |
FSpecialImplementorList: TSpecialImplementorList; |
![]() |
FCurrentExpression: TExpression; |
|
![]() |
FExpressions: TStringList; |
|
![]() |
FFunctions: TFunctionStringList; |
|
![]() |
FVariables: TStringList; |
|
![]() |
FOwnedVariables: TObjectList; |
|
![]() |
FOpereratorDefinitions: TList; |
|
![]() |
FCachedFindResult: integer; |
![]() |
function GetExpressions(const Index: integer): TExpression; |
See Expressions. |
![]() |
function GetVariable(const Index: integer): TCustomValue; |
See Variables. |
![]() |
procedure DefineNotOperator; |
|
![]() |
procedure DefinePlusSignOperator; |
|
![]() |
procedure DefineMinusSignOperator; |
|
![]() |
procedure DefineTimesOperator; |
|
![]() |
procedure DefineDivideOperator; |
|
![]() |
procedure DefineDivOperator; |
|
![]() |
procedure DefineModOperator; |
|
![]() |
procedure DefineAndOperator; |
|
![]() |
procedure DefinePlusOperator; |
|
![]() |
procedure DefineMinusOperator; |
|
![]() |
procedure DefineOrOperator; |
|
![]() |
procedure DefineXorOperator; |
|
![]() |
procedure DefineEqualsOperator; |
|
![]() |
procedure DefineNotEqualsOperator; |
|
![]() |
procedure DefineLessThanOperator; |
|
![]() |
procedure DefineGreaterThanOperator; |
|
![]() |
procedure DefineLessThanOrEqualsOperator; |
|
![]() |
procedure DefineGreaterThanOrEqualsOperator; |
|
![]() |
procedure AddOperator(OpDef: TOperatorDefinition); |
|
![]() |
procedure RemoveOperator(OperatorName: AnsiString); |
|
![]() |
procedure ClearExpressions; |
If several TRbwParsers are used and variables owned by one are used in another one, ClearExpressions and ClearVariables should be called in all of them before any of them is destroyed. |
![]() |
procedure ClearVariables; |
If several TRbwParsers are used and variables owned by one are used in another one, ClearExpressions and ClearVariables should be called in all of them before any of them is destroyed. |
![]() |
function CreateVariable(const Name, Classification: string; const Value: boolean; const NameToDisplay: string): TBooleanVariable; overload; |
See also: RegisterVariable. |
![]() |
function CreateVariable(const Name, Classification: string; const Value: boolean; VariableClass: TBooleanVariableClass; const NameToDisplay: string): TBooleanVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: integer; const NameToDisplay: string): TIntegerVariable; overload; |
See also: RegisterVariable. |
![]() |
function CreateVariable(const Name, Classification: string; const Value: integer; VariableClass: TIntegerVariableClass; const NameToDisplay: string) : TIntegerVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: double; const NameToDisplay: string): TRealVariable; overload; |
See also: RegisterVariable. Example: procedure TForm1.Button2Click(Sender: TObject); var Index : integer; Variable : TRealVariable; begin RbwParser1.CreateVariable('A', 2.5); RbwParser1.CreateVariable('B', 3.5); RbwParser1.Compile('A + B'); RbwParser1.CurrentExpression.Evaluate; Label1.Caption := 'result: ' + FloatToStr(RbwParser1.CurrentExpression.DoubleResult); // Label1.Caption is set to "result: 6". Index := RbwParser1.IndexOfVariable('a'); // variable names are not case sensitive. Variable := RbwParser1.Variables[Index] as TRealVariable; Variable.Value := 6.5; RbwParser1.CurrentExpression.Evaluate; Label2.Caption := 'result: ' + FloatToStr(RbwParser1.CurrentExpression.DoubleResult); // Label2.Caption is set to "result: 10". // As it stands, this event handler would cause // an error if it was called twice because // it would try to create variables named "A" and "B" twice. // Calling ClearVariables would prevent this if that is // what you really want to do. end; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: double; VariableClass: TRealVariableClass; const NameToDisplay: string): TRealVariable; overload; |
![]() |
function CreateVariable(const Name, Classification: string; const Value: string; const NameToDisplay: string): TStringVariable; overload; |
See also: RegisterVariable. |
![]() |
function CreateVariable(const Name, Classification: string; const Value: string; VariableClass: TStringVariableClass; const NameToDisplay: string): TStringVariable; overload; |
![]() |
function Compile(var AString: string): integer; |
Expressions are owned by TRbwParser. |
![]() |
constructor Create(AOwner: TComponent); override; |
|
![]() |
procedure DeleteExpression(const Index: integer); |
|
![]() |
destructor Destroy; override; |
|
![]() |
function ExpressionCount: integer; |
|
![]() |
function IndexOfVariable(VariableName: string): integer; |
|
![]() |
procedure RegisterVariable(const Value: TCustomValue); |
|
![]() |
procedure RemoveExpression(const Expression: TExpression); |
|
![]() |
procedure RemoveVariable(const Variable: TCustomVariable); |
If Variable is owned by or registered with TRbwParser, |
![]() |
function VariableCount: integer; |
|
![]() |
property SpecialImplementorList: TSpecialImplementorList
read FSpecialImplementorList; |
See: TSpecialImplementorList. |
![]() |
property CurrentExpression: TExpression read FCurrentExpression; |
|
![]() |
property Expressions[constIndex:integer]: TExpression
read GetExpressions; |
|
![]() |
property Functions: TFunctionStringList read FFunctions; |
|
![]() |
property Variables[constIndex:integer]: TCustomValue read GetVariable; |
|