spf_header::assign() cfr a9d67768

This commit is contained in:
Thomas Krijnen
2026-07-28 03:36:53 +02:00
parent 9c965e9f08
commit 02bc09029e
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -98,3 +98,26 @@ Header_section_schema::file_name ifcopenshell::spf_header::file_name() {
Header_section_schema::file_schema ifcopenshell::spf_header::file_schema() { Header_section_schema::file_schema ifcopenshell::spf_header::file_schema() {
return Header_section_schema::file_schema(header_entities_[2]); 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<decltype(v)>;
if constexpr (std::is_same_v<U, express::Base>) {
} else if constexpr (std::is_same_v<U, std::vector<express::Base>>) {
} else if constexpr (std::is_same_v<U, std::vector<std::vector<express::Base>>>) {
} 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]));
}
}
}
+2
View File
@@ -57,6 +57,8 @@ class IFC_PARSE_API spf_header {
const Header_section_schema::file_description file_description() const; const Header_section_schema::file_description file_description() const;
const Header_section_schema::file_name file_name() const; const Header_section_schema::file_name file_name() const;
const Header_section_schema::file_schema file_schema() const; const Header_section_schema::file_schema file_schema() const;
void assign(const spf_header& other);
}; };
} // namespace ifcopenshell } // namespace ifcopenshell