• Main Page
  • Classes
  • Files
  • File List

Swiften/EventLoop/DummyEventLoop.h

00001 /*
00002  * Copyright (c) 2010 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <deque>
00010 
00011 #include <Swiften/Base/API.h>
00012 #include <Swiften/EventLoop/EventLoop.h>
00013 
00014 namespace Swift {
00015   class SWIFTEN_API DummyEventLoop : public EventLoop {
00016     public:
00017       DummyEventLoop();
00018       ~DummyEventLoop();
00019 
00020       void processEvents() {
00021         while (!events_.empty()) {
00022           handleEvent(events_[0]);
00023           events_.pop_front();
00024         }
00025       }
00026 
00027       bool hasEvents() {
00028         return !events_.empty();
00029       }
00030 
00031       virtual void post(const Event& event) {
00032         events_.push_back(event);
00033       }
00034 
00035     private:
00036       std::deque<Event> events_;
00037   };
00038 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1