bindings: move some code from .h to .cpp file

This commit is contained in:
Andrzej Rybczak
2015-05-09 19:32:48 +02:00
parent 043e309e24
commit 11735b42b3
2 changed files with 28 additions and 22 deletions

View File

@@ -592,3 +592,27 @@ void BindingsConfiguration::generateDefaults()
if (notBound(k = stringToKey("-")))
bind(k, Actions::Type::VolumeDown);
}
const Command *BindingsConfiguration::findCommand(const std::string &name)
{
const Command *ptr = nullptr;
auto it = m_commands.find(name);
if (it != m_commands.end())
ptr = &it->second;
return ptr;
}
BindingsConfiguration::BindingIteratorPair BindingsConfiguration::get(const Key &k)
{
std::pair<BindingIterator, BindingIterator> result;
auto it = m_bindings.find(k);
if (it != m_bindings.end()) {
result.first = it->second.begin();
result.second = it->second.end();
} else {
auto list_end = m_bindings.begin()->second.end();
result.first = list_end;
result.second = list_end;
}
return result;
}