Formula Name Resolver

class ixion::formula_name_resolver

Formula name resolvers resolves a name in a formula expression to a more concrete name type.

Public Functions

formula_name_resolver()
virtual ~formula_name_resolver() = 0
virtual formula_name_t resolve(const char *p, size_t n, const abs_address_t &pos) const = 0

Parse and resolve a reference string.

Parameters
  • p – pointer to the buffer that stores the reference string to be parsed.

  • n – length of the buffer that stores the reference string.

  • pos – base cell position, which influences the resolved reference position(s) containing relative address(es). When the reference string does not contain an explicit sheet name, the sheet address of the base cell position is used.

Returns

result of the resovled reference.

virtual std::string get_name(const address_t &addr, const abs_address_t &pos, bool sheet_name) const = 0
virtual std::string get_name(const range_t &range, const abs_address_t &pos, bool sheet_name) const = 0
virtual std::string get_name(const table_t &table) const = 0
virtual std::string get_column_name(col_t col) const = 0

Given a numerical representation of column position, return its textural representation.

Parameters

col – numerical column position.

Returns

textural representation of column position.

Public Static Functions

static std::unique_ptr<formula_name_resolver> get(formula_name_resolver_t type, const iface::formula_model_access *cxt)

Create a formula name resolver instance according to the requested type.

Parameters
  • type – type formula name resolver being requested.

  • cxt – document model context for resolving sheet names, or nullptr in case names being resolved don’t contain sheet names.

Returns

formula name resolver instance created on the heap. The caller is responsible for managing its life cycle.

struct ixion::formula_name_t

Structure that represents the type of a ‘name’ in a formula expression.

A name can be either one of:

  • cell reference

  • range reference

  • table reference

  • named expression

  • function

Public Types

enum name_type

Values:

enumerator invalid
enumerator cell_reference
enumerator range_reference
enumerator table_reference
enumerator named_expression
enumerator function

Public Functions

formula_name_t()
std::string to_string() const

Return a string that represents the data stored internally. Useful for debugging.

Public Members

name_type type
address_type address
range_type range
table_type table
formula_function_t func_oc
union ixion::formula_name_t::[anonymous] [anonymous]
struct address_type

Single cell address information for a cell reference name.

Public Members

sheet_t sheet
row_t row
col_t col
bool abs_sheet
bool abs_row
bool abs_col
struct range_type

Range address information for a range reference name.

Public Members

address_type first
address_type last
struct table_type

Table information for a table reference name.

Public Members

const char *name
size_t name_length
const char *column_first
size_t column_first_length
const char *column_last
size_t column_last_length
table_areas_t areas
address_t ixion::to_address(const formula_name_t::address_type &src)
range_t ixion::to_range(const formula_name_t::range_type &src)