added function lookingup index matching string
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user