Declaration¶
Source position: fpexprpars.pp line 279
type
TCaseOperation = class(TFPExprNode)
public
procedure Check;
procedure InitAggregate;
procedure UpdateAggregate;
function HasAggregate : Boolean;
function NodeType : TResultType;
constructor Create;
destructor destroy;
function AsString : AnsiString;
property Condition: TFPExprNode; {r}
end;
Inheritance¶
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.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| Condition read only | public | The condition expression of the case operation |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| AsString | public | Get string representation of case operation |
| Check | public | Validate the case operation for correctness |
| Create | public | Create case operation with arguments |
| destroy | public | Destroy case operation and free resources |
| HasAggregate | public | Check if case operation contains aggregates |
| InitAggregate | public | Initialize aggregate processing for case operation |
| NodeType | public | Get the result type for case operation |
| UpdateAggregate | public | Update aggregate calculations for case operation |
See also¶
| Name | Description |
|---|---|
| TFPExprNode | Class for representing nodes in expression trees |