MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getIndexFromKeyValue

Method getIndexFromKeyValue

Engine/source/console/arrayObject.cpp:217–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215//-----------------------------------------------------------------------------
216
217S32 ArrayObject::getIndexFromKeyValue( const String &key, const String &value ) const
218{
219 S32 currentIndex = mMax(mCurrentIndex, 0);
220 S32 foundIndex = -1;
221 for ( S32 i = currentIndex; i < mArray.size(); i++ )
222 {
223 if ( isEqual( mArray[i].key, key ) && isEqual( mArray[i].value, value ) )
224 {
225 foundIndex = i;
226 break;
227 }
228 }
229
230 if ( foundIndex < 0 )
231 {
232 for ( S32 i = 0; i < currentIndex; i++ )
233 {
234 if ( isEqual( mArray[i].key, key ) && isEqual( mArray[i].value, value ) )
235 {
236 foundIndex = i;
237 break;
238 }
239 }
240 }
241
242 return foundIndex;
243}
244
245//-----------------------------------------------------------------------------
246

Callers

nothing calls this directly

Calls 3

mMaxFunction · 0.85
isEqualFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected