ifc_model/header.rs
1//! File-level metadata, independent of serialization.
2//!
3//! STEP writes this as `FILE_DESCRIPTION`/`FILE_NAME`/`FILE_SCHEMA` inside a
4//! `HEADER;` section; ifcXML writes it as attributes on the root element. The
5//! fields are the same, so they live here and each codec maps to its own
6//! syntax.
7
8/// Metadata describing the file and the schema it claims to follow.
9#[derive(Debug, Clone, Default, PartialEq)]
10pub struct Header {
11 /// `FILE_DESCRIPTION` description strings, e.g. a view definition.
12 pub description: Vec<String>,
13 /// `FILE_DESCRIPTION` implementation level, conventionally `2;1`.
14 pub implementation_level: String,
15 /// Originating file name.
16 pub name: String,
17 /// ISO-8601 timestamp as written.
18 pub time_stamp: String,
19 /// Author entries.
20 pub author: Vec<String>,
21 /// Organization entries.
22 pub organization: Vec<String>,
23 /// Preprocessor that produced the file.
24 pub preprocessor_version: String,
25 /// Originating application.
26 pub originating_system: String,
27 /// Authorization field.
28 pub authorization: String,
29 /// `FILE_SCHEMA` tokens, e.g. `IFC4X3_ADD2`.
30 ///
31 /// Kept as written rather than parsed into an enum: an unrecognized schema
32 /// token must survive a round-trip, and refusing to store it would corrupt
33 /// files from schema versions this build predates.
34 pub schema: Vec<String>,
35}
36
37impl Header {
38 /// The declared schema token, if any.
39 pub fn schema_token(&self) -> Option<&str> {
40 self.schema.first().map(|s| s.as_str())
41 }
42}