shapes_converter/shex_to_uml/
name.rs

1#[derive(Debug, PartialEq, Eq, Default, Clone, Hash)]
2pub struct Name {
3    str: String,
4    href: Option<String>,
5    local_href: Option<String>,
6    label: Option<String>,
7}
8
9impl Name {
10    pub fn new(str: &str, href: Option<&str>) -> Name {
11        Name {
12            str: str.to_string(),
13            href: href.map(|c| c.to_string()),
14            local_href: None,
15            label: None,
16        }
17    }
18
19    pub fn name(&self) -> String {
20        self.str.clone()
21    }
22
23    pub fn href(&self) -> Option<String> {
24        self.href.clone()
25    }
26
27    pub fn local_href(&self) -> Option<String> {
28        self.local_href.clone()
29    }
30
31    pub fn label(&self) -> Option<String> {
32        self.label.clone()
33    }
34
35    pub fn add_href(&mut self, href: &str) {
36        self.href = Some(href.to_string());
37    }
38
39    pub fn add_local_href(&mut self, local_href: &str) {
40        self.local_href = Some(local_href.to_string());
41    }
42
43    pub fn add_label(&mut self, label: &str) {
44        self.label = Some(label.to_string());
45    }
46}