mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: fold event-related functions into event class
Not strictly necessary, but more idiomatic C++ and less polution of the global namespace. This one is so trivial that there seems to be no reason not to do it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c27314d603
commit
e237f29fb2
12 changed files with 28 additions and 29 deletions
|
@ -49,15 +49,14 @@ event::~event()
|
|||
{
|
||||
}
|
||||
|
||||
bool event_is_gaschange(const struct event &ev)
|
||||
bool event::is_gaschange() const
|
||||
{
|
||||
return ev.type == SAMPLE_EVENT_GASCHANGE ||
|
||||
ev.type == SAMPLE_EVENT_GASCHANGE2;
|
||||
return type == SAMPLE_EVENT_GASCHANGE || type == SAMPLE_EVENT_GASCHANGE2;
|
||||
}
|
||||
|
||||
bool event_is_divemodechange(const struct event &ev)
|
||||
bool event::is_divemodechange() const
|
||||
{
|
||||
return ev.name == "modechange";
|
||||
return name == "modechange";
|
||||
}
|
||||
|
||||
bool event::operator==(const event &b) const
|
||||
|
@ -66,9 +65,9 @@ bool event::operator==(const event &b) const
|
|||
std::tie(b.time.seconds, b.type, b.flags, b.value, b.name);
|
||||
}
|
||||
|
||||
extern enum event_severity get_event_severity(const struct event &ev)
|
||||
enum event_severity event::get_severity() const
|
||||
{
|
||||
switch (ev.flags & SAMPLE_FLAGS_SEVERITY_MASK) {
|
||||
switch (flags & SAMPLE_FLAGS_SEVERITY_MASK) {
|
||||
case SAMPLE_FLAGS_SEVERITY_INFO:
|
||||
return EVENT_SEVERITY_INFO;
|
||||
case SAMPLE_FLAGS_SEVERITY_WARN:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue