S32 Settings::buildSearchList( const char* pattern, bool deepSearch, bool includeDefaults ) { mSearchResults.clear(); SimFieldDictionary* fieldDictionary = getFieldDictionary(); // Get the dynamic field count if ( !fieldDictionary ) return -1; for (SimFieldDictionaryIterator itr(fieldDictionary); *itr; ++itr) { // Fetch Field Entry. SimFieldDictionary::Entry* fieldEntry = *itr;
| 418 | } |
| 419 | */ |
| 420 | const char* Settings::findFirstValue( const char* pattern, bool deepSearch, bool includeDefaults ) |
| 421 | { |
| 422 | mSearchResults.clear(); |
| 423 | |
| 424 | SimFieldDictionary* fieldDictionary = getFieldDictionary(); |
| 425 | // Get the dynamic field count |
| 426 | if ( !fieldDictionary ) |
| 427 | return ""; |
| 428 | |
| 429 | for (SimFieldDictionaryIterator itr(fieldDictionary); *itr; ++itr) |
| 430 | { |
| 431 | // Fetch Field Entry. |
| 432 | SimFieldDictionary::Entry* fieldEntry = *itr; |
| 433 | |
| 434 | // Compare strings, store proper results in vector |
| 435 | String extendedPath = String::ToString(fieldEntry->slotName); |
| 436 | String::SizeType start(0); |
| 437 | String::SizeType slashPos = extendedPath.find('/', 0, String::Right); |
| 438 | String shortPath = extendedPath.substr( start, slashPos ); |
| 439 | |
| 440 | if( deepSearch ) |
| 441 | { |
| 442 | if( shortPath.find( pattern ) != -1 ) |
| 443 | { |
| 444 | if( !includeDefaults && extendedPath.find("_default") != -1 ) |
| 445 | continue; |
| 446 | |
| 447 | String listMember = String::ToString(fieldEntry->slotName); |
| 448 | //listMember.insert(start, " " ); |
| 449 | //listMember.insert(start, String::ToString(fieldEntry->slotName) ); |
| 450 | |
| 451 | mSearchResults.push_back( listMember ); |
| 452 | } |
| 453 | } |
| 454 | else |
| 455 | { |
| 456 | if( shortPath.compare( pattern ) == 0 ) |
| 457 | { |
| 458 | if( !includeDefaults && extendedPath.find("_default") != -1 ) |
| 459 | continue; |
| 460 | |
| 461 | String listMember = String::ToString(fieldEntry->slotName); |
| 462 | //listMember.insert(start, " " ); |
| 463 | //listMember.insert(start, String::ToString(fieldEntry->slotName) ); |
| 464 | |
| 465 | mSearchResults.push_back( listMember ); |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | if( mSearchResults.size() < 1 ) |
| 471 | { |
| 472 | Con::errorf("findFirstValue() : Pattern not found"); |
| 473 | return ""; |
| 474 | } |
| 475 | |
| 476 | mSearchPos = 0; |
| 477 | return mSearchResults[mSearchPos]; |