Skip to main content

ifc_classification/document/
information.rs

1//! Borrowed `IfcDocumentInformation` projection (IFC4 slots 0..16).
2use 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    /// The required `Identification` code of the document.
10    pub fn identification(self) -> ClassificationResult<&'m str> {
11        required_text(
12            "IFCDOCUMENTINFORMATION",
13            self.id(),
14            self.entity(),
15            0,
16            "Identification",
17        )
18    }
19    /// The required `Name` of the document.
20    pub fn name(self) -> ClassificationResult<&'m str> {
21        required_text(
22            "IFCDOCUMENTINFORMATION",
23            self.id(),
24            self.entity(),
25            1,
26            "Name",
27        )
28    }
29    /// The `Description` of the document, when authored.
30    pub fn description(self) -> ClassificationResult<Option<&'m str>> {
31        optional_text(
32            "IFCDOCUMENTINFORMATION",
33            self.id(),
34            self.entity(),
35            2,
36            "Description",
37        )
38    }
39    /// The `Location` (e.g. a URI) of the document, when authored.
40    pub fn location(self) -> ClassificationResult<Option<&'m str>> {
41        optional_text(
42            "IFCDOCUMENTINFORMATION",
43            self.id(),
44            self.entity(),
45            3,
46            "Location",
47        )
48    }
49    /// The `Purpose` the document serves, when authored.
50    pub fn purpose(self) -> ClassificationResult<Option<&'m str>> {
51        optional_text(
52            "IFCDOCUMENTINFORMATION",
53            self.id(),
54            self.entity(),
55            4,
56            "Purpose",
57        )
58    }
59    /// The `IntendedUse` of the document, when authored.
60    pub fn intended_use(self) -> ClassificationResult<Option<&'m str>> {
61        optional_text(
62            "IFCDOCUMENTINFORMATION",
63            self.id(),
64            self.entity(),
65            5,
66            "IntendedUse",
67        )
68    }
69    /// The `Scope` of the document, when authored.
70    pub fn scope(self) -> ClassificationResult<Option<&'m str>> {
71        optional_text(
72            "IFCDOCUMENTINFORMATION",
73            self.id(),
74            self.entity(),
75            6,
76            "Scope",
77        )
78    }
79    /// The `Revision` label of the document, when authored.
80    pub fn revision(self) -> ClassificationResult<Option<&'m str>> {
81        optional_text(
82            "IFCDOCUMENTINFORMATION",
83            self.id(),
84            self.entity(),
85            7,
86            "Revision",
87        )
88    }
89    /// Id of the `DocumentOwner` (an `IfcActorSelect`), when authored.
90    pub fn document_owner_id(self) -> ClassificationResult<Option<ifc_model::EntityId>> {
91        optional_ref(
92            "IFCDOCUMENTINFORMATION",
93            self.id(),
94            self.entity(),
95            8,
96            "DocumentOwner",
97        )
98    }
99    /// Ids of the `Editors` (`IfcActorSelect` members) who worked on the document, when authored.
100    pub fn editors(self) -> ClassificationResult<Option<Vec<ifc_model::EntityId>>> {
101        optional_refs(
102            "IFCDOCUMENTINFORMATION",
103            self.id(),
104            self.entity(),
105            9,
106            "Editors",
107        )
108    }
109    /// The `CreationTime` of the document, when authored.
110    pub fn creation_time(self) -> ClassificationResult<Option<&'m str>> {
111        optional_text(
112            "IFCDOCUMENTINFORMATION",
113            self.id(),
114            self.entity(),
115            10,
116            "CreationTime",
117        )
118    }
119    /// The `LastRevisionTime` of the document, when authored.
120    pub fn last_revision_time(self) -> ClassificationResult<Option<&'m str>> {
121        optional_text(
122            "IFCDOCUMENTINFORMATION",
123            self.id(),
124            self.entity(),
125            11,
126            "LastRevisionTime",
127        )
128    }
129    /// The `ElectronicFormat` (e.g. a MIME type) of the document, when authored.
130    pub fn electronic_format(self) -> ClassificationResult<Option<&'m str>> {
131        optional_text(
132            "IFCDOCUMENTINFORMATION",
133            self.id(),
134            self.entity(),
135            12,
136            "ElectronicFormat",
137        )
138    }
139    /// The `ValidFrom` date of the document, when authored.
140    pub fn valid_from(self) -> ClassificationResult<Option<&'m str>> {
141        optional_text(
142            "IFCDOCUMENTINFORMATION",
143            self.id(),
144            self.entity(),
145            13,
146            "ValidFrom",
147        )
148    }
149    /// The `ValidUntil` date of the document, when authored.
150    pub fn valid_until(self) -> ClassificationResult<Option<&'m str>> {
151        optional_text(
152            "IFCDOCUMENTINFORMATION",
153            self.id(),
154            self.entity(),
155            14,
156            "ValidUntil",
157        )
158    }
159    /// The `Confidentiality` enumerator of the document, when authored (`PUBLIC`, `RESTRICTED`, `CONFIDENTIAL`, `PERSONAL`, `USERDEFINED`, or `NOTDEFINED`).
160    pub fn confidentiality(self) -> ClassificationResult<Option<&'m str>> {
161        optional_enum(
162            "IFCDOCUMENTINFORMATION",
163            self.id(),
164            self.entity(),
165            15,
166            "Confidentiality",
167            &[
168                "PUBLIC",
169                "RESTRICTED",
170                "CONFIDENTIAL",
171                "PERSONAL",
172                "USERDEFINED",
173                "NOTDEFINED",
174            ],
175        )
176    }
177    /// The `Status` enumerator of the document, when authored (`DRAFT`, `FINAL`, `REVISION`, or `NOTDEFINED`).
178    pub fn status(self) -> ClassificationResult<Option<&'m str>> {
179        optional_enum(
180            "IFCDOCUMENTINFORMATION",
181            self.id(),
182            self.entity(),
183            16,
184            "Status",
185            &["DRAFT", "FINAL", "REVISION", "NOTDEFINED"],
186        )
187    }
188}
189impl<'m> ClassificationView<'m> {
190    /// All `IfcDocumentInformation` instances in the model.
191    pub fn documents(self) -> impl Iterator<Item = DocumentInformation<'m>> + 'm {
192        self.model()
193            .of_type("IFCDOCUMENTINFORMATION")
194            .map(|(id, e)| DocumentInformation::from_known(id, e))
195    }
196}