![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <ExpressionParserTypes.h>
Public Types | |
| using | FUnaryFunction = TFunction< FExpressionResult(const FExpressionNode &, const ContextType *Context)> |
| using | FBinaryFunction = TFunction< FExpressionResult(const FExpressionNode &, const FExpressionNode &, const ContextType *Context)> |
| using | FShortCircuit = TFunction< bool(const FExpressionNode &, const ContextType *Context)> |
Public Member Functions | |
| FExpressionResult | ExecPreUnary (const TExpressionToken< CharType > &Operator, const TExpressionToken< CharType > &R, const ContextType *Context) const |
| FExpressionResult | ExecPostUnary (const TExpressionToken< CharType > &Operator, const TExpressionToken< CharType > &L, const ContextType *Context) const |
| FExpressionResult | ExecBinary (const TExpressionToken< CharType > &Operator, const TExpressionToken< CharType > &L, const TExpressionToken< CharType > &R, const ContextType *Context) const |
| bool | ShouldShortCircuit (const TExpressionToken< CharType > &Operator, const TExpressionToken< CharType > &L, const ContextType *Context) const |
| template<typename OperatorType , typename FuncType > | |
| void | MapPreUnary (FuncType InFunc) |
| template<typename OperatorType , typename FuncType > | |
| void | MapPostUnary (FuncType InFunc) |
| template<typename OperatorType , typename FuncType > | |
| void | MapBinary (FuncType InFunc) |
| template<typename OperatorType , typename FuncType > | |
| void | MapShortCircuit (FuncType InFunc) |
Jump table specifying how to execute an operator with different types
| using TOperatorJumpTable< ContextType, CharType >::FBinaryFunction = TFunction<FExpressionResult(const FExpressionNode&, const FExpressionNode&, const ContextType* Context)> |
| using TOperatorJumpTable< ContextType, CharType >::FShortCircuit = TFunction<bool(const FExpressionNode&, const ContextType* Context)> |
| using TOperatorJumpTable< ContextType, CharType >::FUnaryFunction = TFunction<FExpressionResult(const FExpressionNode&, const ContextType* Context)> |
| FExpressionResult TOperatorJumpTable< ContextType, CharType >::ExecBinary | ( | const TExpressionToken< CharType > & | Operator, |
| const TExpressionToken< CharType > & | L, | ||
| const TExpressionToken< CharType > & | R, | ||
| const ContextType * | Context | ||
| ) | const |
Execute the specified token as a binary operator, if such an overload exists
| FExpressionResult TOperatorJumpTable< ContextType, CharType >::ExecPostUnary | ( | const TExpressionToken< CharType > & | Operator, |
| const TExpressionToken< CharType > & | L, | ||
| const ContextType * | Context | ||
| ) | const |
Execute the specified token as a unary operator, if such an overload exists
| FExpressionResult TOperatorJumpTable< ContextType, CharType >::ExecPreUnary | ( | const TExpressionToken< CharType > & | Operator, |
| const TExpressionToken< CharType > & | R, | ||
| const ContextType * | Context | ||
| ) | const |
Execute the specified token as a unary operator, if such an overload exists
| void TOperatorJumpTable< ContextType, CharType >::MapBinary | ( | FuncType | InFunc | ) |
Map an expression node to a binary operator with the specified implementation.
The callable type must match the declaration Ret(OperandL, OperandR, [, Context]), where: Ret = Any DEFINE_EXPRESSION_NODE_TYPE type, OR FExpressionResult OperandL = Any DEFINE_EXPRESSION_NODE_TYPE type OperandR = Any DEFINE_EXPRESSION_NODE_TYPE type Context = (optional) const ptr to user-supplied arbitrary context
Examples that binds a '/' token to a function that attempts to do a division: JumpTable.MapUnary<FForwardSlash>([](double A, double B){ return A / B; }); // Runtime exception on div/0 JumpTable.MapUnary<FForwardSlash>([](double A, double B, FMyContext* Ctxt){ if (!Ctxt->IsMathEnabled()) { return A; } return A / B; // Runtime exception on div/0 }); JumpTable.MapUnary<FForwardSlash>([](double A, double B, const FMyContext* Ctxt) -> FExpressionResult { if (!Ctxt->IsMathEnabled()) { return MakeError(FExpressionError(LOCTEXT("MathNotEnabled", "Math is not enabled."))); } else if (B == 0) { return MakeError(FExpressionError(LOCTEXT("DivisionByZero", "Division by zero."))); }
return MakeValue(!A); });
| void TOperatorJumpTable< ContextType, CharType >::MapPostUnary | ( | FuncType | InFunc | ) |
Map an expression node to a post-unary operator with the specified implementation. The same function signature rules apply here as with MapPreUnary.
| void TOperatorJumpTable< ContextType, CharType >::MapPreUnary | ( | FuncType | InFunc | ) |
Map an expression node to a pre-unary operator with the specified implementation.
The callable type must match the declaration Ret(Operand[, Context]), where: Ret = Any DEFINE_EXPRESSION_NODE_TYPE type, OR FExpressionResult Operand = Any DEFINE_EXPRESSION_NODE_TYPE type Context = (optional) const ptr to user-supplied arbitrary context
Examples that binds a '!' token to a function that attempts to do a boolean 'not': JumpTable.MapPreUnary<FExclamation>([](bool A){ return !A; }); JumpTable.MapPreUnary<FExclamation>([](bool A, FMyContext* Ctxt){ if (Ctxt->IsBooleanNotOpEnabled()) { return !A; } else { return A; } }); JumpTable.MapPreUnary<FExclamation>([](bool A, const FMyContext* Ctxt) -> FExpressionResult {
if (Ctxt->IsBooleanNotOpEnabled())
{
return MakeValue(!A);
}
return MakeError(FExpressionError(LOCTEXT("NotNotEnabled", "Boolean not is not enabled.")));
});
| void TOperatorJumpTable< ContextType, CharType >::MapShortCircuit | ( | FuncType | InFunc | ) |
| bool TOperatorJumpTable< ContextType, CharType >::ShouldShortCircuit | ( | const TExpressionToken< CharType > & | Operator, |
| const TExpressionToken< CharType > & | L, | ||
| const ContextType * | Context | ||
| ) | const |
Check whether we should short circuit the specified operator