diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-05 00:39:57 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-05 00:40:42 +0100 |
commit | 550a02997572b5d090b436b7c05d19c1823556a9 (patch) | |
tree | 65b6bf872711d67d1ed2b7e530bd47cb88a155af /src/channelmanager.cpp | |
parent | 8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1 (diff) | |
parent | 91387e410c9f9ea16c5b41bd1cc576cbd85cf835 (diff) | |
download | mana-550a02997572b5d090b436b7c05d19c1823556a9.tar.gz mana-550a02997572b5d090b436b7c05d19c1823556a9.tar.bz2 mana-550a02997572b5d090b436b7c05d19c1823556a9.tar.xz mana-550a02997572b5d090b436b7c05d19c1823556a9.zip |
Merged with 'master'
Diffstat (limited to 'src/channelmanager.cpp')
-rw-r--r-- | src/channelmanager.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp index a332edbb..2a3f4eff 100644 --- a/src/channelmanager.cpp +++ b/src/channelmanager.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <list> - #include "channelmanager.h" #include "channel.h" @@ -28,7 +26,6 @@ ChannelManager::ChannelManager() { - } ChannelManager::~ChannelManager() @@ -37,39 +34,43 @@ ChannelManager::~ChannelManager() mChannels.clear(); } -Channel* ChannelManager::findById(int id) +Channel *ChannelManager::findById(int id) const { - Channel* channel; - for(std::list<Channel*>::iterator itr = mChannels.begin(); - itr != mChannels.end(); - itr++) + Channel *channel = 0; + for (std::list<Channel*>::const_iterator itr = mChannels.begin(), + end = mChannels.end(); + itr != end; + itr++) { - channel = (*itr); - if(channel->getId() == id) + Channel *c = (*itr); + if (channel->getId() == id) { - return channel; + channel = c; + break; } } - return NULL; + return channel; } -Channel *ChannelManager::findByName(std::string const &name) +Channel *ChannelManager::findByName(const std::string &name) const { - Channel* channel; - if(name != "") + Channel *channel = 0; + if (!name.empty()) { - for(std::list<Channel*>::iterator itr = mChannels.begin(); - itr != mChannels.end(); - itr++) + for (std::list<Channel*>::const_iterator itr = mChannels.begin(), + end = mChannels.end(); + itr != end; + itr++) { - channel = (*itr); - if(channel->getName() == name) + Channel *c = (*itr); + if (c->getName() == name) { - return channel; + channel = c; + break; } } } - return NULL; + return channel; } void ChannelManager::addChannel(Channel *channel) |