chore: InputFilter, use auto where possible
This commit is contained in:
parent
a3093fa046
commit
f3fca87e19
1 changed files with 16 additions and 16 deletions
|
|
@ -97,7 +97,7 @@ InputFilter::EFilterStatus InputFilter::KeystrokeCondition::match(const Event &e
|
|||
}
|
||||
|
||||
// check if it's our hotkey
|
||||
IPrimaryScreen::HotKeyInfo *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData());
|
||||
auto *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData());
|
||||
if (kinfo->m_id != m_id) {
|
||||
return kNoMatch;
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ InputFilter::EFilterStatus InputFilter::MouseButtonCondition::match(const Event
|
|||
|
||||
// check if it's the right button and modifiers. ignore modifiers
|
||||
// that cannot be combined with a mouse button.
|
||||
IPlatformScreen::ButtonInfo *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||
auto *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||
if (minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) {
|
||||
return kNoMatch;
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ std::string InputFilter::ScreenConnectedCondition::format() const
|
|||
InputFilter::EFilterStatus InputFilter::ScreenConnectedCondition::match(const Event &event)
|
||||
{
|
||||
if (event.getType() == m_events->forServer().connected()) {
|
||||
Server::ScreenConnectedInfo *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||
auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||
if (m_screen == info->m_screen || m_screen.empty()) {
|
||||
return kActivate;
|
||||
}
|
||||
|
|
@ -328,7 +328,7 @@ void InputFilter::SwitchToScreenAction::perform(const Event &event)
|
|||
// event if it has one.
|
||||
std::string screen = m_screen;
|
||||
if (screen.empty() && event.getType() == m_events->forServer().connected()) {
|
||||
Server::ScreenConnectedInfo *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||
auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||
screen = info->m_screen;
|
||||
}
|
||||
|
||||
|
|
@ -600,10 +600,10 @@ InputFilter::Rule &InputFilter::Rule::operator=(const Rule &rule)
|
|||
void InputFilter::Rule::clear()
|
||||
{
|
||||
delete m_condition;
|
||||
for (ActionList::iterator i = m_activateActions.begin(); i != m_activateActions.end(); ++i) {
|
||||
for (auto i = m_activateActions.begin(); i != m_activateActions.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
for (ActionList::iterator i = m_deactivateActions.begin(); i != m_deactivateActions.end(); ++i) {
|
||||
for (auto i = m_deactivateActions.begin(); i != m_deactivateActions.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
|
||||
|
|
@ -618,10 +618,10 @@ void InputFilter::Rule::copy(const Rule &rule)
|
|||
if (rule.m_condition != nullptr) {
|
||||
m_condition = rule.m_condition->clone();
|
||||
}
|
||||
for (ActionList::const_iterator i = rule.m_activateActions.begin(); i != rule.m_activateActions.end(); ++i) {
|
||||
for (auto i = rule.m_activateActions.begin(); i != rule.m_activateActions.end(); ++i) {
|
||||
m_activateActions.push_back((*i)->clone());
|
||||
}
|
||||
for (ActionList::const_iterator i = rule.m_deactivateActions.begin(); i != rule.m_deactivateActions.end(); ++i) {
|
||||
for (auto i = rule.m_deactivateActions.begin(); i != rule.m_deactivateActions.end(); ++i) {
|
||||
m_deactivateActions.push_back((*i)->clone());
|
||||
}
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ bool InputFilter::Rule::handleEvent(const Event &event)
|
|||
}
|
||||
|
||||
// perform actions
|
||||
for (ActionList::const_iterator i = actions->begin(); i != actions->end(); ++i) {
|
||||
for (auto i = actions->begin(); i != actions->end(); ++i) {
|
||||
LOG((CLOG_DEBUG1 "hotkey: %s", (*i)->format().c_str()));
|
||||
(*i)->perform(event);
|
||||
}
|
||||
|
|
@ -724,7 +724,7 @@ std::string InputFilter::Rule::format() const
|
|||
s += " = ";
|
||||
|
||||
// activate actions
|
||||
ActionList::const_iterator i = m_activateActions.begin();
|
||||
auto i = m_activateActions.begin();
|
||||
if (i != m_activateActions.end()) {
|
||||
s += (*i)->format();
|
||||
while (++i != m_activateActions.end()) {
|
||||
|
|
@ -834,7 +834,7 @@ void InputFilter::setPrimaryClient(PrimaryClient *client)
|
|||
}
|
||||
|
||||
if (m_primaryClient != nullptr) {
|
||||
for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
for (auto rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
rule->disable(m_primaryClient);
|
||||
}
|
||||
|
||||
|
|
@ -884,7 +884,7 @@ void InputFilter::setPrimaryClient(PrimaryClient *client)
|
|||
new TMethodEventJob<InputFilter>(this, &InputFilter::handleEvent)
|
||||
);
|
||||
|
||||
for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
for (auto rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
rule->enable(m_primaryClient);
|
||||
}
|
||||
}
|
||||
|
|
@ -893,7 +893,7 @@ void InputFilter::setPrimaryClient(PrimaryClient *client)
|
|||
std::string InputFilter::format(const std::string &linePrefix) const
|
||||
{
|
||||
std::string s;
|
||||
for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) {
|
||||
for (auto i = m_ruleList.begin(); i != m_ruleList.end(); ++i) {
|
||||
s += linePrefix;
|
||||
s += i->format();
|
||||
s += "\n";
|
||||
|
|
@ -916,10 +916,10 @@ bool InputFilter::operator==(const InputFilter &x) const
|
|||
// compare rule lists. the easiest way to do that is to format each
|
||||
// rule into a string, sort the strings, then compare the results.
|
||||
std::vector<std::string> aList, bList;
|
||||
for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) {
|
||||
for (auto i = m_ruleList.begin(); i != m_ruleList.end(); ++i) {
|
||||
aList.push_back(i->format());
|
||||
}
|
||||
for (RuleList::const_iterator i = x.m_ruleList.begin(); i != x.m_ruleList.end(); ++i) {
|
||||
for (auto i = x.m_ruleList.begin(); i != x.m_ruleList.end(); ++i) {
|
||||
bList.push_back(i->format());
|
||||
}
|
||||
std::partial_sort(aList.begin(), aList.end(), aList.end());
|
||||
|
|
@ -940,7 +940,7 @@ void InputFilter::handleEvent(const Event &event, void *)
|
|||
);
|
||||
|
||||
// let each rule try to match the event until one does
|
||||
for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
for (auto rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) {
|
||||
if (rule->handleEvent(myEvent)) {
|
||||
// handled
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue