UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TOperatorJumpTable< ContextType, CharType > Struct Template Reference

#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)
 

Detailed Description

template<typename ContextType, typename CharType>
struct TOperatorJumpTable< ContextType, CharType >

Jump table specifying how to execute an operator with different types

Member Typedef Documentation

◆ FBinaryFunction

template<typename ContextType , typename CharType >
using TOperatorJumpTable< ContextType, CharType >::FBinaryFunction = TFunction<FExpressionResult(const FExpressionNode&, const FExpressionNode&, const ContextType* Context)>

◆ FShortCircuit

template<typename ContextType , typename CharType >
using TOperatorJumpTable< ContextType, CharType >::FShortCircuit = TFunction<bool(const FExpressionNode&, const ContextType* Context)>

◆ FUnaryFunction

template<typename ContextType , typename CharType >
using TOperatorJumpTable< ContextType, CharType >::FUnaryFunction = TFunction<FExpressionResult(const FExpressionNode&, const ContextType* Context)>

Member Function Documentation

◆ ExecBinary()

template<typename ContextType , typename CharType >
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

◆ ExecPostUnary()

template<typename ContextType , typename CharType >
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

◆ ExecPreUnary()

template<typename ContextType , typename CharType >
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

◆ MapBinary()

template<typename ContextType , typename CharType >
template<typename OperatorType , typename FuncType >
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); });

◆ MapPostUnary()

template<typename ContextType , typename CharType >
template<typename OperatorType , typename FuncType >
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.

◆ MapPreUnary()

template<typename ContextType , typename CharType >
template<typename OperatorType , typename FuncType >
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.")));

});

◆ MapShortCircuit()

template<typename ContextType , typename CharType >
template<typename OperatorType , typename FuncType >
void TOperatorJumpTable< ContextType, CharType >::MapShortCircuit ( FuncType  InFunc)

◆ ShouldShortCircuit()

template<typename ContextType , typename CharType >
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


The documentation for this struct was generated from the following files: