umya_spreadsheet/structs/
font_char_set.rs1use super::Int32Value;
3use crate::reader::driver::*;
4use crate::writer::driver::*;
5use quick_xml::events::BytesStart;
6use quick_xml::Reader;
7use quick_xml::Writer;
8use std::io::Cursor;
9
10#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd)]
11pub struct FontCharSet {
12 pub(crate) val: Int32Value,
13}
14
15impl FontCharSet {
16 #[inline]
17 pub fn get_val(&self) -> &i32 {
18 self.val.get_value()
19 }
20
21 #[inline]
22 pub fn set_val(&mut self, value: i32) -> &mut Self {
23 self.val.set_value(value);
24 self
25 }
26
27 #[inline]
28 pub(crate) fn set_attributes<R: std::io::BufRead>(
29 &mut self,
30 _reader: &mut Reader<R>,
31 e: &BytesStart,
32 ) {
33 set_string_from_xml!(self, e, val, "val");
34 }
35
36 #[inline]
37 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
38 if self.val.has_value() {
40 let mut attributes: Vec<(&str, &str)> = Vec::new();
41 let val = self.val.get_value_string();
42 attributes.push(("val", &val));
43 write_start_tag(writer, "charset", attributes, true);
44 }
45 }
46}