HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Functions
spreadsheet_address.hpp File Reference

The functions in this file are for handling spreadsheet addresses. More...

#include "../strings.hpp"
#include "../check.hpp"
#include <tuple>
#include <string_view>

Go to the source code of this file.

Functions

std::tuple< bool, size_t, bool, size_t > tt::_parse_spreadsheet_address (std::string_view &address)
 
std::pair< size_t, size_t > tt::parse_spreadsheet_address (std::string_view address, size_t start_column_nr=0, size_t start_row_nr=0)
 Parse a spreadsheet address.
 
std::tuple< size_t, size_t, size_t, size_t > tt::parse_spreadsheet_range (std::string_view address, size_t start_column_nr=0, size_t start_row_nr=0)
 

Detailed Description

The functions in this file are for handling spreadsheet addresses.

Spreadsheet addresses are of the form:

address_range := address ':' address;
address := '$'? column '$'? row;
column := [A-Z]+;
row := [0-9]+;

Columns start at 'A' for the left most column. After 'Z' follows 'AA' then 'AB'.

Rows start at '1' for the top most row.

A column or row that is prefixed with '$' is absolute, instead of relative.

Function Documentation

◆ parse_spreadsheet_address()

std::pair< size_t, size_t > tt::parse_spreadsheet_address ( std::string_view address,
size_t start_column_nr = 0,
size_t start_row_nr = 0 )
inline

Parse a spreadsheet address.

Parameters
addressThe address to parse.
start_column_nrA relative column in the address is added to the start-column.
start_row_nrA relative row in the address is added to the start-row.
Returns
The zero-based column and row index.