formula_token

Defined in header: <ixion/formula_tokens.hpp>

struct formula_token

Represents a single formula token.

Public Types

using value_type = std::variant<address_t, range_t, table_t, formula_error_t, formula_function_t, double, string_id_t, std::string_view, 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(formula_error_t err)

Constructor for a formula error token. The opcode will be implicitly set to fop_error.

Parameters:

err – error token 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(std::string_view s)

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

Parameters:

s – string value to be stored in the token. The caller is responsible for ensuring its bytes outlive the token (e.g. interning through model_context::intern_string).

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

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.