Small code tidy up (moved some code out of header file into cpp file where it belongs)

This commit is contained in:
Nik Henson 2011-06-22 20:18:40 +00:00
parent 9297c5b8d2
commit 2e14ec3e6e
2 changed files with 35 additions and 20 deletions

View file

@ -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<CInput*>::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;

View file

@ -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<CInput*>::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.
*/