Skip to main content

umya_spreadsheet/structs/
font_family_numbering.rs

1// family
2use std::io::Cursor;
3
4use quick_xml::{
5    Reader,
6    Writer,
7    events::BytesStart,
8};
9
10use super::Int32Value;
11use crate::{
12    reader::driver::{
13        get_attribute,
14        set_string_from_xml,
15    },
16    writer::driver::write_start_tag,
17};
18
19#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd)]
20pub struct FontFamilyNumbering {
21    pub(crate) val: Int32Value,
22}
23
24impl FontFamilyNumbering {
25    #[inline]
26    #[must_use]
27    pub fn val(&self) -> i32 {
28        self.val.value()
29    }
30
31    #[inline]
32    #[must_use]
33    #[deprecated(since = "3.0.0", note = "Use val()")]
34    pub fn get_val(&self) -> i32 {
35        self.val()
36    }
37
38    #[inline]
39    pub fn set_val(&mut self, value: i32) -> &mut Self {
40        self.val.set_value(value);
41        self
42    }
43
44    #[inline]
45    pub(crate) fn set_attributes<R: std::io::BufRead>(
46        &mut self,
47        _reader: &mut Reader<R>,
48        e: &BytesStart,
49    ) {
50        set_string_from_xml!(self, e, val, "val");
51    }
52
53    #[inline]
54    pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
55        // family
56        if self.val.has_value() {
57            write_start_tag(
58                writer,
59                "family",
60                vec![("val", self.val.value_string()).into()],
61                true,
62            );
63        }
64    }
65}