Skip to content

Commit

Permalink
Strip query_ prefix from method names
Browse files Browse the repository at this point in the history
There is sufficient context for function overloading to distinguish which method should be called. The main difference is if a `KeyModifier` is already known, or needs to be queried from the current keyboard state. When no `KeyModifier` is given, a reasonable assumption is to query for the information.

Removing the `_` makes the name more consistent with other methods, which prefer camelCase.
  • Loading branch information
DanRStevens committed Jan 28, 2024
1 parent d6346ab commit dbfe494
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions NAS2D/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ bool EventHandler::control(KeyModifier mod)
/**
* Queries state of the Shift key modifier.
*/
bool EventHandler::query_shift() const
bool EventHandler::shift() const
{
return shift(static_cast<KeyModifier>(SDL_GetModState()));
}
Expand All @@ -799,7 +799,7 @@ bool EventHandler::query_shift() const
/**
* Queries state of the Shift key modifier.
*/
bool EventHandler::query_numlock() const
bool EventHandler::numlock() const
{
return numlock(static_cast<KeyModifier>(SDL_GetModState()));
}
Expand All @@ -808,7 +808,7 @@ bool EventHandler::query_numlock() const
/**
* Queries state of the Shift key modifier.
*/
bool EventHandler::query_control() const
bool EventHandler::control() const
{
return control(static_cast<KeyModifier>(SDL_GetModState()));
}
Expand Down
6 changes: 3 additions & 3 deletions NAS2D/EventHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ namespace NAS2D
static bool control(KeyModifier mod);
static bool alt(KeyModifier mod);

bool query_shift() const;
bool query_numlock() const;
bool query_control() const;
bool shift() const;
bool numlock() const;
bool control() const;

void pump();

Expand Down

0 comments on commit dbfe494

Please sign in to comment.