diff --git a/src/ifcparse/IfcSpfHeader.cpp b/src/ifcparse/IfcSpfHeader.cpp index efb30c90a2..95297720ef 100644 --- a/src/ifcparse/IfcSpfHeader.cpp +++ b/src/ifcparse/IfcSpfHeader.cpp @@ -181,6 +181,28 @@ bool IfcSpfHeader::tryRead() { } } +void IfcParse::IfcSpfHeader::assign(const IfcSpfHeader& other) { + if (this != &other) { + auto copy_inst = [](IfcUtil::IfcBaseEntity* new_entity, IfcUtil::IfcBaseEntity* entity, const IfcParse::entity* decl, IfcParse::impl::in_memory_file_storage* own_storage, IfcParse::impl::in_memory_file_storage* other_storage) { + for (size_t i = 0; i < decl->attribute_count(); ++i) { + entity->data().apply_visitor(other_storage, decl, entity->identity(), [i, decl, new_entity, own_storage](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); + } + }, i); + } + }; + + copy_inst(file_description_, other.file_description_, &Header_section_schema::file_description::Class(), storage_, other.storage_); + copy_inst(file_name_, other.file_name_, &Header_section_schema::file_name::Class(), storage_, other.storage_); + copy_inst(file_schema_, other.file_schema_, &Header_section_schema::file_schema::Class(), storage_, other.storage_); + } +} + void IfcSpfHeader::write(std::ostream& out) const { out << ISO_10303_21 << ";" << "\n"; diff --git a/src/ifcparse/IfcSpfHeader.h b/src/ifcparse/IfcSpfHeader.h index fb6438745b..040d83de34 100644 --- a/src/ifcparse/IfcSpfHeader.h +++ b/src/ifcparse/IfcSpfHeader.h @@ -60,6 +60,8 @@ class IFC_PARSE_API IfcSpfHeader { void read(); bool tryRead(); + void assign(const IfcSpfHeader& other); + void write(std::ostream& out) const; const Header_section_schema::file_description* file_description() const;