From 35fe79dfb230350110d203ab26c20487fed0a397 Mon Sep 17 00:00:00 2001 From: Sebastian Friston Date: Wed, 12 Mar 2025 15:44:14 +0000 Subject: [PATCH] ISSUE #6328 fix in dispatch_token to avoid missing unknown in logicals --- src/ifcparse/IfcFile.cpp | 4 +++- src/serializers/schema_dependent/XmlSerializer.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ifcparse/IfcFile.cpp b/src/ifcparse/IfcFile.cpp index 14892b96ff..7c964d3fda 100644 --- a/src/ifcparse/IfcFile.cpp +++ b/src/ifcparse/IfcFile.cpp @@ -57,8 +57,10 @@ namespace { void dispatch_token(int instance_id, int attribute_id, IfcParse::Token t, IfcParse::declaration* decl, Fn fn) { if (t.type == IfcParse::Token_BINARY) { fn(IfcParse::TokenFunc::asBinary(t)); - } else if (t.type == IfcParse::Token_BOOL) { + } else if (IfcParse::TokenFunc::isBool(t)) { fn(IfcParse::TokenFunc::asBool(t)); + } else if (IfcParse::TokenFunc::isLogical(t)) { + fn(IfcParse::TokenFunc::asLogical(t)); } else if (t.type == IfcParse::Token_ENUMERATION) { auto& s = IfcParse::TokenFunc::asStringRef(t); if (decl && decl->as_enumeration_type()) { diff --git a/src/serializers/schema_dependent/XmlSerializer.cpp b/src/serializers/schema_dependent/XmlSerializer.cpp index 3aefa71d7a..508c6e6060 100644 --- a/src/serializers/schema_dependent/XmlSerializer.cpp +++ b/src/serializers/schema_dependent/XmlSerializer.cpp @@ -82,9 +82,10 @@ boost::optional format_attribute(ifcopenshell::geometry::abstract_m } switch(argument_type) { - case IfcUtil::Argument_BOOL: { - const bool b = argument; - value = b ? "true" : "false"; + case IfcUtil::Argument_BOOL: + case IfcUtil::Argument_LOGICAL:{ + const boost::logic::tribool b = argument; + value = b.value == boost::logic::tribool::indeterminate_value ? "unknown" : b ? "true" : "false"; break; } case IfcUtil::Argument_DOUBLE: { const double d = argument;