MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / enumerate_string_properties

Function enumerate_string_properties

src/serializers/SvgSerializer.cpp:494–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
526namespace {

Callers 1

writeMethod · 0.85

Calls 6

isMethod · 0.80
isNullMethod · 0.80
get_attribute_valueMethod · 0.80
get_inverseMethod · 0.45
getMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected