Fix some casting logic

This commit is contained in:
Thomas Krijnen
2021-09-13 13:19:56 +02:00
parent 99a27fbfef
commit 1058dc7099
14 changed files with 2806 additions and 2807 deletions
@@ -115,6 +115,7 @@ class Implementation(codegen.Base):
"index": arg["index"] - 1,
"type": arg["full_type"].replace("::Value", ""),
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
"non_optional_type_no_pointer": arg["non_optional_type"].replace("::Value", "").replace("*", ""),
"list_instance_type": arg["list_instance_type"],
"null_check": null_check
},
@@ -243,7 +243,7 @@ optional_attr_stmt = "return !data_->getArgument(%(index)d)->isNull();"
get_attr_stmt = "%(null_check)s %(non_optional_type)s v = *data_->getArgument(%(index)d); return v;"
get_attr_stmt_enum = "%(null_check)s return %(non_optional_type)s::FromString(*data_->getArgument(%(index)d));"
get_attr_stmt_entity = "%(null_check)s return (%(non_optional_type)s)((IfcUtil::IfcBaseClass*)(*data_->getArgument(%(index)d)));"
get_attr_stmt_entity = "%(null_check)s return ((IfcUtil::IfcBaseClass*)(*data_->getArgument(%(index)d)))->as<%(non_optional_type_no_pointer)s>();"
get_attr_stmt_array = (
"%(null_check)s aggregate_of_instance::ptr es = *data_->getArgument(%(index)d); return es->as< %(list_instance_type)s >();"
)