| 492 | |
| 493 | template <typename It> |
| 494 | void enumerate_string_properties(const IfcUtil::IfcBaseEntity* product, It output_it) { |
| 495 | auto rels = product->get_inverse("IsDefinedBy"); |
| 496 | for (auto& rel : *rels) { |
| 497 | if (rel->declaration().is("IfcRelDefinesByProperties")) { |
| 498 | auto pset = ((IfcUtil::IfcBaseClass*) ((IfcUtil::IfcBaseEntity*) rel)->get("RelatingPropertyDefinition"))->as<IfcUtil::IfcBaseEntity>(); |
| 499 | if (!pset->declaration().is("IfcPropertySet")) { |
| 500 | continue; |
| 501 | } |
| 502 | std::string pset_name; |
| 503 | if (!pset->get("Name").isNull()) { |
| 504 | pset_name = (std::string) pset->get("Name"); |
| 505 | } |
| 506 | aggregate_of_instance::ptr props = pset->get("HasProperties"); |
| 507 | for (auto& prop : *props) { |
| 508 | if (prop->declaration().is("IfcPropertySingleValue")) { |
| 509 | std::string name = ((IfcUtil::IfcBaseEntity*) prop)->get("Name"); |
| 510 | if (((IfcUtil::IfcBaseEntity*) prop)->get("NominalValue").isNull()) { |
| 511 | continue; |
| 512 | } |
| 513 | IfcUtil::IfcBaseClass* v = ((IfcUtil::IfcBaseEntity*) prop)->get("NominalValue"); |
| 514 | auto value = v->get_attribute_value(0); |
| 515 | if (value.type() == IfcUtil::Argument_STRING) { |
| 516 | std::string v_str = value; |
| 517 | *output_it++ = string_property{ pset_name, name, v_str }; |
| 518 | } |
| 519 | } |
| 520 | } |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | namespace { |
no test coverage detected