MCPcopy Create free account
hub / github.com/buggins/coolreader / find

Method find

tinydict/tinydict.cpp:357–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357int TinyDictWordList::find( const char * prefix )
358{
359 if ( !count )
360 return -1;
361 int a = 0;
362 int b = count;
363 for ( ;a < b-1; ) {
364 int c = (a + b) / 2;
365 int res = list[c]->compare( prefix );
366 if ( !res )
367 return c;
368 if ( res < 0 ) {
369 a = c + 1;
370 } else {
371 b = c;
372 }
373 }
374 if ( a==0 || list[a]->compare( prefix )<0 )
375 return a;
376 return a - 1;
377}
378
379bool TinyDictWord::match( const char * str, bool exact ) const
380{

Callers 1

mainFunction · 0.45

Calls 9

getIndexPosMethod · 0.80
compareMethod · 0.45
clearMethod · 0.45
getMethod · 0.45
getIndexMethod · 0.45
matchMethod · 0.45
addMethod · 0.45
setDictMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected