Formula Tokens

struct formula_token

Represents a single formula token.

Public Types

using value_type = std::variant<address_t, range_t, table_t, formula_function_t, double, string_id_t, std::string>

Public Functions

formula_token() = delete
formula_token(fopcode_t op)

Constructor for opcode-only token.

Parameters:

op – formula opcode.

formula_token(const address_t &addr)

Constructor for a single-cell reference token. The opcode will be implicitly set to fop_single_ref.

Parameters:

addr – single-cell reference.

formula_token(const range_t &range)

Constructor for a range reference token. The opcode will be implicitly set to fop_range_ref.

Parameters:

range – range reference.

formula_token(const table_t &table)

Constructor for a table reference token. The opcode will be implicitly set to fop_table_ref.

Parameters:

table – table reference.

formula_token(formula_function_t func)

Constructor for a formula function token. The opcode will be implicitly set to fop_function.

Parameters:

func – function name enum value.

formula_token(double v)

Constructor for a numeric value token. The opcode will be implicitly set to fop_value.

Parameters:

v – numeric value to be stored in the token.

formula_token(string_id_t sid)

Constructor for a string value token. The opcode will be implicitly set to fop_string.

Parameters:

sid – string ID to be stored in the token.

formula_token(std::string name)

Constructor for a named-expression token. The opcode will be implicitly set to fop_named_expression.

Parameters:

name – named expression to be stored in the token.

formula_token(const formula_token &r)

Copy constructor.

formula_token(formula_token &&r)

Move constructor.

Note

This will be the same as the copy constructor if the stored value is not movable.

~formula_token()
bool operator==(const formula_token &r) const
bool operator!=(const formula_token &r) const

Public Members

const fopcode_t opcode

Opcode that specifies the type of token. The value of this data member should not be modified after construction.

value_type value

Value stored in the token. The type of this value varies depending on the token opcode value.

class formula_tokens_store

Storage for a series of formula tokens.

Public Functions

~formula_tokens_store()
formula_tokens_store(const formula_tokens_store&) = delete
formula_tokens_store &operator=(const formula_tokens_store&) = delete
size_t get_reference_count() const
formula_tokens_t &get()
const formula_tokens_t &get() const

Public Static Functions

static formula_tokens_store_ptr_t create()
struct named_expression_t

Represents a named expression which stores a series of formula tokens.

Public Functions

named_expression_t()
named_expression_t(const abs_address_t &_origin, formula_tokens_t _tokens)
named_expression_t(const named_expression_t&) = delete
named_expression_t(named_expression_t &&other)
~named_expression_t()

Public Members

abs_address_t origin

Origin cell position which affects any relative references stored in the named expression.

formula_tokens_t tokens

Formula tokens.

Utility Functions

std::string_view ixion::get_opcode_name(fopcode_t oc)

Get a printable name for a formula opcode. The printable name is to be used only for informational purposes.

Parameters:

oc – formula opcode

Returns:

printable name for a formula opcode.

std::string_view ixion::get_formula_opcode_string(fopcode_t oc)

Get the string representation of a simple formula opcode. This function will return a non-empty string only for operator opcodes.

Parameters:

oc – formula opcode

Returns:

string representation of a formula opcode.