Replaced BOOST_FOREACH with c++11 ranged for loops

This commit is contained in:
mensinda
2016-04-05 22:53:54 +02:00
parent 4836a2993e
commit 18843fe5e1
33 changed files with 209 additions and 236 deletions

View File

@@ -383,7 +383,7 @@ void SetUnits(ConversionData& conv)
void SetCoordinateSpace(ConversionData& conv)
{
const IfcRepresentationContext* fav = NULL;
BOOST_FOREACH(const IfcRepresentationContext& v, conv.proj.RepresentationContexts) {
for(const IfcRepresentationContext& v : conv.proj.RepresentationContexts) {
fav = &v;
// Model should be the most suitable type of context, hence ignore the others
if (v.ContextType && v.ContextType.Get() == "Model") {
@@ -440,7 +440,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
if (conv.apply_openings) {
IfcMatrix4 minv = msrc;
minv.Inverse();
BOOST_FOREACH(TempOpening& open,*conv.apply_openings){
for(TempOpening& open :*conv.apply_openings){
open.Transform(minv);
}
}
@@ -449,7 +449,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
bool got = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr.Items) {
for(const IfcRepresentationItem& item : repr.Items) {
if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
}
@@ -564,9 +564,9 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
std::vector<const IfcRepresentation*> repr_ordered(src.size());
std::copy(src.begin(),src.end(),repr_ordered.begin());
std::sort(repr_ordered.begin(),repr_ordered.end(),RateRepresentationPredicate());
BOOST_FOREACH(const IfcRepresentation* repr, repr_ordered) {
for(const IfcRepresentation* repr : repr_ordered) {
bool res = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr->Items) {
for(const IfcRepresentationItem& item : repr->Items) {
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
}
@@ -589,7 +589,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
const std::string& prefix = "",
unsigned int nest = 0)
{
BOOST_FOREACH(const IfcProperty& property, set) {
for(const IfcProperty& property : set) {
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
if (singleValue->NominalValue) {
@@ -615,7 +615,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
std::stringstream ss;
ss << "[";
unsigned index=0;
BOOST_FOREACH(const IfcValue::Out& v, listValue->ListValues) {
for(const IfcValue::Out& v : listValue->ListValues) {
if (!v) continue;
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str);
@@ -713,7 +713,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
data->mValues = new aiMetadataEntry[data->mNumProperties]();
unsigned int index = 0;
BOOST_FOREACH(const Metadata::value_type& kv, properties)
for(const Metadata::value_type& kv : properties)
data->Set(index++, kv.first, aiString(kv.second));
nd->mMetaData = data;
@@ -751,7 +751,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if(cont->RelatingStructure->GetID() != el.GetID()) {
continue;
}
BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {
for(const IfcProduct& pro : cont->RelatedElements) {
if(pro.ToPtr<IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey,
@@ -794,7 +794,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
}
// we need all openings to be in the local space of *this* node, so transform them
BOOST_FOREACH(TempOpening& op,openings_local) {
for(TempOpening& op :openings_local) {
op.Transform( myInv*nd_aggr->mChildren[0]->mTransformation);
openings.push_back(op);
}
@@ -823,7 +823,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
nd_aggr->mTransformation = nd->mTransformation;
nd_aggr->mChildren = new aiNode*[aggr->RelatedObjects.size()]();
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) {
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
@@ -849,7 +849,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if (subnodes.size()) {
nd->mChildren = new aiNode*[subnodes.size()]();
BOOST_FOREACH(aiNode* nd2, subnodes) {
for(aiNode* nd2 : subnodes) {
nd->mChildren[nd->mNumChildren++] = nd2;
nd2->mParent = nd.get();
}
@@ -889,7 +889,7 @@ void ProcessSpatialStructures(ConversionData& conv)
}
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
if(!prod) {
continue;
@@ -902,7 +902,7 @@ void ProcessSpatialStructures(ConversionData& conv)
for(;range.first != range.second; ++range.first) {
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) {
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
// comparing pointer values is not sufficient, we would need to cast them to the same type first
// as there is multiple inheritance in the game.
if (def.GetID() == prod->GetID()) {
@@ -919,7 +919,7 @@ void ProcessSpatialStructures(ConversionData& conv)
IFCImporter::LogWarn("failed to determine primary site element, taking the first IfcSite");
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
if(!prod) {
continue;