Make accessors in RelativeWheel const
This commit is contained in:
@@ -25,8 +25,8 @@ class RelativeWheel {
|
||||
auto Update() -> void;
|
||||
auto SetEnabled(bool) -> void;
|
||||
|
||||
auto is_clicking() -> bool;
|
||||
auto ticks() -> std::int_fast16_t;
|
||||
auto is_clicking() const -> bool;
|
||||
auto ticks() const -> std::int_fast16_t;
|
||||
|
||||
// Not copyable or movable.
|
||||
RelativeWheel(const RelativeWheel&) = delete;
|
||||
|
||||
@@ -65,22 +65,18 @@ auto RelativeWheel::SetEnabled(bool en) -> void {
|
||||
is_enabled_ = en;
|
||||
}
|
||||
|
||||
auto RelativeWheel::is_clicking() -> bool {
|
||||
auto RelativeWheel::is_clicking() const -> bool {
|
||||
if (!is_enabled_) {
|
||||
return false;
|
||||
}
|
||||
bool ret = is_clicking_;
|
||||
is_clicking_ = 0;
|
||||
return ret;
|
||||
return is_clicking_;
|
||||
}
|
||||
|
||||
auto RelativeWheel::ticks() -> std::int_fast16_t {
|
||||
auto RelativeWheel::ticks() const -> std::int_fast16_t {
|
||||
if (!is_enabled_) {
|
||||
return 0;
|
||||
}
|
||||
int_fast16_t t = ticks_;
|
||||
ticks_ = 0;
|
||||
return t;
|
||||
return ticks_;
|
||||
}
|
||||
|
||||
} // namespace drivers
|
||||
|
||||
Reference in New Issue
Block a user