spreadsheet_ods_formula/
info.rs1pub use crate::generated::info::*;
6
7use crate::{Any, Criterion, FnNumberVar, Reference};
8use std::fmt::Write;
9
10#[derive(Debug)]
12pub enum CellInfo {
13 Address,
14 Col,
15 Colored,
16 Contents,
17 Filename,
18 Format,
19 Formula,
20 Parentheses,
21 Prefix,
22 Protect,
23 Row,
24 Sheet,
25 Type,
26 Width,
27}
28
29impl Any for CellInfo {
30 fn formula(&self, buf: &mut String) {
31 let _ = write!(
32 buf,
33 "{}",
34 match self {
35 CellInfo::Address => "ADDRESS",
36 CellInfo::Col => "COL",
37 CellInfo::Colored => "COLORED",
38 CellInfo::Contents => "CONTENTS",
39 CellInfo::Filename => "FILENAME",
40 CellInfo::Format => "FORMAT",
41 CellInfo::Formula => "FORMULA",
42 CellInfo::Parentheses => "PARENTHESES",
43 CellInfo::Prefix => "PREFIX",
44 CellInfo::Protect => "PROTECT",
45 CellInfo::Row => "ROW",
46 CellInfo::Sheet => "SHEET",
47 CellInfo::Type => "TYPE",
48 CellInfo::Width => "WIDTH",
49 }
50 );
51 }
52}
53
54#[derive(Debug)]
56pub enum InfoInfo {
57 Directory,
58 MemAvail,
59 MemUsed,
60 NumFile,
61 OSVersion,
62 Origin,
63 ReCalc,
64 Release,
65 System,
66 TotMem,
67}
68
69impl Any for InfoInfo {
70 fn formula(&self, buf: &mut String) {
71 let _ = write!(
72 buf,
73 "{}",
74 match self {
75 InfoInfo::Directory => "directory",
76 InfoInfo::MemAvail => "memavail",
77 InfoInfo::MemUsed => "memused",
78 InfoInfo::NumFile => "numfile",
79 InfoInfo::OSVersion => "osversion",
80 InfoInfo::Origin => "origin",
81 InfoInfo::ReCalc => "recalc",
82 InfoInfo::Release => "release",
83 InfoInfo::System => "system",
84 InfoInfo::TotMem => "totmem",
85 }
86 );
87 }
88}
89
90#[inline]
92pub fn countifs<R: Reference + 'static, C: Criterion + 'static, const N: usize>(
93 list: [(R, C); N],
94) -> FnNumberVar {
95 let mut param: Vec<Box<dyn Any>> = Vec::new();
96
97 for (r, c) in list {
98 param.push(Box::new(r));
99 param.push(Box::new(c));
100 }
101
102 FnNumberVar("COUNTIFS", param)
103}