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