OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLFormulaArg Class Reference

Lightweight formula evaluation engine. More...

#include <XLFormulaEngine.hpp>

Data Structures

class  Iterator
 

Public Types

enum class  Type { Empty , Scalar , Array , LazyRange }
 

Public Member Functions

 XLFormulaArg ()=default
 
 XLFormulaArg (XLCellValue v)
 
 XLFormulaArg (std::vector< XLCellValue > arr)
 
 XLFormulaArg (uint32_t r1, uint32_t r2, uint16_t c1, uint16_t c2, std::string sheetName, const std::function< XLCellValue(std::string_view)> *resolver)
 
Type type () const
 
size_t rows () const
 
size_t cols () const
 
bool empty () const
 
size_t size () const
 
XLCellValue operator[] (size_t index) const
 
Iterator begin () const
 
Iterator end () const
 

Detailed Description

Lightweight formula evaluation engine.

Usage:

auto resolver = XLFormulaEngine::makeResolver(worksheet);
XLCellValue result = engine.evaluate("SUM(A1:C1)", resolver);
Class encapsulating a cell value.
Definition XLCellValue.hpp:79
Definition XLFormulaEngine.hpp:312
XLCellValue evaluate(std::string_view formula, const XLCellResolver &resolver={}) const
Evaluate a formula string.
Definition XLFormulaEngine.cpp:213
static XLCellResolver makeResolver(const XLWorksheet &wks)
Create a CellResolver that reads live values from an XLWorksheet.
Definition XLFormulaEngine.cpp:235

The engine is thread-safe for concurrent evaluate() calls after construction (the function table is built once in the constructor and is read-only thereafter).

Member Enumeration Documentation

◆ Type

enum class OpenXLSX::XLFormulaArg::Type
strong
Enumerator
Empty 
Scalar 
Array 
LazyRange 

Constructor & Destructor Documentation

◆ XLFormulaArg() [1/4]

OpenXLSX::XLFormulaArg::XLFormulaArg ( )
default

◆ XLFormulaArg() [2/4]

OpenXLSX::XLFormulaArg::XLFormulaArg ( XLCellValue  v)
inline

◆ XLFormulaArg() [3/4]

OpenXLSX::XLFormulaArg::XLFormulaArg ( std::vector< XLCellValue arr)
inline

◆ XLFormulaArg() [4/4]

OpenXLSX::XLFormulaArg::XLFormulaArg ( uint32_t  r1,
uint32_t  r2,
uint16_t  c1,
uint16_t  c2,
std::string  sheetName,
const std::function< XLCellValue(std::string_view)> *  resolver 
)
inline

Member Function Documentation

◆ begin()

Iterator OpenXLSX::XLFormulaArg::begin ( ) const
inline

◆ cols()

size_t OpenXLSX::XLFormulaArg::cols ( ) const
inline

◆ empty()

bool OpenXLSX::XLFormulaArg::empty ( ) const
inline

◆ end()

Iterator OpenXLSX::XLFormulaArg::end ( ) const
inline

◆ operator[]()

XLCellValue OpenXLSX::XLFormulaArg::operator[] ( size_t  index) const
inline

◆ rows()

size_t OpenXLSX::XLFormulaArg::rows ( ) const
inline

◆ size()

size_t OpenXLSX::XLFormulaArg::size ( ) const
inline

◆ type()

Type OpenXLSX::XLFormulaArg::type ( ) const
inline

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