From 62540f0b0098e7821031ab9c028c8a30c35bcdec Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 27 Mar 2021 10:00:41 +0100 Subject: [PATCH] #1404 --- src/ifcwrap/IfcParseWrapper.i | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index 4bc5301c8c..81fa7e1c6c 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -520,10 +520,17 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas // The IfcFile* returned by open() is to be freed by SWIG/Python %newobject open; %newobject read; - -#ifdef WITH_IFCXML %newobject parse_ifcxml; + +%inline %{ + IfcParse::IfcFile* parse_ifcxml(const std::string& fn) { +#ifdef WITH_IFCXML + return IfcParse::parse_ifcxml(fn); +#else + throw std::runtime_error("No IfcXML support enabled"); #endif + } +%} %inline %{ IfcParse::IfcFile* open(const std::string& fn) { @@ -531,12 +538,6 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas return f; } -#ifdef WITH_IFCXML - IfcParse::IfcFile* parse_ifcxml(const std::string& fn) { - return IfcParse::parse_ifcxml(fn); - } -#endif - IfcParse::IfcFile* read(const std::string& data) { char* copiedData = new char[data.length()]; memcpy(copiedData, data.c_str(), data.length());