spreadsheet_ods_formula/conv.rs
1//!
2//! Conversion functions.
3//!
4
5use crate::Any;
6
7pub use crate::generated::conv::*;
8
9/// Parameter for ROMAN().
10#[derive(Debug)]
11pub enum RomanStyle {
12 /// Only subtract powers of 10, not L or V, and only if the next
13 /// number is not more than 10 times greater. A number
14 /// following the larger one shall be smaller than the
15 /// subtracted number. Also known as classic.
16 Classic,
17 /// Powers of 10, and L and V may be subtracted, only if the
18 /// next number is not more than 10 times greater. A number
19 /// following the larger one shall be smaller than the subtracted number.
20 SubLXV,
21 /// Powers of 10 and L, but not V, may be subtracted, also if
22 /// the next number is more than 10 times greater. A number
23 /// following the larger one shall be smaller than the subtracted number.
24 SubLX,
25 /// Powers of 10, and L and V may be subtracted, also if the
26 /// next number is more than 10 times greater. A number following the larger
27 /// one shall be smaller than the subtracted number.
28 SubAllLXV,
29 /// Produce the fewest Roman digits possible. Also known as
30 /// simplified.
31 Simplified,
32}
33
34impl Any for RomanStyle {
35 fn formula(&self, buf: &mut String) {
36 buf.push_str(match self {
37 RomanStyle::Classic => "0",
38 RomanStyle::SubLXV => "1",
39 RomanStyle::SubLX => "2",
40 RomanStyle::SubAllLXV => "3",
41 RomanStyle::Simplified => "4",
42 });
43 }
44}