Move macro logic into template function; mark failures as intended #4915

This commit is contained in:
Thomas Krijnen
2024-07-01 20:34:51 +02:00
parent 0357d15ce4
commit 675e1982ee
6 changed files with 78 additions and 76 deletions
+1 -28
View File
@@ -3,33 +3,6 @@
#endif
#define BIND(T) \
if (!item && inst->as<IfcSchema::T>()) { \
matched = true; \
try { \
item = map_impl(inst->as<IfcSchema::T>()); \
if (item != nullptr) { \
if (item->instance == nullptr) { \
item->instance = inst; \
} \
try { \
if (inst->as<IfcSchema::IfcRepresentationItem>() && !inst->as<IfcSchema::IfcStyledItem>() && \
/* @todo */ \
(item->kind() == taxonomy::SOLID || item->kind() == taxonomy::SHELL || item->kind() == taxonomy::COLLECTION || item->kind() == taxonomy::EXTRUSION) \
) { \
auto style = find_style(inst->as<IfcSchema::IfcRepresentationItem>()); \
if (style) { \
taxonomy::cast<taxonomy::geom_item>(item)->surface_style = taxonomy::cast<taxonomy::style>(map(style)); \
} \
} \
} catch (const std::exception& e) { \
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst); \
} \
} else {\
Logger::Message(Logger::LOG_ERROR,"Failed to convert:", inst);\
} \
} catch (const std::exception& e) { \
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst); \
} \
}
process_mapping<IfcSchema::T>(matched, item, inst);
#include "mapping.i"