abs_range_t

Defined in header: <ixion/address.hpp>

struct abs_range_t

Stores absolute range address.

Public Types

enum init_invalid

Tag type for constructing an invalid range.

Values:

enumerator invalid

Public Functions

abs_range_t()

Construct a range covering the top-left cell of the first sheet.

abs_range_t(init_invalid)

Construct an invalid range, with both positions invalid.

abs_range_t(sheet_t _sheet, row_t _row, col_t _col)

Construct a range covering a single cell.

abs_range_t(sheet_t _sheet, row_t _row, col_t _col, row_t _row_span, col_t _col_span)

Construct a range from its top-left cell and its size.

Parameters:
  • _sheet – 0-based sheet index.

  • _row – 0-based row position of the top-left cell of the range.

  • _col – 0-based column position of the top-left cell of the range.

  • _row_span – row length of the range. It must be 1 or greater.

  • _col_span – column length of the range. It must be 1 or greater.

abs_range_t(const abs_address_t &addr)

Construct a range covering a single cell.

abs_range_t(const abs_address_t &addr, row_t row_span, col_t col_span)

Construct a range from its top-left cell and its size.

Parameters:
  • addr – Position of the top-left cell of the range.

  • row_span – Row length of the range. A value less than 1 counts as 1.

  • col_span – Column length of the range. A value less than 1 counts as 1.

abs_range_t(const abs_address_t &_first, const abs_address_t &_last)

Construct a range from its top-left and bottom-right cells.

Parameters:
  • _first – Position of the top-left cell of the range.

  • _last – Position of the bottom-right cell of the range. It must not precede the first position either row-wise or column-wise.

abs_range_t(sheet_t _sheet, const abs_rc_range_t &_range)

Construct a range from a sheet index and a range without a sheet.

Parameters:
  • _sheet – 0-based index of the sheet the range is on.

  • _range – Range on the sheet, without a sheet index of its own.

bool valid() const

Check whether the range is valid, that is, both positions are valid and the first position does not follow the last one in any direction.

void set_all_columns()

Expand the range horizontally to include all columns. The row range will remain unchanged.

void set_all_rows()

Expand the range vertically to include all rows. The column range will remain unchanged.

bool all_columns() const
Returns:

true if the range is unspecified in the horizontal direction i.e. all columns are selected, false otherwise.

bool all_rows() const
Returns:

true if the range is unspecified in the vertical direction i.e. all rows are selected, false otherwise.

bool contains(const abs_address_t &addr) const

Check whether or not a given address is contained within this range.

void reorder()

Reorder range values as needed to ensure the range is valid.

std::strong_ordering operator<=>(const abs_range_t &r) const

Order ranges by their first position, then their last position.

bool operator==(const abs_range_t &r) const

Compare both positions of two ranges.

Public Members

abs_address_t first

Position of the top-left cell of the range.

abs_address_t last

Position of the bottom-right cell of the range.

struct hash

Hash function for use in unordered containers.

Public Functions

size_t operator()(const abs_range_t &range) const

Compute the hash value of a range.