Units documentation

rptypeval.pas

Description

This unit implements basic evaluator types and functions, provide base classes to define functions, variables in a expression evaluator

Types

Name Description
TRpToken

Enumeration (totEOF,totSymbol,totString,totInteger,TotFloat,totOperator, totBoolean,totDate,totTime,totDateTime)

An expression is divided in tokens (parsed), each token can have one of this types.

TRpValue

Variant

It's defined as a variant, in early implementations of the engine the expression evaluator values was implemented as a record because variants did not exists, this definition provide the way to implement operations with custom variants in a future, basic type operations are done using functions passing this type

RTypeIdentificator

Enumeration (RTypeidenFunction,RTypeIdenVariable,RTypeIdenConstant)

A identifier can be a function, variable or constant.

Components and classes

Name Base class Description
TRpNamedException Exception Exception with a property to identify the cause of the exception
TRpEvalException TRpNamedException Exception with information about the position (inside a expression) where the exception was launched
TIdentifier TObject Abstract definition of a evaluator identifier
TIdenFunction TIdentifier The implementation of a evaluator function, to define a new function derive it from this object
TIdenVariable TIdentifier The implementation of a evaluator variable
TIdenConstant TIdentifier The implementation of a evaluator constant
TIdenField TIdentifier The implementation of a evaluator database field
TIdenTrue TIdenConstant Boolean True constant
TIdenFalse TIdenConstant Boollean False constant

Functions

Most of the functions are used by the evaluator for common arithmetic and comparation operations.

Declaration Description
function SumTRpValue(Value1,Value2:TRpValue):TRpValue; Sum operation
function DifTRpValue(Value1,Value2:TRpValue):TRpValue; Dif operation
function MultTRpValue(Value1,Value2:TRpValue):TRpValue; Multiply
function DivTRpValue(Value1,Value2:TRpValue):TRpValue; Divide
function SignTRpValue(Value:TRpValue):TRpValue; Sign
function EqualTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator.
function EqualEqualTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator.
function MorethanEqualTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator.
function LessthanEqualTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator
function MorethanTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator
function LessthanTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator
function DiferentTRpValue(Value1,Value2:TRpValue):TRpValue; Comp. operator
function IsNullTRpValue(Value:TRpValue):Boolean; Comp. operator
function LogicalANDTRpValue(Value1,Value2:TRpValue):TRpValue; Logical operator
function LogicalORTRpValue(Value1,Value2:TRpValue):TRpValue; Logical operator
function LogicalNOTTRpValue(Value1:TRpValue):TRpValue; Not operator
function TRpValueToString(Value:TRpValue):string; Format operator
function FormatTRpValue(sFormat:string;Value:TRpValue;Userdef:Boolean):string; Format operator
procedure DatetimeValidation(var Value1,Value2:TRpValue); Date validate