bindings: move some code from .h to .cpp file
This commit is contained in:
@@ -592,3 +592,27 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
if (notBound(k = stringToKey("-")))
|
if (notBound(k = stringToKey("-")))
|
||||||
bind(k, Actions::Type::VolumeDown);
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -132,31 +132,13 @@ class BindingsConfiguration
|
|||||||
public:
|
public:
|
||||||
typedef BindingsMap::value_type::second_type::iterator BindingIterator;
|
typedef BindingsMap::value_type::second_type::iterator BindingIterator;
|
||||||
typedef BindingsMap::value_type::second_type::const_iterator ConstBindingIterator;
|
typedef BindingsMap::value_type::second_type::const_iterator ConstBindingIterator;
|
||||||
|
typedef std::pair<BindingIterator, BindingIterator> BindingIteratorPair;
|
||||||
|
|
||||||
bool read(const std::string &file);
|
bool read(const std::string &file);
|
||||||
void generateDefaults();
|
void generateDefaults();
|
||||||
|
|
||||||
const Command *findCommand(const std::string &name) {
|
const Command *findCommand(const std::string &name);
|
||||||
const Command *ptr = 0;
|
BindingIteratorPair get(const Key &k);
|
||||||
auto it = m_commands.find(name);
|
|
||||||
if (it != m_commands.end())
|
|
||||||
ptr = &it->second;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<BindingIterator, BindingIterator> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
BindingsMap::const_iterator begin() const { return m_bindings.begin(); }
|
BindingsMap::const_iterator begin() const { return m_bindings.begin(); }
|
||||||
BindingsMap::const_iterator end() const { return m_bindings.end(); }
|
BindingsMap::const_iterator end() const { return m_bindings.end(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user