Try to do less allocation during parse, favour upper case entity names in spf

This commit is contained in:
Thomas Krijnen
2022-06-06 09:59:32 +02:00
parent 0e8d7bdc97
commit 4c854fbb62
4 changed files with 44 additions and 20 deletions
+8 -1
View File
@@ -4,7 +4,14 @@
#include <map>
bool IfcParse::declaration::is(const std::string& name) const {
if (name_lower_ == boost::to_lower_copy(name)) return true;
const std::string* name_ptr = &name;
if (std::any_of(name.begin(), name.end(), [](char c) { return std::islower(c); })) {
temp_string_() = name;
boost::to_upper(temp_string_());
name_ptr = &temp_string_();
}
if (name_upper_ == *name_ptr) return true;
if (this->as_entity()) {
return this->as_entity()->is(name);