Interfaces¶
-
class
formula_model_access
¶ Interface for allowing access to the model mostly from ixion’s formula interpreter and its related classes. The client code needs to provide concrete implementation of this interface in order to provide access to its content.
Subclassed by ixion::model_context
Public Functions
-
formula_model_access
()¶
-
virtual
~formula_model_access
()¶
-
virtual const config &
get_config
() const = 0¶
-
virtual dirty_cell_tracker &
get_cell_tracker
() = 0¶
-
virtual const dirty_cell_tracker &
get_cell_tracker
() const = 0¶
-
virtual bool
is_empty
(const abs_address_t &addr) const = 0¶
-
virtual celltype_t
get_celltype
(const abs_address_t &addr) const = 0¶
-
virtual double
get_numeric_value
(const abs_address_t &addr) const = 0¶ Get a numeric representation of the cell value at specified position. If the cell at the specified position is a formula cell and its result has not yet been computed, it will block until the result becomes available. Call this only during formula (re-)calculation.
- Return
- numeric representation of the cell value.
- Parameters
addr
: position of the cell.
-
virtual bool
get_boolean_value
(const abs_address_t &addr) const = 0¶
-
virtual string_id_t
get_string_identifier
(const abs_address_t &addr) const = 0¶
-
virtual string_id_t
get_string_identifier
(const char *p, size_t n) const = 0¶
-
virtual const formula_cell *
get_formula_cell
(const abs_address_t &addr) const = 0¶
-
virtual formula_cell *
get_formula_cell
(const abs_address_t &addr) = 0¶
-
virtual const formula_tokens_t *
get_named_expression
(sheet_t sheet, const std::string &name) const = 0¶ Get a named expression token set associated with specified name if present. It first searches the local sheet scope for the name, then if it’s not present, it searches the global scope.
- Return
- const pointer to the token set if exists, nullptr otherwise.
- Parameters
sheet
: index of the sheet scope to search in.name
: name of the expression.
-
virtual double
count_range
(const abs_range_t &range, const values_t &values_type) const = 0¶
-
virtual matrix
get_range_value
(const abs_range_t &range) const = 0¶ Obtain range value in matrix form. Multi-sheet ranges are not supported. If the specified range consists of multiple sheets, it throws an exception.
- Return
- range value represented as matrix.
- Parameters
range
: absolute, single-sheet range address. Multi-sheet ranges are not allowed.
-
virtual std::unique_ptr<session_handler>
create_session_handler
()¶ Session handler instance receives various events from the formula interpretation run, in order to respond to those events. This is optional; the model context implementation is not required to provide a handler.
- Return
- a new session handler instance. It may be nullptr.
-
virtual table_handler *
get_table_handler
()¶ Table interface provides access to all table ranges stored in the document model. A table is a 2-dimensional range of cells that include named columns. It is used when resolving a table reference that refers to a cell or a range of cells by the table name and/or column name.
- Return
- non-NULL pointer to the table storage inside the model, or NULL if no table is present or supported by the model implementation.
-
virtual const table_handler *
get_table_handler
() const¶
-
virtual string_id_t
append_string
(const char *p, size_t n) = 0¶
-
virtual string_id_t
add_string
(const char *p, size_t n) = 0¶
-
virtual const std::string *
get_string
(string_id_t identifier) const = 0¶
-
virtual sheet_t
get_sheet_index
(const char *p, size_t n) const = 0¶ Get the index of sheet from sheet name.
- Return
- sheet index
- Parameters
p
: pointer to the first character of the sheet name string.n
: length of the sheet name string.
-
virtual std::string
get_sheet_name
(sheet_t sheet) const = 0¶
-
virtual rc_size_t
get_sheet_size
(sheet_t sheet) const = 0¶ Get the size of specified sheet.
- Return
- size of the sheet.
- Parameters
sheet
: sheet index.
-
virtual size_t
get_sheet_count
() const = 0¶ Return the number of sheets.
- Return
- number of sheets.
-
-
class
session_handler
¶ Public Functions
-
virtual
~session_handler
()¶
-
virtual void
begin_cell_interpret
(const abs_address_t &pos) = 0¶
-
virtual void
end_cell_interpret
() = 0¶
-
virtual void
set_result
(const formula_result &result) = 0¶
-
virtual void
set_invalid_expression
(const char *msg) = 0¶
-
virtual void
set_formula_error
(const char *msg) = 0¶
-
virtual void
push_token
(fopcode_t fop) = 0¶
-
virtual void
push_value
(double val) = 0¶
-
virtual void
push_string
(size_t sid) = 0¶
-
virtual void
push_single_ref
(const address_t &addr, const abs_address_t &pos) = 0¶
-
virtual void
push_range_ref
(const range_t &range, const abs_address_t &pos) = 0¶
-
virtual void
push_table_ref
(const table_t &table) = 0¶
-
virtual void
push_function
(formula_function_t foc) = 0¶
-
virtual
-
class
table_handler
¶ Public Functions
-
virtual
~table_handler
()¶
-
virtual abs_range_t
get_range
(const abs_address_t &pos, string_id_t column_first, string_id_t column_last, table_areas_t areas) const = 0¶ Get the data range associated with a given column name. The current position is used to infer which table to use.
- Return
- referenced data range.
- Parameters
pos
: current cell position.column_first
: name of the starting column within the table.column_last
: name of the ending column within the table, or empty_string_id if it’s a single column.areas
: area specifiter value, which may consist of one or more values of table_area_t.
-
virtual abs_range_t
get_range
(string_id_t table, string_id_t column_first, string_id_t column_last, table_areas_t areas) const = 0¶ Get the data range associated with given table and column names.
- Return
- referenced data range.
- Parameters
table
: string identifier representing the table name.column_first
: name of the starting column within the table.column_last
: name of the ending column within the table, or empty_string_id if it’s a single column.areas
: area specifiter value, which may consist of one or more values of table_area_t.
-
virtual