Skip to content

Commit

Permalink
Refactor: Updated DENG2_FOR_EACH macro usage
Browse files Browse the repository at this point in the history
The parameters have been revised to make these slightly less verbose.
  • Loading branch information
skyjake committed Oct 2, 2012
1 parent 9a574df commit 0b72bc1
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/map/bsp/superblockmap.h
Expand Up @@ -242,7 +242,7 @@ class SuperBlock
DENG_DEBUG_ONLY(
static void DebugPrint(SuperBlock const& inst)
{
DENG2_FOR_EACH(it, inst.hedges(), SuperBlock::HEdges::const_iterator)
DENG2_FOR_EACH_CONST(SuperBlock::HEdges, it, inst.hedges())
{
HEdge* hedge = *it;
LOG_DEBUG("Build: %s %p sector: %d [%1.1f, %1.1f] -> [%1.1f, %1.1f]")
Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/portable/src/filedirectory.cpp
Expand Up @@ -71,7 +71,7 @@ void de::FileDirectory::clearNodeInfo()
{
const PathNodes* nodes = pathNodes(PT_LEAF);
if(nodes)
DENG2_FOR_EACH(i, *nodes, PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(PathNodes, i, *nodes)
{
FileDirectoryNodeInfo* info = reinterpret_cast<FileDirectoryNodeInfo*>((*i)->userData());
if(info)
Expand All @@ -84,7 +84,7 @@ void de::FileDirectory::clearNodeInfo()

nodes = pathNodes(PT_BRANCH);
if(nodes)
DENG2_FOR_EACH(i, *nodes, PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(PathNodes, i, *nodes)
{
FileDirectoryNodeInfo* info = reinterpret_cast<FileDirectoryNodeInfo*>((*i)->userData());
if(info)
Expand Down Expand Up @@ -266,7 +266,7 @@ int de::FileDirectory::addPathNodesAndMaybeDescendBranch(bool descendBranches,
{
const PathNodes* nodes = pathNodes(PT_LEAF);
if(nodes)
DENG2_FOR_EACH(i, *nodes, PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(PathNodes, i, *nodes)
{
if(node == (*i)->parent())
{
Expand All @@ -279,7 +279,7 @@ int de::FileDirectory::addPathNodesAndMaybeDescendBranch(bool descendBranches,
{
nodes = pathNodes(PT_BRANCH);
if(nodes)
DENG2_FOR_EACH(i, *nodes, PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(PathNodes, i, *nodes)
{
if(node == (*i)->parent())
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/map/bsp/hplane.cpp
Expand Up @@ -149,7 +149,7 @@ const HPlane::Intercepts& HPlane::intercepts() const
void HPlane::DebugPrint(const HPlane& inst)
{
uint index = 0;
DENG2_FOR_EACH(i, inst.intercepts(), HPlane::Intercepts::const_iterator)
DENG2_FOR_EACH_CONST(HPlane::Intercepts, i, inst.intercepts())
{
Con_Printf(" %u: >%1.2f ", index++, i->distance());
}
Expand Down
26 changes: 13 additions & 13 deletions doomsday/engine/portable/src/map/bsp/partitioner.cpp
Expand Up @@ -445,7 +445,7 @@ struct Partitioner::Instance
*/
void createInitialHEdges(SuperBlock& hedgeList)
{
DENG2_FOR_EACH(i, lineDefInfos, LineDefInfos::iterator)
DENG2_FOR_EACH(LineDefInfos, i, lineDefInfos)
{
LineDefInfo const& lineInfo = *i;
LineDef* line = lineInfo.lineDef;
Expand Down Expand Up @@ -1117,7 +1117,7 @@ struct Partitioner::Instance
}

// Check partition against all half-edges.
DENG2_FOR_EACH(it, block.hedges(), SuperBlock::HEdges::const_iterator)
DENG2_FOR_EACH_CONST(SuperBlock::HEdges, it, block.hedges())
{
// Do we already have a better choice?
if(best && !(cost < bestCost)) return false; // Stop iteration.
Expand Down Expand Up @@ -1208,7 +1208,7 @@ struct Partitioner::Instance
DENG2_ASSERT(best);

// Test each half-edge as a potential partition.
DENG2_FOR_EACH(it, partList.hedges(), SuperBlock::HEdges::const_iterator)
DENG2_FOR_EACH_CONST(SuperBlock::HEdges, it, partList.hedges())
{
HEdge* hedge = *it;

Expand Down Expand Up @@ -1326,7 +1326,7 @@ struct Partitioner::Instance
#if 0
const bool isDegenerate = hedges.size() < 3;
bool isOrphan = true;
DENG2_FOR_EACH(it, hedges, HEdgeList::const_iterator)
DENG2_FOR_EACH_CONST(HEdgeList, it, hedges)
{
const HEdge* hedge = *it;
if(hedge->lineDef && hedge->lineDef->L_sector(hedge->side))
Expand All @@ -1338,7 +1338,7 @@ struct Partitioner::Instance
#endif

BspLeaf* leaf = 0;
DENG2_FOR_EACH(it, hedges, HEdgeList::const_iterator)
DENG2_FOR_EACH_CONST(HEdgeList, it, hedges)
{
HEdge* hedge = *it;
#if 0
Expand Down Expand Up @@ -1594,7 +1594,7 @@ struct Partitioner::Instance

void clearPartitionIntercepts()
{
DENG2_FOR_EACH(it, partition.intercepts(), HPlane::Intercepts::const_iterator)
DENG2_FOR_EACH_CONST(HPlane::Intercepts, it, partition.intercepts())
{
HEdgeIntercept* intercept = static_cast<HEdgeIntercept*>((*it).userData());
if(intercept) delete intercept;
Expand Down Expand Up @@ -1844,7 +1844,7 @@ struct Partitioner::Instance
void windLeafs()
{
HEdgeSortBuffer sortBuffer;
DENG2_FOR_EACH(it, treeNodeMap, BspTreeNodeMap::iterator)
DENG2_FOR_EACH(BspTreeNodeMap, it, treeNodeMap)
{
BspTreeNode* node = it->second;
if(!node->isLeaf()) continue;
Expand Down Expand Up @@ -1885,7 +1885,7 @@ struct Partitioner::Instance
{
if(!vertex) return NULL; // Hmm...

DENG2_FOR_EACH(it, partition.intercepts(), HPlane::Intercepts::const_iterator)
DENG2_FOR_EACH_CONST(HPlane::Intercepts, it, partition.intercepts())
{
HPlaneIntercept const* inter = &*it;
HEdgeIntercept* hedgeInter = reinterpret_cast<HEdgeIntercept*>(inter->userData());
Expand Down Expand Up @@ -1944,7 +1944,7 @@ struct Partitioner::Instance

void clearAllBspObjects()
{
DENG2_FOR_EACH(it, vertexes, Vertexes::iterator)
DENG2_FOR_EACH(Vertexes, it, vertexes)
{
Vertex* vtx = *it;
// Has ownership of this vertex been claimed?
Expand All @@ -1954,7 +1954,7 @@ struct Partitioner::Instance
M_Free(vtx);
}

DENG2_FOR_EACH(it, treeNodeMap, BspTreeNodeMap::iterator)
DENG2_FOR_EACH(BspTreeNodeMap, it, treeNodeMap)
{
clearBspObject(*it->second);
}
Expand Down Expand Up @@ -2132,7 +2132,7 @@ struct Partitioner::Instance

// First check whether there's a wall_tip that lies in the exact direction of
// the given direction (which is relative to the vtxex).
DENG2_FOR_EACH(it, hedgeTips, VertexInfo::HEdgeTips::const_iterator)
DENG2_FOR_EACH_CONST(VertexInfo::HEdgeTips, it, hedgeTips)
{
const HEdgeTip& tip = *it;
coord_t diff = fabs(tip.angle() - angle);
Expand All @@ -2144,7 +2144,7 @@ struct Partitioner::Instance

// OK, now just find the first wall_tip whose angle is greater than the angle
// we're interested in. Therefore we'll be on the FRONT side of that tip edge.
DENG2_FOR_EACH(it, hedgeTips, VertexInfo::HEdgeTips::const_iterator)
DENG2_FOR_EACH_CONST(VertexInfo::HEdgeTips, it, hedgeTips)
{
const HEdgeTip& tip = *it;
if(angle + ANG_EPSILON < tip.angle())
Expand Down Expand Up @@ -2533,7 +2533,7 @@ DENG_DEBUG_ONLY(
static void printPartitionIntercepts(HPlane const& partition)
{
uint index = 0;
DENG2_FOR_EACH(i, partition.intercepts(), HPlane::Intercepts::const_iterator)
DENG2_FOR_EACH_CONST(HPlane::Intercepts, i, partition.intercepts())
{
Con_Printf(" %u: >%1.2f ", index++, i->distance());
HEdgeIntercept::DebugPrint(*reinterpret_cast<HEdgeIntercept*>(i->userData()));
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/map/bsp/superblockmap.cpp
Expand Up @@ -185,7 +185,7 @@ void SuperBlock::findHEdgeBounds(AABoxd& bounds)
bool initialized = false;
AABoxd hedgeAABox;

DENG2_FOR_EACH(it, d->hedges, HEdges::iterator)
DENG2_FOR_EACH(HEdges, it, d->hedges)
{
HEdge* hedge = *it;
initAABoxFromHEdgeVertexes(&hedgeAABox, hedge);
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/map/entitydatabase.cpp
Expand Up @@ -41,9 +41,9 @@ struct entitydatabase_s
public:
~entitydatabase_s()
{
DENG2_FOR_EACH(setIt, entitySets, EntitySet::iterator)
DENG2_FOR_EACH(entityIt, setIt->second, Entities::iterator)
DENG2_FOR_EACH(propIt, entityIt->second, Entity::iterator)
DENG2_FOR_EACH(EntitySet, setIt, entitySets)
DENG2_FOR_EACH(Entities, entityIt, setIt->second)
DENG2_FOR_EACH(Entity, propIt, entityIt->second)
{
delete propIt->second;
}
Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/portable/src/pathdirectory.cpp
Expand Up @@ -430,7 +430,7 @@ struct de::PathDirectory::Instance
static void collectPathsInHash(de::PathDirectory::PathNodes& ph, char delimiter,
ddstring_t** pathListAdr)
{
DENG2_FOR_EACH(i, ph, de::PathDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(de::PathDirectory::PathNodes, i, ph)
{
Str_Init(*pathListAdr);
(*i)->composePath((*pathListAdr), NULL, delimiter);
Expand All @@ -440,7 +440,7 @@ struct de::PathDirectory::Instance

static void clearPathHash(de::PathDirectory::PathNodes& ph)
{
DENG2_FOR_EACH(i, ph, de::PathDirectory::PathNodes::iterator)
DENG2_FOR_EACH(de::PathDirectory::PathNodes, i, ph)
{
#if _DEBUG
if((*i)->userData())
Expand Down Expand Up @@ -1162,7 +1162,7 @@ static int iteratePathsInHash(PathDirectory* pd,
else
{
// No - iterate all nodes.
DENG2_FOR_EACH(i, *nodes, de::PathDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(de::PathDirectory::PathNodes, i, *nodes)
{
if(!((flags & PCF_MATCH_PARENT) && parent != (*i)->parent()))
{
Expand Down Expand Up @@ -1212,7 +1212,7 @@ static int iteratePathsInHash_Const(const PathDirectory* pd,
else
{
// No - iterate all nodes.
DENG2_FOR_EACH(i, *nodes, de::PathDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(de::PathDirectory::PathNodes, i, *nodes)
{
if(!((flags & PCF_MATCH_PARENT) && parent != (*i)->parent()))
{
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/resource/materials.cpp
Expand Up @@ -603,7 +603,7 @@ static void destroyBindings(void)
const MaterialDirectory::PathNodes* nodes = namespaces[i]->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, MaterialDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(MaterialDirectory::PathNodes, nodeIt, *nodes)
{
MaterialBind* mb = reinterpret_cast<MaterialBind*>((*nodeIt)->userData());
if(mb)
Expand Down Expand Up @@ -708,7 +708,7 @@ void Materials_ClearDefinitionLinks(void)
const MaterialDirectory::PathNodes* nodes = matDirectory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, MaterialDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(MaterialDirectory::PathNodes, nodeIt, *nodes)
{
MaterialBind* mb = reinterpret_cast<MaterialBind*>((*nodeIt)->userData());
if(mb)
Expand Down Expand Up @@ -1562,7 +1562,7 @@ static MaterialDirectoryNode** collectDirectoryNodes(materialnamespaceid_t names
const MaterialDirectory::PathNodes* nodes = matDirectory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, MaterialDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(MaterialDirectory::PathNodes, nodeIt, *nodes)
{
if(like && like[0])
{
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/resource/texture.cpp
Expand Up @@ -54,7 +54,7 @@ de::Texture::~Texture()

void de::Texture::clearVariants()
{
DENG2_FOR_EACH(i, variants, Variants::iterator)
DENG2_FOR_EACH(Variants, i, variants)
{
#if _DEBUG
unsigned int glName = (*i)->glName();
Expand Down Expand Up @@ -324,7 +324,7 @@ int Texture_IterateVariants(struct texture_s* tex,
int result = 0;
if(callback)
{
DENG2_FOR_EACH(i, self->variantList(), de::Texture::Variants::const_iterator)
DENG2_FOR_EACH_CONST(de::Texture::Variants, i, self->variantList())
{
de::TextureVariant* variant = const_cast<de::TextureVariant*>(*i);
result = callback(reinterpret_cast<TextureVariant*>(variant), parameters);
Expand Down
14 changes: 7 additions & 7 deletions doomsday/engine/portable/src/resource/textures.cpp
Expand Up @@ -451,7 +451,7 @@ void Textures_Shutdown(void)
const TextureDirectory::PathNodes* nodes = tn->directory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
destroyRecord(reinterpret_cast<TextureDirectoryNode*>(*nodeIt));
}
Expand Down Expand Up @@ -621,7 +621,7 @@ void Textures_ClearNamespace(texturenamespaceid_t namespaceId)
const TextureDirectory::PathNodes* nodes = tn->directory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
destroyBoundTexture(*nodeIt);
destroyRecord(*nodeIt);
Expand Down Expand Up @@ -673,7 +673,7 @@ static void findUniqueIdBounds(TextureNamespace* tn, int* minId, int* maxId)

const TextureDirectory::PathNodes* nodes = tn->directory->pathNodes(PT_LEAF);
if(nodes)
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
const TextureRecord* record = reinterpret_cast<TextureRecord*>((*nodeIt)->userData());
if(!record) continue;
Expand Down Expand Up @@ -722,7 +722,7 @@ static void rebuildUniqueIdMap(texturenamespaceid_t namespaceId)

const TextureDirectory::PathNodes* nodes = tn->directory->pathNodes(PT_LEAF);
if(nodes)
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
const TextureRecord* record = reinterpret_cast<TextureRecord*>((*nodeIt)->userData());
if(!record) continue;
Expand Down Expand Up @@ -1119,7 +1119,7 @@ int Textures_Iterate2(texturenamespaceid_t namespaceId,
const TextureDirectory::PathNodes* nodes = directory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
TextureRecord* record = reinterpret_cast<TextureRecord*>((*nodeIt)->userData());
if(!record || !record->texture) continue;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ int Textures_IterateDeclared2(texturenamespaceid_t namespaceId,
const TextureDirectory::PathNodes* nodes = directory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
TextureRecord* record = reinterpret_cast<TextureRecord*>((*nodeIt)->userData());
if(!record) continue;
Expand Down Expand Up @@ -1280,7 +1280,7 @@ static TextureDirectoryNode** collectDirectoryNodes(texturenamespaceid_t namespa
const TextureDirectory::PathNodes* nodes = directory->pathNodes(PT_LEAF);
if(nodes)
{
DENG2_FOR_EACH(nodeIt, *nodes, TextureDirectory::PathNodes::const_iterator)
DENG2_FOR_EACH_CONST(TextureDirectory::PathNodes, nodeIt, *nodes)
{
if(like && like[0])
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/dehread/src/dehreader.cpp
Expand Up @@ -719,7 +719,7 @@ class DehReader
// Split the argument into discreet tokens and process each individually.
/// @todo Re-implement with a left-to-right algorithm.
QStringList tokens = arg.split(QRegExp("[,+| ]|\t|\f|\r"), QString::SkipEmptyParts);
DENG2_FOR_EACH(i, tokens, QStringList::const_iterator)
DENG2_FOR_EACH_CONST(QStringList, i, tokens)
{
const String& token = *i;
bool tokenIsNumber;
Expand Down

0 comments on commit 0b72bc1

Please sign in to comment.