Skip to main content

ironcalc_base/expressions/
types.rs

1use serde::{Deserialize, Serialize};
2
3// $A$34
4#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
5pub struct ParsedReference {
6    pub column: i32,
7    pub row: i32,
8    pub absolute_column: bool,
9    pub absolute_row: bool,
10}
11
12/// If right is None it is just a reference
13/// Column ranges like D:D will have `absolute_row=true` and `left.row=1` and `right.row=LAST_ROW`
14/// Row ranges like 5:5 will have `absolute_column=true` and `left.column=1` and `right.column=LAST_COLUMN`
15pub struct ParsedRange {
16    pub left: ParsedReference,
17    pub right: Option<ParsedReference>,
18}
19
20// FIXME: It does not make sense to have two different structures.
21// We should have a single one CellReferenceNamed or something like that.
22// Sheet1!C3
23pub struct CellReference {
24    pub sheet: String,
25    pub column: String,
26    pub row: String,
27}
28
29// Sheet1!C3 -> CellReferenceRC{Sheet1, 3, 3}
30#[derive(Clone)]
31pub struct CellReferenceRC {
32    pub sheet: String,
33    pub column: i32,
34    pub row: i32,
35}
36
37#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Copy, Hash)]
38pub struct CellReferenceIndex {
39    pub sheet: u32,
40    pub column: i32,
41    pub row: i32,
42}
43
44#[derive(Serialize, Deserialize)]
45pub struct Area {
46    pub sheet: u32,
47    pub row: i32,
48    pub column: i32,
49    pub width: i32,
50    pub height: i32,
51}