diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-12 21:47:59 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-12 22:01:57 -0600 |
commit | eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a (patch) | |
tree | 8b1fab9acbd0eb568d7f7e0b31f8fd4ac02b18a4 /src/eventmanager.h | |
parent | 2293b1c5ef0bb7378140bf73f1fef03a4504bdd2 (diff) | |
download | mana-client-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.gz mana-client-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.bz2 mana-client-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.xz mana-client-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.zip |
Simplify working with the event system
EventManager has been merged into Event, with some new convinience methods
added.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/eventmanager.h')
-rw-r--r-- | src/eventmanager.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/eventmanager.h b/src/eventmanager.h deleted file mode 100644 index ac6c997c..00000000 --- a/src/eventmanager.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The Mana Client - * Copyright (C) 2010 The Mana Developers - * - * This file is part of The Mana Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef EVENTMANAGER_H -#define EVENTMANAGER_H - -#include "event.h" - -#include <string> -#include <map> -#include <set> - -#define SERVER_NOTICE(message) { \ -Mana::Event event("ServerNotice"); \ -event.setString("message", message); \ -Mana::EventManager::trigger("Notices", event); } - -namespace Mana -{ - -class Listener; - -typedef std::set<Listener *> ListenerSet; -typedef std::map<std::string, ListenerSet > ListenMap; - -class EventManager -{ -public: - // Sends event to all listener on the channel - static void trigger(const std::string &channel, const Event &event); - - // Removes a listener from all channels - static void remove(Listener *listener); - - // Adds or removes a listener to a channel. - static void bind(Listener *listener, const std::string &channel); - static void unbind(Listener *listener, const std::string &channel); - -private: - static ListenMap mBindings; -}; - -} // namespace Mana - -#endif |