OpenXLSX 1.12.1
Modern C++ Excel Library (Fork of OpenXLSX by Kenneth Troldal Balslev)
Loading...
Searching...
No Matches
OpenXLSX::XLEvalSession Class Reference

Per-evaluation session shared by the engine and session-aware functions. More...

#include <XLFormulaEngine.hpp>

Data Structures

struct  PackedCellKey
 64-bit coordinate encoding for fast, normalized circular dependency checking. More...

Public Member Functions

 XLEvalSession ()=default
 XLEvalSession (const XLCellResolver &resolver)
XLEvalSession & setResolver (const XLCellResolver &resolver)
XLEvalSession & setNameResolver (XLNameResolver nameResolver)
XLEvalSession & setCurrentCell (uint32_t row, uint16_t col)
 Bind the cell that owns the formula (1-based Excel coordinates).
XLEvalSession & setCurrentSheet (std::string sheetName)
bool hasResolver () const
const XLCellResolver * resolverPtr () const
XLCellValue cellValue (std::string_view ref) const
std::optional< std::string > resolveName (std::string_view name) const
bool hasCurrentCell () const noexcept
uint32_t currentRow () const noexcept
uint16_t currentCol () const noexcept
const std::string & currentSheet () const noexcept
bool enterCall ()
 Enter a nested function/ref resolution (INDIRECT, etc.).
void leaveCall () noexcept
int callDepth () const noexcept
bool enterNodeEval ()
 Enter AST node evaluation recursion.
void leaveNodeEval () noexcept
int nodeEvalDepth () const noexcept
bool pushEvaluatingCell (std::string_view ref)
 Check and track cell references to detect circular dependency during evaluation.
void popEvaluatingCell () noexcept
PackedCellKey parsePackedKey (std::string_view ref) const
XLFormulaArg expandRange (std::string_view rangeRef) const
 Expand an A1-style cell/range text into a LazyRange (or scalar error).

Static Public Attributes

static constexpr int kMaxCallDepth = 128
static constexpr int kMaxNodeEvalDepth = 256
static constexpr size_t kInlineCellStackCapacity = 32

Detailed Description

Per-evaluation session shared by the engine and session-aware functions.

Phase A extension point for deep formula features:

  • cell resolution (via resolver)
  • defined-name resolution
  • current cell/sheet (for relative / parameterless ROW/COLUMN)
  • call-depth guard (INDIRECT recursion)
  • access to expandRange / evaluate helpers used by INDIRECT/OFFSET

Lifetime: valid only for the duration of a single XLFormulaEngine::evaluate call (or an explicitly scoped session created by the caller).

Constructor & Destructor Documentation

◆ XLEvalSession() [1/2]

OpenXLSX::XLEvalSession::XLEvalSession ( )
default

◆ XLEvalSession() [2/2]

OpenXLSX::XLEvalSession::XLEvalSession ( const XLCellResolver & resolver)
inlineexplicit

Member Function Documentation

◆ callDepth()

int OpenXLSX::XLEvalSession::callDepth ( ) const
inlinenodiscardnoexcept

◆ cellValue()

XLCellValue OpenXLSX::XLEvalSession::cellValue ( std::string_view ref) const
inlinenodiscard

◆ currentCol()

uint16_t OpenXLSX::XLEvalSession::currentCol ( ) const
inlinenodiscardnoexcept

◆ currentRow()

uint32_t OpenXLSX::XLEvalSession::currentRow ( ) const
inlinenodiscardnoexcept

◆ currentSheet()

const std::string & OpenXLSX::XLEvalSession::currentSheet ( ) const
inlinenodiscardnoexcept

◆ enterCall()

bool OpenXLSX::XLEvalSession::enterCall ( )
inline

Enter a nested function/ref resolution (INDIRECT, etc.).

Returns
false if the maximum call depth would be exceeded.

◆ enterNodeEval()

bool OpenXLSX::XLEvalSession::enterNodeEval ( )
inline

Enter AST node evaluation recursion.

Returns
false if the maximum node evaluation depth is exceeded.

◆ expandRange()

XLFormulaArg XLEvalSession::expandRange ( std::string_view rangeRef) const
nodiscard

Expand an A1-style cell/range text into a LazyRange (or scalar error).

Note
Requires a live resolver; used by INDIRECT/OFFSET and the engine.

◆ hasCurrentCell()

bool OpenXLSX::XLEvalSession::hasCurrentCell ( ) const
inlinenodiscardnoexcept

◆ hasResolver()

bool OpenXLSX::XLEvalSession::hasResolver ( ) const
inlinenodiscard

◆ leaveCall()

void OpenXLSX::XLEvalSession::leaveCall ( )
inlinenoexcept

◆ leaveNodeEval()

void OpenXLSX::XLEvalSession::leaveNodeEval ( )
inlinenoexcept

◆ nodeEvalDepth()

int OpenXLSX::XLEvalSession::nodeEvalDepth ( ) const
inlinenodiscardnoexcept

◆ parsePackedKey()

XLEvalSession::PackedCellKey XLEvalSession::parsePackedKey ( std::string_view ref) const
nodiscard

◆ popEvaluatingCell()

void XLEvalSession::popEvaluatingCell ( )
noexcept

◆ pushEvaluatingCell()

bool XLEvalSession::pushEvaluatingCell ( std::string_view ref)

Check and track cell references to detect circular dependency during evaluation.

Returns
false if the cell is already being evaluated (circular reference).

◆ resolveName()

std::optional< std::string > OpenXLSX::XLEvalSession::resolveName ( std::string_view name) const
inlinenodiscard

◆ resolverPtr()

const XLCellResolver * OpenXLSX::XLEvalSession::resolverPtr ( ) const
inlinenodiscard

◆ setCurrentCell()

XLEvalSession & OpenXLSX::XLEvalSession::setCurrentCell ( uint32_t row,
uint16_t col )
inline

Bind the cell that owns the formula (1-based Excel coordinates).

Enables parameterless ROW()/COLUMN() and future relative-ref features.

◆ setCurrentSheet()

XLEvalSession & OpenXLSX::XLEvalSession::setCurrentSheet ( std::string sheetName)
inline

◆ setNameResolver()

XLEvalSession & OpenXLSX::XLEvalSession::setNameResolver ( XLNameResolver nameResolver)
inline

◆ setResolver()

XLEvalSession & OpenXLSX::XLEvalSession::setResolver ( const XLCellResolver & resolver)
inline

Field Documentation

◆ kInlineCellStackCapacity

size_t OpenXLSX::XLEvalSession::kInlineCellStackCapacity = 32
staticconstexpr

◆ kMaxCallDepth

int OpenXLSX::XLEvalSession::kMaxCallDepth = 128
staticconstexpr

◆ kMaxNodeEvalDepth

int OpenXLSX::XLEvalSession::kMaxNodeEvalDepth = 256
staticconstexpr

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