openMSX
Event.cc
Go to the documentation of this file.
1 #include "Event.hh"
2 #include "TclObject.hh"
3 
4 namespace openmsx {
5 
6 // class Event
7 
8 std::string Event::toString() const
9 {
10  return std::string(toTclList().getString());
11 }
12 
13 bool Event::operator<(const Event& other) const
14 {
15  return (getType() != other.getType())
16  ? (getType() < other.getType())
17  : lessImpl(other);
18 }
19 bool Event::operator>(const Event& other) const
20 {
21  return other < *this;
22 }
23 bool Event::operator<=(const Event& other) const
24 {
25  return !(other < *this);
26 }
27 bool Event::operator>=(const Event& other) const
28 {
29  return !(*this < other);
30 }
31 
32 bool Event::operator==(const Event& other) const
33 {
34  return !(*this < other) && !(other < *this);
35 }
36 bool Event::operator!=(const Event& other) const
37 {
38  return !(*this == other);
39 }
40 
42 {
43  return makeTclList("simple", int(getType()));
44 }
45 
46 bool SimpleEvent::lessImpl(const Event& /*other*/) const
47 {
48  return false;
49 }
50 
51 } // namespace openmsx
bool operator>=(const Event &other) const
Definition: Event.cc:27
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
Definition: Event.cc:41
bool operator>(const Event &other) const
Definition: Event.cc:19
bool operator==(const Event &other) const
Definition: Event.cc:32
bool operator<(const Event &other) const
Definition: Event.cc:13
virtual TclObject toTclList() const =0
Similar to toString(), but retains the structure of the event.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
EventType getType() const
Definition: Event.hh:87
bool operator!=(const Event &other) const
Definition: Event.cc:36
std::string toString() const
Get a string representation of this event.
Definition: Event.cc:8
bool lessImpl(const Event &other) const override
Definition: Event.cc:46
TclObject makeTclList(Args &&... args)
Definition: TclObject.hh:280
bool operator<=(const Event &other) const
Definition: Event.cc:23