#include <formula.h>
Public Member Functions | |
| Formula (Sheet *sheet, Cell *cell=0) | |
| Formula () | |
| ~Formula () | |
| Sheet * | sheet () const |
| Cell * | cell () const |
| void | setExpression (const TQString &expr) |
| TQString | expression () const |
| void | clear () |
| bool | isValid () const |
| Tokens | tokens () const |
| Value | eval () const |
| Tokens | scan (const TQString &expr, TDELocale *locale=0) const |
| TQString | dump () const |
Protected Member Functions | |
| void | compile (const Tokens &tokens) const |
| bool | isNamedArea (const TQString &expr) const |
Detailed Description
Class Formula encapsulates a formula for a cell.
A Formula is a equations which perform calculations on values in the cells and sheets. Every formula must start with an equal sign (=).
Constructor & Destructor Documentation
◆ Formula() [1/2]
| Formula::Formula | ( | Sheet * | sheet, |
| Cell * | cell = 0 ) |
Creates a formula.
It must be owned by a sheet, and optionally sheet.
Definition at line 370 of file formula.cpp.
◆ Formula() [2/2]
| Formula::Formula | ( | ) |
Creates a formula that is not owned by any sheet.
This might be useful in some cases.
Definition at line 378 of file formula.cpp.
◆ ~Formula()
| Formula::~Formula | ( | ) |
Destroys the formula.
Definition at line 388 of file formula.cpp.
Member Function Documentation
◆ cell()
| Cell * Formula::cell | ( | ) | const |
Returns the cell which owns this formula.
Definition at line 393 of file formula.cpp.
◆ clear()
| void Formula::clear | ( | ) |
Clears everything, makes as like a newly constructed formula.
Definition at line 442 of file formula.cpp.
◆ compile()
|
protected |
Definition at line 833 of file formula.cpp.
◆ dump()
| TQString Formula::dump | ( | ) | const |
Definition at line 1472 of file formula.cpp.
◆ eval()
| Value Formula::eval | ( | ) | const |
Evaluates the formula and returns the result.
Definition at line 1172 of file formula.cpp.
◆ expression()
| TQString Formula::expression | ( | ) | const |
Gets the expression of this formula.
Definition at line 416 of file formula.cpp.
◆ isNamedArea()
|
protected |
helper function: return true for valid named area
Definition at line 1146 of file formula.cpp.
◆ isValid()
| bool Formula::isValid | ( | ) | const |
Returns true if the specified expression is valid, i.e.
it contains no parsing error. Empty formula (i.e. without expression) is always invalid.
Definition at line 424 of file formula.cpp.
◆ scan()
| Tokens Formula::scan | ( | const TQString & | expr, |
| TDELocale * | locale = 0 ) const |
Given an expression, this function separates it into tokens.
If the expression contains error (e.g. unknown operator, string no terminated) this function returns tokens which is not valid.
Definition at line 464 of file formula.cpp.
◆ setExpression()
| void Formula::setExpression | ( | const TQString & | expr | ) |
Sets the expression for this formula.
Definition at line 407 of file formula.cpp.
◆ sheet()
| Sheet * Formula::sheet | ( | ) | const |
Returns the cell which owns this formula.
Definition at line 398 of file formula.cpp.
◆ tokens()
| Tokens Formula::tokens | ( | ) | const |
Returns list of tokens associated with this formula.
This has nothing to with the formula evaluation but might be useful, e.g. for syntax highlight or similar features. If the formula contains error, the returned tokens is invalid.
Definition at line 456 of file formula.cpp.
The documentation for this class was generated from the following files:
