ifc_classification/document/
information.rs1use crate::view::{
3 borrowed_entity, optional_enum, optional_ref, optional_refs, optional_text, required_text,
4 ClassificationView,
5};
6use crate::ClassificationResult;
7borrowed_entity!(DocumentInformation, "IFCDOCUMENTINFORMATION");
8impl<'m> DocumentInformation<'m> {
9 pub fn identification(self) -> ClassificationResult<&'m str> {
11 required_text(
12 "IFCDOCUMENTINFORMATION",
13 self.id(),
14 self.entity(),
15 self.text_slot("Identification")?,
16 "Identification",
17 )
18 }
19 pub fn name(self) -> ClassificationResult<&'m str> {
21 required_text(
22 "IFCDOCUMENTINFORMATION",
23 self.id(),
24 self.entity(),
25 self.text_slot("Name")?,
26 "Name",
27 )
28 }
29 pub fn description(self) -> ClassificationResult<Option<&'m str>> {
31 optional_text(
32 "IFCDOCUMENTINFORMATION",
33 self.id(),
34 self.entity(),
35 self.text_slot("Description")?,
36 "Description",
37 )
38 }
39 pub fn location(self) -> ClassificationResult<Option<&'m str>> {
41 optional_text(
42 "IFCDOCUMENTINFORMATION",
43 self.id(),
44 self.entity(),
45 self.text_slot("Location")?,
46 "Location",
47 )
48 }
49 pub fn purpose(self) -> ClassificationResult<Option<&'m str>> {
51 optional_text(
52 "IFCDOCUMENTINFORMATION",
53 self.id(),
54 self.entity(),
55 self.text_slot("Purpose")?,
56 "Purpose",
57 )
58 }
59 pub fn intended_use(self) -> ClassificationResult<Option<&'m str>> {
61 optional_text(
62 "IFCDOCUMENTINFORMATION",
63 self.id(),
64 self.entity(),
65 self.text_slot("IntendedUse")?,
66 "IntendedUse",
67 )
68 }
69 pub fn scope(self) -> ClassificationResult<Option<&'m str>> {
71 optional_text(
72 "IFCDOCUMENTINFORMATION",
73 self.id(),
74 self.entity(),
75 self.text_slot("Scope")?,
76 "Scope",
77 )
78 }
79 pub fn revision(self) -> ClassificationResult<Option<&'m str>> {
81 optional_text(
82 "IFCDOCUMENTINFORMATION",
83 self.id(),
84 self.entity(),
85 self.text_slot("Revision")?,
86 "Revision",
87 )
88 }
89 pub fn document_owner_id(self) -> ClassificationResult<Option<ifc_model::EntityId>> {
91 optional_ref(
92 "IFCDOCUMENTINFORMATION",
93 self.id(),
94 self.entity(),
95 self.slot("DocumentOwner")?,
96 "DocumentOwner",
97 )
98 }
99 pub fn editors(self) -> ClassificationResult<Option<Vec<ifc_model::EntityId>>> {
101 optional_refs(
102 "IFCDOCUMENTINFORMATION",
103 self.id(),
104 self.entity(),
105 self.slot("Editors")?,
106 "Editors",
107 )
108 }
109 pub fn creation_time(self) -> ClassificationResult<Option<&'m str>> {
111 optional_text(
112 "IFCDOCUMENTINFORMATION",
113 self.id(),
114 self.entity(),
115 self.text_slot("CreationTime")?,
116 "CreationTime",
117 )
118 }
119 pub fn last_revision_time(self) -> ClassificationResult<Option<&'m str>> {
121 optional_text(
122 "IFCDOCUMENTINFORMATION",
123 self.id(),
124 self.entity(),
125 self.text_slot("LastRevisionTime")?,
126 "LastRevisionTime",
127 )
128 }
129 pub fn electronic_format(self) -> ClassificationResult<Option<&'m str>> {
131 optional_text(
132 "IFCDOCUMENTINFORMATION",
133 self.id(),
134 self.entity(),
135 self.text_slot("ElectronicFormat")?,
136 "ElectronicFormat",
137 )
138 }
139 pub fn valid_from(self) -> ClassificationResult<Option<&'m str>> {
141 optional_text(
142 "IFCDOCUMENTINFORMATION",
143 self.id(),
144 self.entity(),
145 self.text_slot("ValidFrom")?,
146 "ValidFrom",
147 )
148 }
149 pub fn valid_until(self) -> ClassificationResult<Option<&'m str>> {
151 optional_text(
152 "IFCDOCUMENTINFORMATION",
153 self.id(),
154 self.entity(),
155 self.text_slot("ValidUntil")?,
156 "ValidUntil",
157 )
158 }
159 pub fn confidentiality(self) -> ClassificationResult<Option<&'m str>> {
161 optional_enum(
162 "IFCDOCUMENTINFORMATION",
163 self.id(),
164 self.entity(),
165 self.slot("Confidentiality")?,
166 "Confidentiality",
167 &[
168 "PUBLIC",
169 "RESTRICTED",
170 "CONFIDENTIAL",
171 "PERSONAL",
172 "USERDEFINED",
173 "NOTDEFINED",
174 ],
175 )
176 }
177 pub fn status(self) -> ClassificationResult<Option<&'m str>> {
179 optional_enum(
180 "IFCDOCUMENTINFORMATION",
181 self.id(),
182 self.entity(),
183 self.slot("Status")?,
184 "Status",
185 &["DRAFT", "FINAL", "REVISION", "NOTDEFINED"],
186 )
187 }
188}
189impl<'m> ClassificationView<'m> {
190 pub fn documents(self) -> impl Iterator<Item = DocumentInformation<'m>> + 'm {
192 self.model()
193 .of_type("IFCDOCUMENTINFORMATION")
194 .map(move |(id, e)| DocumentInformation::from_known(id, e, self.release()))
195 }
196}