Adonthell  0.4
event_handler_base.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000/2001/2002 Kai Sterker <kai.sterker@gmail.com>
3  Part of the Adonthell Project <http://adonthell.nongnu.org>
4 
5  Adonthell is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  Adonthell is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Adonthell. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 /**
21  * @file event_handler_base.h
22  * @author Kai Sterker <kai.sterker@gmail.com>
23  *
24  * @brief Declares the base class for event handlers.
25  *
26  */
27 
28 #ifndef EVENT_HANDLER_BASE_H__
29 #define EVENT_HANDLER_BASE_H__
30 
31 #include "event.h"
32 
33 /**
34  * This is the base class for actual event handlers. It
35  * keeps track of registered scripts, recieves triggered events
36  * and executes scripts handling those events
37  */
39 {
40 public:
41 
42  /**
43  * Destructor
44  */
45  virtual ~event_handler_base () {}
46 
47  /**
48  * Registers an %event.
49  *
50  * @param ev pointer to the %event to register.
51  */
52  virtual void register_event (event* ev) = 0;
53 
54  /**
55  * Unregister an %event.
56  *
57  * @param ev pointer to the %event to unregister.
58  */
59  virtual void remove_event (event* ev) = 0;
60 
61  /**
62  * Check if an %event corresponding to ev exists, and execute it.
63  *
64  * @param ev %event to raise.
65  */
66  virtual void raise_event (const event* ev) = 0;
67 };
68 
69 #endif // EVENT_HANDLER_BASE_H__
This is the base class for actual event handlers.
virtual void remove_event(event *ev)=0
Unregister an event.
Base class for events.
Definition: event.h:75
virtual void raise_event(const event *ev)=0
Check if an event corresponding to ev exists, and execute it.
virtual ~event_handler_base()
Destructor.
Declares the event class.
virtual void register_event(event *ev)=0
Registers an event.