The XLFormula class encapsulates the concept of an Excel formula. The class is essentially a wrapper around a std::string.
More...
#include <XLFormula.hpp>
|
| | XLFormula () |
| | Constructor.
|
| |
| template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>> |
| | XLFormula (T formula) |
| | Constructor, taking a string-type argument.
|
| |
| | XLFormula (const XLFormula &other) |
| | Copy constructor.
|
| |
| | XLFormula (XLFormula &&other) noexcept |
| | Move constructor.
|
| |
| | ~XLFormula () |
| | Destructor.
|
| |
| XLFormula & | operator= (const XLFormula &other) |
| | Copy assignment operator.
|
| |
| XLFormula & | operator= (XLFormula &&other) noexcept |
| | Move assignment operator.
|
| |
| template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>> |
| XLFormula & | operator= (T formula) |
| | Templated assignment operator, taking a string-type object as an argument.
|
| |
| template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>> |
| void | set (T formula) |
| | Templated setter function, taking a string-type object as an argument.
|
| |
| std::string | get () const |
| | Get the formula as a std::string.
|
| |
| | operator std::string () const |
| | Conversion operator, for converting object to a std::string.
|
| |
| XLFormula & | clear () |
| | Clear the formula.
|
| |
The XLFormula class encapsulates the concept of an Excel formula. The class is essentially a wrapper around a std::string.
- Warning
- This class currently only supports simple formulas. Array formulas and shared formulas are not supported. Unfortunately, many spreadsheets have shared formulas, so this class is probably best used for adding formulas, not reading them from an existing spreadsheet.
- Todo:
- Enable handling of shared and array formulas.
◆ XLFormula() [1/4]
Constructor.
Constructor. Default implementation.
◆ XLFormula() [2/4]
template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>>
| OpenXLSX::XLFormula::XLFormula |
( |
T |
formula | ) |
|
|
inlineexplicit |
Constructor, taking a string-type argument.
- Template Parameters
-
| T | Type of argument used. Must be string-type. |
- Parameters
-
| formula | The formula to initialize the object with. |
◆ XLFormula() [3/4]
| XLFormula::XLFormula |
( |
const XLFormula & |
other | ) |
|
|
default |
Copy constructor.
- Parameters
-
| other | Object to be copied. |
Copy constructor. Default implementation.
◆ XLFormula() [4/4]
Move constructor.
- Parameters
-
Move constructor. Default implementation.
◆ ~XLFormula()
| XLFormula::~XLFormula |
( |
| ) |
|
|
default |
Destructor.
Destructor. Default implementation.
◆ clear()
Clear the formula.
- Returns
- Return a reference to the cleared object.
Set the m_formulaString member to an empty string.
◆ get()
| std::string XLFormula::get |
( |
| ) |
const |
Get the formula as a std::string.
- Returns
- A std::string with the formula.
Return the m_formulaString member variable.
◆ operator std::string()
| XLFormula::operator std::string |
( |
| ) |
const |
Conversion operator, for converting object to a std::string.
- Returns
- The formula as a std::string.
◆ operator=() [1/3]
Copy assignment operator.
- Parameters
-
| other | Object to be copied. |
- Returns
- Reference to copied-to object.
Copy assignment operator. Default implementation.
◆ operator=() [2/3]
template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>>
| XLFormula & OpenXLSX::XLFormula::operator= |
( |
T |
formula | ) |
|
|
inline |
Templated assignment operator, taking a string-type object as an argument.
- Template Parameters
-
| T | Type of argument (only string-types are allowed). |
- Parameters
-
| formula | String containing the formula. |
- Returns
- Reference to the assigned-to object.
◆ operator=() [3/3]
Move assignment operator.
- Parameters
-
- Returns
- Reference to moved-to object.
Move assignment operator. Default implementation.
◆ set()
template<typename T , typename = std::enable_if_t<std::is_same_v<std::decay_t<T>, std::string> or std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> or std::is_same_v<std::decay_t<T>, char*>>>
| void OpenXLSX::XLFormula::set |
( |
T |
formula | ) |
|
|
inline |
Templated setter function, taking a string-type object as an argument.
- Template Parameters
-
| T | Type of argument (only string-types are allowed). |
- Parameters
-
| formula | String containing the formula. |
◆ operator!=
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const XLFormula & |
value |
|
) |
| |
|
friend |
send a formula string to an ostream
- Parameters
-
| os | the output destination |
| value | the formula to send to os |
- Returns
◆ operator==
The documentation for this class was generated from the following files:
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/headers/XLFormula.hpp
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/sources/XLFormula.cpp