From 7541293a3c06fff31b9ebf8502bdb49f9ee04bd1 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 11 Sep 2023 21:27:54 +0200 Subject: [PATCH] Case sensitivity on entity str comparison from cmd line https://sourceforge.net/p/ifcopenshell/discussion/1782717/thread/2bf3324a7f --- src/ifcparse/IfcSchema.cpp | 8 ++++---- src/ifcparse/IfcSchema.h | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/ifcparse/IfcSchema.cpp b/src/ifcparse/IfcSchema.cpp index 2d26efa0da..a21023a865 100644 --- a/src/ifcparse/IfcSchema.cpp +++ b/src/ifcparse/IfcSchema.cpp @@ -13,8 +13,8 @@ bool IfcParse::declaration::is(const std::string& name) const { if (name_upper_ == *name_ptr) return true; - if (this->as_entity()) { - return this->as_entity()->is(name); + if (this->as_entity() && this->as_entity()->supertype()) { + return this->as_entity()->supertype()->is(name); } else if (this->as_type_declaration()) { const IfcParse::named_type* nt = this->as_type_declaration()->declared_type()->as_named_type(); if (nt) return nt->is(name); @@ -26,8 +26,8 @@ bool IfcParse::declaration::is(const std::string& name) const { bool IfcParse::declaration::is(const IfcParse::declaration& decl) const { if (this == &decl) return true; - if (this->as_entity()) { - return this->as_entity()->is(decl); + if (this->as_entity() && this->as_entity()->supertype()) { + return this->as_entity()->supertype()->is(decl); } else if (this->as_type_declaration()) { const IfcParse::named_type* nt = this->as_type_declaration()->declared_type()->as_named_type(); if (nt) return nt->is(decl); diff --git a/src/ifcparse/IfcSchema.h b/src/ifcparse/IfcSchema.h index 4ec3e93b7d..5661530844 100644 --- a/src/ifcparse/IfcSchema.h +++ b/src/ifcparse/IfcSchema.h @@ -293,18 +293,6 @@ namespace IfcParse { virtual ~entity(); - bool is(const std::string& name) const { - if (name == name_) return true; - else if (supertype_) return supertype_->is(name); - else return false; - } - - bool is(const IfcParse::declaration& decl) const { - if (this == &decl) return true; - else if (supertype_) return supertype_->is(decl); - else return false; - } - bool is_abstract() const { return is_abstract_; } void set_subtypes(const std::vector& subtypes) {