diff --git a/Src/Inputs/Inputs.cpp b/Src/Inputs/Inputs.cpp index ca9a892..74430fa 100644 --- a/Src/Inputs/Inputs.cpp +++ b/Src/Inputs/Inputs.cpp @@ -233,6 +233,26 @@ void CInputs::PrintConfigureInputsHelp() puts(""); } +unsigned CInputs::Count() +{ + return (unsigned)m_inputs.size(); +} + +CInput *CInputs::operator[](const unsigned index) +{ + return m_inputs[index]; +} + +CInput *CInputs::operator[](const char *idOrLabel) +{ + for (vector::iterator it = m_inputs.begin(); it != m_inputs.end(); it++) + { + if (stricmp((*it)->id, idOrLabel) == 0 || stricmp((*it)->label, idOrLabel) == 0) + return *it; + } + return NULL; +} + CInputSystem *CInputs::GetInputSystem() { return m_system; diff --git a/Src/Inputs/Inputs.h b/Src/Inputs/Inputs.h index e5f774c..f6e8d24 100644 --- a/Src/Inputs/Inputs.h +++ b/Src/Inputs/Inputs.h @@ -148,31 +148,26 @@ public: */ ~CInputs(); + /* + * Returns the number of available inputs. + */ + unsigned Count(); + + /* + * Returns the input with the given index. + */ + CInput *operator[](const unsigned index); + + /* + * Returns the input with the given id or label. + */ + CInput *operator[](const char *idOrLabel); + /* * Returns the assigned input system. */ CInputSystem *GetInputSystem(); - unsigned Count() - { - return (unsigned)m_inputs.size(); - } - - CInput *operator[](const unsigned index) - { - return m_inputs[index]; - } - - CInput *operator[](const char *idOrLabel) - { - for (vector::iterator it = m_inputs.begin(); it != m_inputs.end(); it++) - { - if (stricmp((*it)->id, idOrLabel) == 0 || stricmp((*it)->label, idOrLabel) == 0) - return *it; - } - return NULL; - } - /* * Initializes the inputs. Must be called before any other methods are used. */