ScummVM API documentation
event.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Copyright 2020 Google
21  *
22  */
23 #ifndef HADESCH_EVENT_H
24 #define HADESCH_EVENT_H
25 
26 namespace Hadesch {
27 
28 class EventHandler {
29 public:
30  virtual void operator()() = 0;
31  virtual ~EventHandler() {}
32 };
33 
35 public:
36  void operator()() const;
37  bool operator==(int eventId) const;
38 
39  EventHandlerWrapper(int eventId) {
40  _eventId = eventId;
41  }
42 
44  _eventId = -1;
45  }
46 
48  _handler = handler;
49  _eventId = -1;
50  }
51 
52  Common::String getDebugString() const {
53  return Common::String::format("eventid=%d, handler is %s", _eventId,
54  !!_handler ? "valid" : "null");
55  }
56 
57 private:
59  int _eventId;
60 };
61 }
62 
63 #endif
Definition: event.h:28
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: event.h:34
Definition: ambient.h:30
Definition: ptr.h:159