OpenXLSX 1.12.1
Modern C++ Excel Library (Fork of OpenXLSX by Kenneth Troldal Balslev)
Loading...
Searching...
No Matches
XLFormulaUtils.hpp File Reference

Shared conversion and error helpers for the formula evaluation pipeline. More...

#include "XLCellValue.hpp"
#include "XLFormulaEngine.hpp"
#include <cstdint>
#include <optional>
#include <random>
#include <string>
#include <string_view>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  OpenXLSX
namespace  OpenXLSX::formula

Functions

double OpenXLSX::formula::toDouble (const XLCellValue &v)
bool OpenXLSX::formula::isNumeric (const XLCellValue &v)
bool OpenXLSX::formula::isEmpty (const XLCellValue &v)
bool OpenXLSX::formula::isError (const XLCellValue &v)
std::string OpenXLSX::formula::toString (const XLCellValue &v)
XLCellValue OpenXLSX::formula::makeError (std::string_view token)
XLCellValue OpenXLSX::formula::errValue ()
XLCellValue OpenXLSX::formula::errDiv0 ()
XLCellValue OpenXLSX::formula::errNA ()
XLCellValue OpenXLSX::formula::errNum ()
XLCellValue OpenXLSX::formula::errRef ()
XLCellValue OpenXLSX::formula::errName ()
XLCellValue OpenXLSX::formula::errCirc ()
std::string OpenXLSX::formula::strTrim (std::string s)
bool OpenXLSX::formula::tryParseNumericString (std::string_view s, double &out)
 Parse a fully-numeric string (optional leading/trailing space) to double.
XLCellValue OpenXLSX::formula::coerceToNumber (const XLCellValue &v, bool blankAsZero=true)
 Excel-style scalar numeric coercion for math functions and arithmetic.
XLCellValue OpenXLSX::formula::coerceArgScalar (const XLFormulaArg &arg, bool blankAsZero=true)
 Coerce the first scalar of an argument (implicit intersection / top-left).
XLCellValue OpenXLSX::formula::firstError (const XLFormulaArg &arg)
 First error value found in argument cells (Excel left-to-right, top-to-bottom).
XLCellValue OpenXLSX::formula::firstError (const std::vector< XLFormulaArg > &args)
std::vector< double > OpenXLSX::formula::numerics (const std::vector< XLFormulaArg > &args)
std::vector< double > OpenXLSX::formula::numerics (const XLFormulaArg &arg)
std::vector< double > OpenXLSX::formula::numericsOrError (const std::vector< XLFormulaArg > &args, XLCellValue &outError)
 Like numerics(), but if any cell is an Error, sets outError and returns {}.
std::vector< double > OpenXLSX::formula::numericsOrError (const XLFormulaArg &arg, XLCellValue &outError)
void OpenXLSX::formula::setFormulaRandomSeed (uint64_t seed)
 Seed the formula RNG (thread-local engines reseed on next use).
void OpenXLSX::formula::clearFormulaRandomSeed ()
std::optional< uint64_t > OpenXLSX::formula::formulaRandomSeed ()
std::mt19937_64 & OpenXLSX::formula::formulaRng ()
double OpenXLSX::toDouble (const XLCellValue &v)
bool OpenXLSX::isNumeric (const XLCellValue &v)
bool OpenXLSX::isEmpty (const XLCellValue &v)
bool OpenXLSX::isError (const XLCellValue &v)
std::string OpenXLSX::toString (const XLCellValue &v)
XLCellValue OpenXLSX::makeError (std::string_view token)
XLCellValue OpenXLSX::errValue ()
XLCellValue OpenXLSX::errDiv0 ()
XLCellValue OpenXLSX::errNA ()
XLCellValue OpenXLSX::errNum ()
XLCellValue OpenXLSX::errRef ()
XLCellValue OpenXLSX::errName ()
XLCellValue OpenXLSX::errCirc ()
std::string OpenXLSX::strTrim (std::string s)
bool OpenXLSX::tryParseNumericString (std::string_view s, double &out)
 Parse a fully-numeric string (optional leading/trailing space) to double.
XLCellValue OpenXLSX::coerceToNumber (const XLCellValue &v, bool blankAsZero=true)
 Excel-style scalar numeric coercion for math functions and arithmetic.
XLCellValue OpenXLSX::coerceArgScalar (const XLFormulaArg &arg, bool blankAsZero=true)
 Coerce the first scalar of an argument (implicit intersection / top-left).
XLCellValue OpenXLSX::firstError (const XLFormulaArg &arg)
 First error value found in argument cells (Excel left-to-right, top-to-bottom).
std::vector< double > OpenXLSX::numerics (const std::vector< XLFormulaArg > &args)
std::vector< double > OpenXLSX::numericsOrError (const std::vector< XLFormulaArg > &args, XLCellValue &outError)
 Like numerics(), but if any cell is an Error, sets outError and returns {}.
void OpenXLSX::setFormulaRandomSeed (uint64_t seed)
 Seed the formula RNG (thread-local engines reseed on next use).
void OpenXLSX::clearFormulaRandomSeed ()
std::optional< uint64_t > OpenXLSX::formulaRandomSeed ()
std::mt19937_64 & OpenXLSX::formulaRng ()

Detailed Description

Shared conversion and error helpers for the formula evaluation pipeline.

Grouped under OpenXLSX::formula to keep the top-level namespace clean. Compatibility using-declarations re-export symbols into OpenXLSX so existing function implementations (XLFormulaMath, XLFormulaLogical, …) continue to compile unchanged.