ifc_classification/document/
information.rs1use crate::view::{
4 borrowed_entity, optional_enum, optional_ref, optional_refs, optional_text, required_text,
5 ClassificationView,
6};
7use crate::ClassificationResult;
8borrowed_entity!(DocumentInformation, "IFCDOCUMENTINFORMATION");
9impl<'m> DocumentInformation<'m> {
10 pub fn identification(self) -> ClassificationResult<&'m str> {
12 required_text(
13 "IFCDOCUMENTINFORMATION",
14 self.id(),
15 self.entity(),
16 self.text_slot("Identification")?,
17 "Identification",
18 )
19 }
20 pub fn name(self) -> ClassificationResult<&'m str> {
22 required_text(
23 "IFCDOCUMENTINFORMATION",
24 self.id(),
25 self.entity(),
26 self.text_slot("Name")?,
27 "Name",
28 )
29 }
30 pub fn description(self) -> ClassificationResult<Option<&'m str>> {
32 optional_text(
33 "IFCDOCUMENTINFORMATION",
34 self.id(),
35 self.entity(),
36 self.text_slot("Description")?,
37 "Description",
38 )
39 }
40 pub fn location(self) -> ClassificationResult<Option<&'m str>> {
42 optional_text(
43 "IFCDOCUMENTINFORMATION",
44 self.id(),
45 self.entity(),
46 self.text_slot("Location")?,
47 "Location",
48 )
49 }
50 pub fn purpose(self) -> ClassificationResult<Option<&'m str>> {
52 optional_text(
53 "IFCDOCUMENTINFORMATION",
54 self.id(),
55 self.entity(),
56 self.text_slot("Purpose")?,
57 "Purpose",
58 )
59 }
60 pub fn intended_use(self) -> ClassificationResult<Option<&'m str>> {
62 optional_text(
63 "IFCDOCUMENTINFORMATION",
64 self.id(),
65 self.entity(),
66 self.text_slot("IntendedUse")?,
67 "IntendedUse",
68 )
69 }
70 pub fn scope(self) -> ClassificationResult<Option<&'m str>> {
72 optional_text(
73 "IFCDOCUMENTINFORMATION",
74 self.id(),
75 self.entity(),
76 self.text_slot("Scope")?,
77 "Scope",
78 )
79 }
80 pub fn revision(self) -> ClassificationResult<Option<&'m str>> {
82 optional_text(
83 "IFCDOCUMENTINFORMATION",
84 self.id(),
85 self.entity(),
86 self.text_slot("Revision")?,
87 "Revision",
88 )
89 }
90 pub fn document_owner_id(self) -> ClassificationResult<Option<ifc_model::EntityId>> {
92 optional_ref(
93 "IFCDOCUMENTINFORMATION",
94 self.id(),
95 self.entity(),
96 self.slot("DocumentOwner")?,
97 "DocumentOwner",
98 )
99 }
100 pub fn editors(self) -> ClassificationResult<Option<Vec<ifc_model::EntityId>>> {
102 optional_refs(
103 "IFCDOCUMENTINFORMATION",
104 self.id(),
105 self.entity(),
106 self.slot("Editors")?,
107 "Editors",
108 )
109 }
110 pub fn creation_time(self) -> ClassificationResult<Option<&'m str>> {
112 optional_text(
113 "IFCDOCUMENTINFORMATION",
114 self.id(),
115 self.entity(),
116 self.text_slot("CreationTime")?,
117 "CreationTime",
118 )
119 }
120 pub fn last_revision_time(self) -> ClassificationResult<Option<&'m str>> {
122 optional_text(
123 "IFCDOCUMENTINFORMATION",
124 self.id(),
125 self.entity(),
126 self.text_slot("LastRevisionTime")?,
127 "LastRevisionTime",
128 )
129 }
130 pub fn electronic_format(self) -> ClassificationResult<Option<&'m str>> {
132 optional_text(
133 "IFCDOCUMENTINFORMATION",
134 self.id(),
135 self.entity(),
136 self.text_slot("ElectronicFormat")?,
137 "ElectronicFormat",
138 )
139 }
140 pub fn valid_from(self) -> ClassificationResult<Option<&'m str>> {
142 optional_text(
143 "IFCDOCUMENTINFORMATION",
144 self.id(),
145 self.entity(),
146 self.text_slot("ValidFrom")?,
147 "ValidFrom",
148 )
149 }
150 pub fn valid_until(self) -> ClassificationResult<Option<&'m str>> {
152 optional_text(
153 "IFCDOCUMENTINFORMATION",
154 self.id(),
155 self.entity(),
156 self.text_slot("ValidUntil")?,
157 "ValidUntil",
158 )
159 }
160 pub fn confidentiality(self) -> ClassificationResult<Option<&'m str>> {
165 self.enumerated("Confidentiality")
166 }
167 pub fn status(self) -> ClassificationResult<Option<&'m str>> {
171 self.enumerated("Status")
172 }
173 fn enumerated(self, attribute: &'static str) -> ClassificationResult<Option<&'m str>> {
174 const ENTITY: &str = "IFCDOCUMENTINFORMATION";
175 let allowed = self.release().enumerators(ENTITY, self.id(), attribute)?;
176 optional_enum(
177 ENTITY,
178 self.id(),
179 self.entity(),
180 self.slot(attribute)?,
181 attribute,
182 &allowed,
183 )
184 }
185}
186impl<'m> ClassificationView<'m> {
187 pub fn documents(self) -> impl Iterator<Item = DocumentInformation<'m>> + 'm {
189 self.model()
190 .of_type("IFCDOCUMENTINFORMATION")
191 .map(move |(id, e)| DocumentInformation::from_known(id, e, self.release()))
192 }
193}