ConsoleMethod(Settings, buildSearchList, void, 2, 2, "settingObj.buildSearchList();") { object->buildSearchList( "foobar" ); } */
| 502 | } |
| 503 | */ |
| 504 | void SettingSaveNode::addValue(const UTF8 *name, const UTF8 *value) |
| 505 | { |
| 506 | String nameString(name); |
| 507 | S32 groupCount = getGroupCount(nameString); |
| 508 | SettingSaveNode *parentNode = this; |
| 509 | |
| 510 | // let's check to make sure all these groups exist already |
| 511 | for(S32 i=0; i<groupCount; i++) |
| 512 | { |
| 513 | String groupName = getGroup(nameString, i); |
| 514 | if(!groupName.isEmpty()) |
| 515 | { |
| 516 | bool found = false; |
| 517 | // loop through all of our nodes to find if this one exists, |
| 518 | // if it does we want to use it |
| 519 | for(S32 j=0; j<parentNode->mGroupNodes.size(); j++) |
| 520 | { |
| 521 | SettingSaveNode *node = parentNode->mGroupNodes[j]; |
| 522 | |
| 523 | if(!node->mIsGroup) |
| 524 | continue; |
| 525 | |
| 526 | if(node->mName.compare(groupName) == 0) |
| 527 | { |
| 528 | parentNode = node; |
| 529 | found = true; |
| 530 | break; |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | // not found, so we create it |
| 535 | if(!found) |
| 536 | { |
| 537 | SettingSaveNode *node = new SettingSaveNode(groupName, true); |
| 538 | parentNode->mGroupNodes.push_back(node); |
| 539 | parentNode = node; |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | // now we can properly set our actual value |
| 545 | String settingNameString = getSettingName(name); |
| 546 | String valueString(value); |
| 547 | SettingSaveNode *node = new SettingSaveNode(settingNameString, valueString); |
| 548 | parentNode->mSettingNodes.push_back(node); |
| 549 | } |
| 550 | |
| 551 | S32 SettingSaveNode::getGroupCount(const String &name) |
| 552 | { |