Sign in Join
FPDoc Onlineexperiment

TIfOperation class

In unit fpExprPars

Internally used class for conditional if-then-else operations

Declaration

pascal
TIfOperation = class(TFPBinaryOperation)

Inheritance

  1. TIfOperation
  2. TFPBinaryOperation
  3. TFPExprNode
  4. TObject

Description

The TIfOperation class implements conditional if-then-else operations in expressions, allowing for branching logic based on boolean conditions. It extends the expression framework to provide conditional evaluation similar to the ternary operator in many programming languages.

The operation evaluates a boolean condition and returns one of two expressions based on the result: the "then" expression if the condition is True, or the "else" expression if the condition is False. This enables complex conditional logic within expressions.

The class manages three operands: the condition (which must evaluate to boolean), the "then" expression (evaluated when condition is True), and the "else" expression (evaluated when condition is False). Only one of the result expressions is evaluated, providing efficient conditional processing.

This class is used internally by the TFPExpressionParser class to construct an AST (Abstract Syntax Tree). There is normally no need for you to use or instantiate this class directly.

See also

Properties

ConditionpublicThe condition expression of the if operation

Methods

GetNodeValueprotected
CheckpublicValidate the conditional operation for correctness
InitAggregatepublicInitialize aggregate processing for if operation
UpdateAggregatepublicUpdate aggregate calculations for if operation
HasAggregatepublicCheck if conditional operation contains aggregates
NodeTypepublicGet the result type for conditional operation
CreatepublicCreate conditional operation with condition and branches
destroypublicDestroy conditional operation and free resources
AsStringpublicGet string representation of conditional operation

Inherited

From TFPBinaryOperation (3)

CheckSameNodeTypes left Right

From TFPExprNode (3)

CheckNodeType IsAggregate NodeValue

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.