mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
#2186 optional attribute setter fix
This commit is contained in:
@@ -159,6 +159,8 @@ class Implementation(codegen.Base):
|
|||||||
"type": arg["full_type"].replace("::Value", ""),
|
"type": arg["full_type"].replace("::Value", ""),
|
||||||
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
||||||
"star_if_optional": "*" if "boost::optional" in arg["full_type"] else "",
|
"star_if_optional": "*" if "boost::optional" in arg["full_type"] else "",
|
||||||
|
"check_optional_set_begin": "if (v) {" if "boost::optional" in arg["full_type"] else "",
|
||||||
|
"check_optional_set_end": "}" if "boost::optional" in arg["full_type"] else "",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -259,13 +259,13 @@ get_attr_stmt_nested_array = "%(null_check)s aggregate_of_aggregate_of_instance:
|
|||||||
get_inverse = "return data_->getInverse(%(schema_name_upper)s_%(type)s_type, %(index)d)->as<%(type)s>();"
|
get_inverse = "return data_->getInverse(%(schema_name_upper)s_%(type)s_type, %(index)d)->as<%(type)s>();"
|
||||||
|
|
||||||
set_attr_stmt = (
|
set_attr_stmt = (
|
||||||
"{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();attr->set(%(star_if_optional)sv"
|
"{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();%(check_optional_set_begin)sattr->set(%(star_if_optional)sv"
|
||||||
+ ");data_->setArgument(%(index)d,attr);}"
|
+ ");%(check_optional_set_end)sdata_->setArgument(%(index)d,attr);}"
|
||||||
)
|
)
|
||||||
set_attr_stmt_enum = "{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();attr->set(IfcWrite::IfcWriteArgument::EnumerationReference(%(star_if_optional)sv,%(non_optional_type)s::ToString(%(star_if_optional)sv)));data_->setArgument(%(index)d,attr);}"
|
set_attr_stmt_enum = "{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();%(check_optional_set_begin)sattr->set(IfcWrite::IfcWriteArgument::EnumerationReference(%(star_if_optional)sv,%(non_optional_type)s::ToString(%(star_if_optional)sv)));%(check_optional_set_end)sdata_->setArgument(%(index)d,attr);}"
|
||||||
set_attr_stmt_array = (
|
set_attr_stmt_array = (
|
||||||
"{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();attr->set((%(star_if_optional)sv)->generalize()"
|
"{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();%(check_optional_set_begin)sattr->set((%(star_if_optional)sv)->generalize()"
|
||||||
+ ");data_->setArgument(%(index)d,attr);}"
|
+ ");%(check_optional_set_end)sdata_->setArgument(%(index)d,attr);}"
|
||||||
)
|
)
|
||||||
|
|
||||||
constructor_stmt = (
|
constructor_stmt = (
|
||||||
|
|||||||
Reference in New Issue
Block a user