diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 6c411a4fc5..fc62b3bbf4 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -64,6 +64,8 @@ #include #include +#include + #include #include #include @@ -125,10 +127,7 @@ namespace IfcGeom { void populate_set(const std::set& include_or_ignore) { entities_to_include_or_exclude.clear(); for (std::set::const_iterator it = include_or_ignore.begin(); it != include_or_ignore.end(); ++it) { - std::string uppercase_type = *it; - for (std::string::iterator c = uppercase_type.begin(); c != uppercase_type.end(); ++c) { - *c = toupper(*c); - } + const std::string uppercase_type = boost::to_upper_copy(*it); IfcSchema::Type::Enum ty; try { ty = IfcSchema::Type::FromString(uppercase_type); diff --git a/src/ifcparse/IfcLateBoundEntity.cpp b/src/ifcparse/IfcLateBoundEntity.cpp index af13f6d9fd..dbe78d1d04 100644 --- a/src/ifcparse/IfcLateBoundEntity.cpp +++ b/src/ifcparse/IfcLateBoundEntity.cpp @@ -19,6 +19,8 @@ #include +#include + #include "../ifcparse/IfcWritableEntity.h" #include "../ifcparse/IfcUtil.h" @@ -44,9 +46,7 @@ IfcWrite::IfcWritableEntity* IfcParse::IfcLateBoundEntity::writable_entity() { return e; } IfcParse::IfcLateBoundEntity::IfcLateBoundEntity(const std::string& s) { - std::string S = s; - for (std::string::iterator i = S.begin(); i != S.end(); ++i ) *i = toupper(*i); - _type = IfcSchema::Type::FromString(S); + _type = IfcSchema::Type::FromString(boost::to_upper_copy(s)); entity = new IfcWrite::IfcWritableEntity(_type); for (unsigned i = 0; i < getArgumentCount(); ++i) { // Side effect of this is that a NULL attribute is created. @@ -78,9 +78,7 @@ std::string IfcParse::IfcLateBoundEntity::is_a() const { return IfcSchema::Type::ToString(_type); } bool IfcParse::IfcLateBoundEntity::is_a(const std::string& s) const { - std::string S = s; - for (std::string::iterator i = S.begin(); i != S.end(); ++i ) *i = toupper(*i); - return is(IfcSchema::Type::FromString(S)); + return is(IfcSchema::Type::FromString(boost::to_upper_copy(s))); } IfcSchema::Type::Enum IfcParse::IfcLateBoundEntity::type() const { return _type; diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 593a512a1b..ac3e0cc99c 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -28,6 +28,8 @@ #include #endif +#include + #include "../ifcparse/IfcCharacterDecoder.h" #include "../ifcparse/IfcParse.h" #include "../ifcparse/IfcException.h" @@ -855,7 +857,7 @@ std::string Entity::toString(bool upper) const { std::string dt = datatype(); if (upper) { - for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p); + boost::to_upper(dt); } if (!IfcSchema::Type::IsSimple(type()) || _id != 0) { @@ -1355,9 +1357,7 @@ IfcEntityList::ptr IfcFile::entitiesByType(IfcSchema::Type::Enum t) { } IfcEntityList::ptr IfcFile::entitiesByType(const std::string& t) { - std::string ty = t; - for (std::string::iterator p = ty.begin(); p != ty.end(); ++p ) *p = toupper(*p); - return entitiesByType(IfcSchema::Type::FromString(ty)); + return entitiesByType(IfcSchema::Type::FromString(boost::to_upper_copy(t))); } IfcEntityList::ptr IfcFile::entitiesByReference(int t) { diff --git a/src/ifcparse/IfcWrite.cpp b/src/ifcparse/IfcWrite.cpp index 934651d3e6..86486ed992 100644 --- a/src/ifcparse/IfcWrite.cpp +++ b/src/ifcparse/IfcWrite.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include "../ifcparse/IfcParse.h" #include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWritableEntity.h" @@ -91,7 +93,7 @@ std::string IfcWritableEntity::toString(bool upper) const { std::string dt = datatype(); if (upper) { - for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p); + boost::to_upper(dt); } if (_id && !IfcSchema::Type::IsSimple(type())) {