added function lookingup index matching string

This commit is contained in:
Jeff Hill
2004-08-12 16:45:17 +00:00
parent d41312bac5
commit 87023ea4b2
2 changed files with 12 additions and 0 deletions

View File

@@ -139,3 +139,14 @@ unsigned gddEnumStringTable::getStringLength ( unsigned index ) const
}
}
bool gddEnumStringTable::getIndex ( const char * pString, unsigned & indexOut ) const
{
for ( unsigned index = 0u; index < this->nStrings; index++ ) {
if ( ! strcmp ( pString, this->pStringTable[index].pString ) ) {
indexOut = index;
return true;
}
}
return false;
}

View File

@@ -27,6 +27,7 @@ public:
void getString ( unsigned index, char *pBuf, unsigned size ) const;
const char * getString ( unsigned index ) const;
unsigned getStringLength ( unsigned index ) const;
bool getIndex ( const char * pString, unsigned & index ) const;
unsigned numberOfStrings () const;
private:
unsigned nStrings;