Use boost::to_upper() and -::to_upper_copy() for string manipulation throughout codebase

This commit is contained in:
aothms
2015-09-13 15:00:21 +02:00
parent a58b2ede63
commit 94d214808e
4 changed files with 14 additions and 15 deletions
+4 -6
View File
@@ -19,6 +19,8 @@
#include <sstream>
#include <boost/algorithm/string.hpp>
#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;
+4 -4
View File
@@ -28,6 +28,8 @@
#include <Windows.h>
#endif
#include <boost/algorithm/string.hpp>
#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) {
+3 -1
View File
@@ -20,6 +20,8 @@
#include <iomanip>
#include <locale>
#include <boost/algorithm/string.hpp>
#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())) {