From 2e14ec3e6e4a08613c415f0a6f056b29d7d5fa9e Mon Sep 17 00:00:00 2001 From: Nik Henson Date: Wed, 22 Jun 2011 20:18:40 +0000 Subject: [PATCH] Small code tidy up (moved some code out of header file into cpp file where it belongs) --- Src/Inputs/Inputs.cpp | 20 ++++++++++++++++++++ Src/Inputs/Inputs.h | 35 +++++++++++++++-------------------- 2 files changed, 35 insertions(+), 20 deletions(-) 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. */