Sign in Join
FPDoc Onlineexperiment

TCaseOperation class

In unit fpExprPars

Internally used class for case-when conditional operations

Declaration

pascal
TCaseOperation = class(TFPExprNode)

Inheritance

  1. TCaseOperation
  2. TFPExprNode
  3. TObject

Description

The TCaseOperation class implements case-when conditional operations in expressions, providing multi-way branching logic based on value matching. It allows for testing a single expression against multiple possible values and executing different branches based on which value matches.

The case operation evaluates a test expression and compares it against a series of when-value pairs, executing the associated expression for the first matching value. If no values match, an optional else expression is evaluated.

The TCaseOperation class enables complex multi-conditional logic within expressions, similar to CASE statements in SQL or switch statements in programming languages, providing an alternative to nested if-then-else constructs.

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 case operation

Methods

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

Inherited

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.