Formula Name Resolver¶
-
class
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
(std::string_view s, const abs_address_t &pos) const = 0¶ Parse and resolve a reference string.
- Return
- result of the resovled reference.
- Parameters
s
: reference string to be parsed.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.
-
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¶
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.
- Return
- formula name resolver instance created on the heap. The caller is responsible for managing its life cycle.
- 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.
-
-
struct
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:
-
invalid
= 0¶
-
cell_reference
¶
-
range_reference
¶
-
table_reference
¶
-
named_expression
¶
-
function
¶
-
-
using
value_type
= std::variant<address_t, range_t, table_type, formula_function_t>¶
Public Functions
-
formula_name_t
()¶
-
std::string
to_string
() const¶ Return a string that represents the data stored internally. Useful for debugging.
-
struct
table_type
¶ Table information for a table reference name. Unlike the ixion::table_t counterpart, we store strings as string views as the resolver doesn’t have access to the string pool.
Public Members
-
std::string_view
name
¶
-
std::string_view
column_first
¶
-
std::string_view
column_last
¶
-
table_areas_t
areas
¶
-
std::string_view