summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-20 20:43:54 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-20 23:48:07 +0300
commit2744e4fa8f39cd06bfe557a5a3881830bd11501c (patch)
tree2ec96c6ee820cfe0e5e76480fe828501bf555a4b /src
parent531433248fbad49e2b8e9d90de9855f3ea9b2257 (diff)
downloadmanaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.gz
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.bz2
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.xz
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.zip
Last part with FOR_EACH changes.
Diffstat (limited to 'src')
-rw-r--r--src/gui/sdlfont.cpp2
-rw-r--r--src/gui/widgets/browserbox.cpp12
-rw-r--r--src/gui/widgets/extendednamesmodel.cpp3
-rw-r--r--src/gui/widgets/itemcontainer.cpp12
-rw-r--r--src/gui/widgets/setuptouchitem.cpp3
-rw-r--r--src/gui/widgets/tabbedarea.cpp6
-rw-r--r--src/gui/widgets/tabstrip.cpp3
-rw-r--r--src/gui/widgets/vertcontainer.cpp6
-rw-r--r--src/gui/widgets/windowcontainer.cpp3
-rw-r--r--src/guichan/gui.cpp14
-rw-r--r--src/net/ea/inventoryhandler.cpp3
-rw-r--r--src/net/eathena/loginhandler.cpp3
-rw-r--r--src/net/eathena/network.cpp3
-rw-r--r--src/net/tmwa/loginhandler.cpp3
-rw-r--r--src/net/tmwa/network.cpp3
-rw-r--r--src/resources/action.cpp3
-rw-r--r--src/resources/atlasmanager.cpp35
-rw-r--r--src/resources/emotedb.cpp3
-rw-r--r--src/resources/itemdb.cpp3
-rw-r--r--src/resources/resourcemanager.cpp8
-rw-r--r--src/resources/spritedef.cpp29
-rw-r--r--src/resources/wallpaper.cpp4
-rw-r--r--src/utils/paths.cpp3
-rw-r--r--src/utils/stringutils.cpp3
-rw-r--r--src/utils/translation/translationmanager.cpp2
25 files changed, 52 insertions, 120 deletions
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index 0f4629ef8..a205bbdc0 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -280,7 +280,7 @@ void SDLFont::drawString(gcn::Graphics *const graphics,
int cnt = 0;
#endif
- FOR_EACH (CacheIterator, i, cache)
+ FOR_EACHP (CacheIterator, i, cache)
{
if (chunk == (*i))
{
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index e931c7626..8236dbdd3 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -253,8 +253,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
const int hyphenWidth = font->getWidth(hyphen);
unsigned x = 0;
- for (TextRowCIter i = mTextRows.begin(), i_end = mTextRows.end();
- i != i_end; ++ i)
+ FOR_EACH (TextRowCIter, i, mTextRows)
{
std::string tempRow = *i;
for (unsigned int j = 0, sz = static_cast<unsigned int>(
@@ -413,8 +412,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
gcn::Font *const font = getFont();
- for (LinePartCIter i = mLineParts.begin(), i_end = mLineParts.end();
- i != i_end; ++i)
+ FOR_EACH (LinePartCIter, i, mLineParts)
{
const LinePart &part = *i;
if (part.mY + 50 < mYStart)
@@ -465,8 +463,7 @@ int BrowserBox::calcHeight()
mLineParts.clear();
- for (TextRowCIter i = mTextRows.begin(), i_end = mTextRows.end();
- i != i_end; ++ i)
+ FOR_EACH (TextRowCIter, i, mTextRows)
{
const std::string row = *(i);
bool wrapped = false;
@@ -753,8 +750,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const
int lastY = 0;
- for (LinePartCIter i = mLineParts.begin(), i_end = mLineParts.end();
- i != i_end; ++i)
+ FOR_EACH (LinePartCIter, i, mLineParts)
{
const LinePart &part = *i;
if (part.mY + 50 < mYStart)
diff --git a/src/gui/widgets/extendednamesmodel.cpp b/src/gui/widgets/extendednamesmodel.cpp
index 015d4d685..90deb999c 100644
--- a/src/gui/widgets/extendednamesmodel.cpp
+++ b/src/gui/widgets/extendednamesmodel.cpp
@@ -59,8 +59,7 @@ const Image *ExtendedNamesModel::getImageAt(int i)
void ExtendedNamesModel::clear()
{
mNames.clear();
- for (std::vector<Image*>::iterator it = mImages.begin(),
- it_end = mImages.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<Image*>::iterator, it, mImages)
{
if (*it)
(*it)->decRef();
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 42c9bafcf..e11e27fd6 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -354,9 +354,7 @@ Item *ItemContainer::getSelectedItem() const
void ItemContainer::distributeValueChangedEvent()
{
- for (SelectionListenerIterator i = mSelectionListeners.begin(),
- i_end = mSelectionListeners.end();
- i != i_end; ++i)
+ FOR_EACH (SelectionListenerIterator, i, mSelectionListeners)
{
if (*i)
{
@@ -576,8 +574,7 @@ void ItemContainer::updateMatrix()
int jMult = j * mGridColumns;
const int maxSize = mGridRows * mGridColumns;
- for (std::vector<ItemIdPair*>::const_iterator iter = sortedItems.begin(),
- iter_end = sortedItems.end(); iter != iter_end; ++ iter)
+ FOR_EACH (std::vector<ItemIdPair*>::const_iterator, iter, sortedItems)
{
if (jMult >= maxSize)
break;
@@ -593,11 +590,8 @@ void ItemContainer::updateMatrix()
}
}
- for (int idx = j * mGridColumns + i;
- idx < maxSize; idx ++)
- {
+ for (int idx = j * mGridColumns + i; idx < maxSize; idx ++)
mShowMatrix[idx] = -1;
- }
for (size_t idx = 0, sz = sortedItems.size(); idx < sz; idx ++)
delete sortedItems[idx];
diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp
index 7cb84ae81..8f8ec500c 100644
--- a/src/gui/widgets/setuptouchitem.cpp
+++ b/src/gui/widgets/setuptouchitem.cpp
@@ -56,8 +56,7 @@ TouchActionsModel::TouchActionsModel() :
std::sort(data.begin(), data.end(), touchActionSorter);
int cnt = 0;
- for (std::vector<SetupActionData*>::iterator it = data.begin(),
- it_end = data.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<SetupActionData*>::iterator, it, data)
{
const SetupActionData *data1 = *it;
mNames.push_back(data1->name);
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index e930ab60d..b0999fbd4 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -343,8 +343,7 @@ int TabbedArea::getSelectedTabIndex() const
void TabbedArea::setSelectedTabByName(const std::string &name)
{
- for (TabContainer::const_iterator itr = mTabs.begin(),
- itr_end = mTabs.end(); itr != itr_end; ++itr)
+ FOR_EACH (TabContainer::const_iterator, itr, mTabs)
{
if ((*itr).first && (*itr).first->getCaption() == name)
{
@@ -430,8 +429,7 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
void TabbedArea::updateTabsWidth()
{
mTabsWidth = 0;
- for (TabContainer::const_iterator itr = mTabs.begin(),
- itr_end = mTabs.end(); itr != itr_end; ++itr)
+ FOR_EACH (TabContainer::const_iterator, itr, mTabs)
{
if ((*itr).first)
mTabsWidth += (*itr).first->getWidth();
diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp
index 2ecbb5eed..e0a4b0461 100644
--- a/src/gui/widgets/tabstrip.cpp
+++ b/src/gui/widgets/tabstrip.cpp
@@ -57,8 +57,7 @@ void TabStrip::action(const gcn::ActionEvent &event)
gcn::Widget *const widget = event.getSource();
if (static_cast<Button*>(widget)->isPressed2())
{
- for (WidgetListConstIterator iter = mWidgets.begin();
- iter != mWidgets.end(); ++ iter)
+ FOR_EACH (WidgetListConstIterator, iter, mWidgets)
{
if (*iter != widget)
{
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index 0bda6c869..c8bc862ee 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -79,10 +79,6 @@ void VertContainer::clear()
void VertContainer::widgetResized(const gcn::Event &event A_UNUSED)
{
- for (std::vector<gcn::Widget*>::const_iterator
- it = mResizableWidgets.begin(), it_end = mResizableWidgets.end();
- it != it_end; ++ it)
- {
+ FOR_EACH (std::vector<gcn::Widget*>::const_iterator, it, mResizableWidgets)
(*it)->setWidth(getWidth());
- }
}
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 1c4b926f5..2447e12e4 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -54,8 +54,7 @@ void WindowContainer::scheduleDelete(gcn::Widget *const widget)
void WindowContainer::adjustAfterResize(const int oldScreenWidth,
const int oldScreenHeight)
{
- for (WidgetListIterator i = mWidgets.begin(), i_end = mWidgets.end();
- i != i_end; ++i)
+ FOR_EACH (WidgetListIterator, i, mWidgets)
{
if (Window *const window = dynamic_cast<Window*>(*i))
window->adjustPositionAfterResize(oldScreenWidth, oldScreenHeight);
diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp
index fa54d9008..a72b70f84 100644
--- a/src/guichan/gui.cpp
+++ b/src/guichan/gui.cpp
@@ -284,11 +284,8 @@ namespace gcn
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
- for (std::deque<Widget*>::const_iterator
- iter = mWidgetWithMouseQueue.begin(),
- iter_end = mWidgetWithMouseQueue.end();
- iter != iter_end;
- ++ iter)
+ FOR_EACH (std::deque<Widget*>::const_iterator,
+ iter, mWidgetWithMouseQueue)
{
if (*iter == widget)
{
@@ -801,11 +798,8 @@ namespace gcn
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
- for (std::deque<Widget*>::const_iterator
- iter = mWidgetWithMouseQueue.begin(),
- iter_end = mWidgetWithMouseQueue.end();
- iter != iter_end;
- ++ iter)
+ FOR_EACH (std::deque<Widget*>::const_iterator,
+ iter, mWidgetWithMouseQueue)
{
if (*iter == widget)
{
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 755c6c027..eceb194f9 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -429,8 +429,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
if (!mStorage)
mStorage = new Inventory(Inventory::STORAGE, size);
- for (Ea::InventoryItems::const_iterator it = mInventoryItems.begin(),
- it_end = mInventoryItems.end(); it != it_end; ++it)
+ FOR_EACH (Ea::InventoryItems::const_iterator, it, mInventoryItems)
{
mStorage->setItem((*it).slot, (*it).id, (*it).quantity,
(*it).refine, (*it).color, (*it).equip);
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index 4ad3593f1..eb0d1914b 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -182,8 +182,7 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg)
std::string updateHost = msg.readString(len);
splitToStringVector(loginData.updateHosts, updateHost, '|');
- for (StringVectIter it = loginData.updateHosts.begin(),
- it_end = loginData.updateHosts.end(); it != it_end; ++ it)
+ FOR_EACH (StringVectIter, it, loginData.updateHosts)
{
if (!checkPath(*it))
{
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 8d0613f97..00e2fa9cf 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -146,8 +146,7 @@ void Network::unregisterHandler(MessageHandler *handler)
void Network::clearHandlers()
{
- for (MessageHandlerIterator i = mMessageHandlers.begin();
- i != mMessageHandlers.end(); ++i)
+ FOR_EACH (MessageHandlerIterator, i, mMessageHandlers)
{
if (i->second)
i->second->setNetwork(nullptr);
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 76b832586..a3a9f3345 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -219,8 +219,7 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg)
std::string updateHost = msg.readString(len);
splitToStringVector(loginData.updateHosts, updateHost, '|');
- for (StringVectIter it = loginData.updateHosts.begin(),
- it_end = loginData.updateHosts.end(); it != it_end; ++ it)
+ FOR_EACH (StringVectIter, it, loginData.updateHosts)
{
if (!checkPath(*it))
{
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index e256657e0..d0e0686fc 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -124,8 +124,7 @@ void Network::unregisterHandler(MessageHandler *handler)
void Network::clearHandlers()
{
- for (MessageHandlerIterator i = mMessageHandlers.begin();
- i != mMessageHandlers.end(); ++i)
+ FOR_EACH (MessageHandlerIterator, i, mMessageHandlers)
{
if (i->second)
i->second->setNetwork(nullptr);
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index 752446e5e..362fa0370 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -72,8 +72,7 @@ void Action::setAnimation(const int direction, Animation *const animation)
void Action::setLastFrameDelay(const int delay)
{
- for (AnimationIter it = mAnimations.begin(),
- it_end = mAnimations.end(); it != it_end; ++ it)
+ FOR_EACH (AnimationIter, it, mAnimations)
{
Animation *const animation = (*it).second;
if (!animation)
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 555a3da31..ef36eedac 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -60,8 +60,7 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name,
simpleSort(name, atlases, images, maxSize);
// int k = 0;
- for (std::vector<TextureAtlas*>::iterator it = atlases.begin(),
- it_end = atlases.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases)
{
TextureAtlas *atlas = *it;
if (!atlas)
@@ -95,8 +94,7 @@ void AtlasManager::loadImages(const StringVect &files,
{
ResourceManager *const resman = ResourceManager::getInstance();
- for (StringVectCIter it = files.begin(), it_end = files.end();
- it != it_end; ++ it)
+ FOR_EACH (StringVectCIter, it, files)
{
const std::string str = *it;
// check is image with same name already in cache
@@ -237,9 +235,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *atlas)
graphics->_beginDraw();
// drawing SDL images to surface
- for (std::vector<AtlasItem*>::iterator it = atlas->items.begin(),
- it_end = atlas->items.end();
- it != it_end; ++ it)
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it, atlas->items)
{
AtlasItem *item = *it;
Image *image = item->image;
@@ -267,9 +263,7 @@ void AtlasManager::convertAtlas(TextureAtlas *atlas)
image->incRef();
}
- for (std::vector<AtlasItem*>::iterator it = atlas->items.begin(),
- it_end = atlas->items.end();
- it != it_end; ++ it)
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it, atlas->items)
{
AtlasItem *const item = *it;
// delete SDL Image
@@ -289,8 +283,7 @@ void AtlasManager::convertAtlas(TextureAtlas *atlas)
void AtlasManager::injectToResources(AtlasResource *resource)
{
ResourceManager *const resman = ResourceManager::getInstance();
- for (std::vector<TextureAtlas*>::iterator it = resource->atlases.begin(),
- it_end = resource->atlases.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<TextureAtlas*>::iterator, it, resource->atlases)
{
// add each atlas image to resources
TextureAtlas *const atlas = *it;
@@ -299,9 +292,7 @@ void AtlasManager::injectToResources(AtlasResource *resource)
Image *const image = atlas->atlasImage;
if (image)
resman->addResource(atlas->name, image);
- for (std::vector<AtlasItem*>::iterator it2 = atlas->items.begin(),
- it2_end = atlas->items.end();
- it2 != it2_end; ++ it2)
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items)
{
AtlasItem *const item = *it2;
if (!item)
@@ -316,8 +307,7 @@ void AtlasManager::injectToResources(AtlasResource *resource)
void AtlasManager::moveToDeleted(AtlasResource *resource)
{
ResourceManager *const resman = ResourceManager::getInstance();
- for (std::vector<TextureAtlas*>::iterator it = resource->atlases.begin(),
- it_end = resource->atlases.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<TextureAtlas*>::iterator, it, resource->atlases)
{
// move each atlas image to deleted
TextureAtlas *const atlas = *it;
@@ -329,9 +319,7 @@ void AtlasManager::moveToDeleted(AtlasResource *resource)
// move each atlas image to deleted
resman->moveToDeleted(image);
}
- for (std::vector<AtlasItem*>::iterator it2 = atlas->items.begin(),
- it2_end = atlas->items.end();
- it2 != it2_end; ++ it2)
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items)
{
AtlasItem *const item = *it2;
if (item)
@@ -350,15 +338,12 @@ void AtlasManager::moveToDeleted(AtlasResource *resource)
AtlasResource::~AtlasResource()
{
- for (std::vector<TextureAtlas*>::iterator it = atlases.begin(),
- it_end = atlases.end(); it != it_end; ++ it)
+ FOR_EACH (std::vector<TextureAtlas*>::iterator, it, atlases)
{
TextureAtlas *const atlas = *it;
if (atlas)
{
- for (std::vector<AtlasItem*>::iterator it2 = atlas->items.begin(),
- it2_end = atlas->items.end();
- it2 != it2_end; ++ it2)
+ FOR_EACH (std::vector<AtlasItem*>::iterator, it2, atlas->items)
{
AtlasItem *const item = *it2;
if (item)
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index d29e9d723..d352e79c3 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -175,8 +175,7 @@ void EmoteDB::load()
void EmoteDB::unload()
{
- for (EmoteInfos::const_iterator i = mEmoteInfos.begin(),
- i_end = mEmoteInfos.end(); i != i_end; ++ i)
+ FOR_EACH (EmoteInfos::const_iterator, i, mEmoteInfos)
{
if (i->second)
{
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 5d8083374..5fd0da97b 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -326,8 +326,7 @@ void ItemDB::load()
effect += " / ";
effect += strprintf(gettext(fields[i][1]), value);
}
- for (std::vector<Stat>::const_iterator it = extraStats.begin(),
- it_end = extraStats.end(); it != it_end; ++it)
+ FOR_EACH (std::vector<Stat>::const_iterator, it, extraStats)
{
const int value = XML::getProperty(node, it->tag.c_str(), 0);
if (!value)
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index ca96f5f25..542a96a9e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1024,11 +1024,8 @@ void ResourceManager::scheduleDelete(SDL_Surface *const surface)
void ResourceManager::clearScheduled()
{
BLOCK_START("ResourceManager::clearScheduled")
- for (std::set<SDL_Surface*>::iterator i = deletedSurfaces.begin(),
- i_end = deletedSurfaces.end(); i != i_end; ++i)
- {
+ FOR_EACH (std::set<SDL_Surface*>::iterator, i, deletedSurfaces)
SDL_FreeSurface(*i);
- }
deletedSurfaces.clear();
BLOCK_END("ResourceManager::clearScheduled")
}
@@ -1100,8 +1097,7 @@ void ResourceManager::delayedLoad()
void ResourceManager::removeDelayLoad(const AnimationDelayLoad
*const delayedLoad)
{
- for (DelayedAnimIter it = mDelayedAnimations.begin(),
- it_end = mDelayedAnimations.end(); it != it_end; ++ it)
+ FOR_EACH (DelayedAnimIter, it, mDelayedAnimations)
{
if (*it == delayedLoad)
{
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 28eeb00ed..4af25c8cf 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -62,8 +62,7 @@ Action *SpriteDef::getAction(const std::string &action,
unsigned SpriteDef::findNumber(const unsigned num) const
{
unsigned min = 101;
- for (Actions::const_iterator it = mActions.begin(),
- it_end = mActions.end(); it != it_end; ++ it)
+ FOR_EACH (Actions::const_iterator, it, mActions)
{
const unsigned n = (*it).first;
if (n >= num && n < min)
@@ -107,8 +106,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
void SpriteDef::fixDeadAction()
{
- for (ActionsIter it = mActions.begin(), it_end = mActions.end();
- it != it_end; ++ it)
+ FOR_EACH (ActionsIter, it, mActions)
{
ActionMap *const d = (*it).second;
if (!d)
@@ -123,8 +121,7 @@ void SpriteDef::fixDeadAction()
void SpriteDef::substituteAction(std::string complete, std::string with)
{
- for (ActionsConstIter it = mActions.begin(), it_end = mActions.end();
- it != it_end; ++ it)
+ FOR_EACH (ActionsConstIter, it, mActions)
{
ActionMap *const d = (*it).second;
if (!d)
@@ -330,8 +327,7 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
{
StringVect vals;
splitToStringVector(vals, value, ',');
- for (StringVectCIter it = vals.begin(), it_end = vals.end();
- it != it_end; ++ it)
+ FOR_EACH (StringVectCIter, it, vals)
{
std::string str = *it;
const size_t idx = str.find("-");
@@ -419,27 +415,19 @@ SpriteDef::~SpriteDef()
{
// Actions are shared, so ensure they are deleted only once.
std::set<Action*> actions;
- for (Actions::iterator i = mActions.begin(),
- i_end = mActions.end(); i != i_end; ++i)
+ FOR_EACH (Actions::iterator, i, mActions)
{
- for (ActionMap::iterator it = (*i).second->begin(),
- it_end = (*i).second->end(); it != it_end; ++ it)
- {
+ FOR_EACHP (ActionMap::iterator, it, (*i).second)
actions.insert(it->second);
- }
delete (*i).second;
}
- for (std::set<Action*>::const_iterator i = actions.begin(),
- i_end = actions.end(); i != i_end; ++i)
- {
+ FOR_EACH (std::set<Action*>::const_iterator, i, actions)
delete *i;
- }
mActions.clear();
- for (ImageSetIterator i = mImageSets.begin();
- i != mImageSets.end(); ++i)
+ FOR_EACH (ImageSetIterator, i, mImageSets)
{
if (i->second)
{
@@ -447,6 +435,7 @@ SpriteDef::~SpriteDef()
i->second = nullptr;
}
}
+ mImageSets.clear();
}
SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction)
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 32f4f1e10..381fe7466 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -142,9 +142,7 @@ std::string Wallpaper::getWallpaper(const int width, const int height)
// Wallpaper filename container
StringVect wallPaperVector;
- for (std::vector<WallpaperData>::const_iterator
- iter = wallpaperData.begin(), iter_end = wallpaperData.end();
- iter != iter_end; ++iter)
+ FOR_EACH (std::vector<WallpaperData>::const_iterator, iter, wallpaperData)
{
wp = *iter;
if (wp.width <= width && wp.height <= height)
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index bf4cd5e48..6f10262f6 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -155,8 +155,7 @@ std::string getDesktopDir()
file = std::string(xdg) + "/user-dirs.dirs";
StringVect arr = ResourceManager::loadTextFileLocal(file);
- for (StringVectCIter it = arr.begin(), it_end = arr.end();
- it != it_end; ++ it)
+ FOR_EACH (StringVectCIter, it, arr)
{
std::string str = *it;
if (findCutFirst(str, "XDG_DESKTOP_DIR=\""))
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 14e30b659..7786002e5 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -208,8 +208,7 @@ size_t findI(std::string text, StringVect &list)
{
std::string str = toLower(text);
size_t idx;
- for (StringVectCIter i = list.begin(), i_end = list.end();
- i != i_end; ++ i)
+ FOR_EACH (StringVectCIter, i, list)
{
std::string subStr = *i;
subStr = toLower(subStr);
diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp
index 6378b0290..e15ff0c0a 100644
--- a/src/utils/translation/translationmanager.cpp
+++ b/src/utils/translation/translationmanager.cpp
@@ -63,7 +63,7 @@ PoDict *TranslationManager::loadLang(LangVect lang,
std::string name;
PoParser parser;
- for (LangIter it = lang.begin(), it_end = lang.end(); it != it_end; ++ it)
+ FOR_EACH (LangIter, it, lang)
{
if (*it == "C")
continue;