From 8c7346a66934a879b78e23bbd32c8b4f970417be Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 17 Feb 2015 22:14:09 +0000 Subject: [PATCH] Correctly cast writable enumeration attributes to string, as reported in: https://sourceforge.net/p/ifcopenshell/discussion/1782717/thread/53b70ea0 --- src/ifcparse/IfcWrite.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ifcparse/IfcWrite.cpp b/src/ifcparse/IfcWrite.cpp index f84edee777..691a6b0118 100644 --- a/src/ifcparse/IfcWrite.cpp +++ b/src/ifcparse/IfcWrite.cpp @@ -271,7 +271,12 @@ public: IfcWriteArgument::operator int() const { return as(); } IfcWriteArgument::operator bool() const { return as(); } IfcWriteArgument::operator double() const { return as(); } -IfcWriteArgument::operator std::string() const { return as(); } +IfcWriteArgument::operator std::string() const { + if (argumentType() == argument_type_enumeration) { + return as().enumeration_value; + } + return as(); +} IfcWriteArgument::operator std::vector() const { return as >(); } IfcWriteArgument::operator std::vector() const { return as >(); } IfcWriteArgument::operator std::vector() const { return as >(); }