Skip to main content

ifc_classification/classification/
system.rs

1//! Borrowed `IfcClassification` projection (IFC4 slots 0..6).
2use crate::view::{
3    borrowed_entity, optional_text, optional_texts, required_text, ClassificationView,
4};
5use crate::ClassificationResult;
6borrowed_entity!(ClassificationSystem, "IFCCLASSIFICATION");
7impl<'m> ClassificationSystem<'m> {
8    /// The `Source` (organization) that publishes this classification system, when authored.
9    pub fn source(self) -> ClassificationResult<Option<&'m str>> {
10        optional_text("IFCCLASSIFICATION", self.id(), self.entity(), 0, "Source")
11    }
12    /// The `Edition` label of this classification system, when authored.
13    pub fn edition(self) -> ClassificationResult<Option<&'m str>> {
14        optional_text("IFCCLASSIFICATION", self.id(), self.entity(), 1, "Edition")
15    }
16    /// The `EditionDate` of this classification system, when authored.
17    pub fn edition_date(self) -> ClassificationResult<Option<&'m str>> {
18        optional_text(
19            "IFCCLASSIFICATION",
20            self.id(),
21            self.entity(),
22            2,
23            "EditionDate",
24        )
25    }
26    /// The required `Name` of this classification system.
27    pub fn name(self) -> ClassificationResult<&'m str> {
28        required_text("IFCCLASSIFICATION", self.id(), self.entity(), 3, "Name")
29    }
30    /// The `Description` of this classification system, when authored.
31    pub fn description(self) -> ClassificationResult<Option<&'m str>> {
32        optional_text(
33            "IFCCLASSIFICATION",
34            self.id(),
35            self.entity(),
36            4,
37            "Description",
38        )
39    }
40    /// The `Location` (e.g. a URI) of this classification system, when authored.
41    pub fn location(self) -> ClassificationResult<Option<&'m str>> {
42        optional_text("IFCCLASSIFICATION", self.id(), self.entity(), 5, "Location")
43    }
44    /// The `ReferenceTokens` used to compose classification identifications, when authored.
45    pub fn reference_tokens(self) -> ClassificationResult<Option<Vec<&'m str>>> {
46        optional_texts(
47            "IFCCLASSIFICATION",
48            self.id(),
49            self.entity(),
50            6,
51            "ReferenceTokens",
52        )
53    }
54}
55impl<'m> ClassificationView<'m> {
56    /// All `IfcClassification` instances in the model.
57    pub fn systems(self) -> impl Iterator<Item = ClassificationSystem<'m>> + 'm {
58        self.model()
59            .of_type("IFCCLASSIFICATION")
60            .map(|(id, e)| ClassificationSystem::from_known(id, e))
61    }
62}