diff --git a/src/ifcparse/spf_header.cpp b/src/ifcparse/spf_header.cpp index d685fe3e1d..696c9162cd 100644 --- a/src/ifcparse/spf_header.cpp +++ b/src/ifcparse/spf_header.cpp @@ -98,3 +98,26 @@ Header_section_schema::file_name ifcopenshell::spf_header::file_name() { Header_section_schema::file_schema ifcopenshell::spf_header::file_schema() { return Header_section_schema::file_schema(header_entities_[2]); } + +void ifcopenshell::spf_header::assign(const spf_header& other) { + if (this != &other) { + auto copy_inst = [](express::Entity& new_entity, const express::Entity& entity) { + for (size_t i = 0; i < entity.declaration().as_entity()->attribute_count(); ++i) { + entity.get_attribute_value(i).apply_visitor([i, &entity, &new_entity](const auto& v) { + using U = std::decay_t; + if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v>) { + } else if constexpr (std::is_same_v>>) { + } else { + new_entity.set_attribute_value(i, v); + } + }); + } + }; + + for (size_t i = 0; i < header_entities_.size(); ++i) { + express::Entity tmp(header_entities_[i]); + copy_inst(tmp, express::Entity(other.header_entities_[i])); + } + } +} diff --git a/src/ifcparse/spf_header.h b/src/ifcparse/spf_header.h index 5bef3dbe4f..e25ee6ce1a 100644 --- a/src/ifcparse/spf_header.h +++ b/src/ifcparse/spf_header.h @@ -57,6 +57,8 @@ class IFC_PARSE_API spf_header { const Header_section_schema::file_description file_description() const; const Header_section_schema::file_name file_name() const; const Header_section_schema::file_schema file_schema() const; + + void assign(const spf_header& other); }; } // namespace ifcopenshell