From db6630c1f83b05c29f32535da16eebe9eda7aef8 Mon Sep 17 00:00:00 2001 From: aothms Date: Mon, 5 Oct 2015 13:34:43 +0200 Subject: [PATCH] Use boost::to_lower() --- src/ifcconvert/IfcConvert.cpp | 12 ++++-------- src/ifcgeom/IfcGeomIterator.h | 8 +++----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 8bb776cc73..b1df5ee3bd 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -32,6 +32,7 @@ #include #include +#include #include "../ifcgeom/IfcGeomIterator.h" @@ -197,11 +198,8 @@ int main(int argc, char** argv) { // Gets the set ifc types to be ignored from the command line. std::set entities; for (std::vector::const_iterator it = entity_vector.begin(); it != entity_vector.end(); ++it) { - std::string lowercase_type = *it; - for (std::string::iterator c = lowercase_type.begin(); c != lowercase_type.end(); ++c) { - *c = tolower(*c); - } - entities.insert(lowercase_type); + const std::string& mixed_case_type = *it; + entities.insert(boost::to_lower_copy(mixed_case_type)); } const std::string input_filename = vmap["input-file"].as(); @@ -217,9 +215,7 @@ int main(int argc, char** argv) { } std::string output_extension = output_filename.substr(output_filename.size()-4); - for (std::string::iterator c = output_extension.begin(); c != output_extension.end(); ++c) { - *c = tolower(*c); - } + boost::to_lower(output_extension); // If no entities are specified these are the defaults to skip from output if (entity_vector.empty()) { diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index fc62b3bbf4..70e24234ac 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -181,11 +181,9 @@ namespace IfcGeom { continue; } if (context->hasContextType()) { - std::string context_type_lc = context->ContextType(); - for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) { - *c = tolower(*c); - } - if (context_types.find(context_type_lc) != context_types.end()) { + std::string context_type = context->ContextType(); + boost::to_lower(context_type); + if (context_types.find(context_type) != context_types.end()) { filtered_contexts->push(context); } }