Type hint from schema when encountering empty aggregate. Fixes #127

This commit is contained in:
Thomas Krijnen
2016-11-08 17:24:08 +01:00
parent 00215867c0
commit e8ae491dc3
5 changed files with 160 additions and 144 deletions
+10 -4
View File
@@ -144,8 +144,10 @@ void IfcWritableEntity::setArgument(int i) {
_setArgument(i, boost::none);
}
void IfcWritableEntity::setArgument(int i, Argument* a) {
IfcUtil::ArgumentType attr_type = a->type();
void IfcWritableEntity::setArgument(int i, Argument* a, IfcUtil::ArgumentType attr_type) {
if (attr_type == IfcUtil::Argument_UNKNOWN) {
attr_type = a->type();
}
switch(attr_type) {
case IfcUtil::Argument_NULL:
this->setArgument(i);
@@ -224,14 +226,18 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
}
this->setArgument(i, mapped_instances); }
break;
case IfcUtil::Argument_EMPTY_AGGREGATE:
case IfcUtil::Argument_AGGREGATE_OF_EMPTY_AGGREGATE: {
IfcUtil::ArgumentType t2 = IfcSchema::Type::GetAttributeType(type(), (unsigned) i);
this->setArgument(i, a, t2); }
break;
default:
case IfcUtil::Argument_UNKNOWN:
throw IfcParse::IfcException("Unknown argument encountered");
throw IfcParse::IfcException(std::string("Unknown attribute encountered: '") + a->toString() + "' at index '" + boost::lexical_cast<std::string>(i) + "'");
break;
}
}
void IfcWritableEntity::setArgumentDerived(int i) {
_setArgument(i, IfcWriteArgument::Derived());
}