MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / addValue

Method addValue

Engine/source/util/settings.cpp:500–545  ·  view source on GitHub ↗

ConsoleMethod(Settings, buildSearchList, void, 2, 2, "settingObj.buildSearchList();") { object->buildSearchList( "foobar" ); } */

Source from the content-addressed store, hash-verified

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

Callers 1

writeMethod · 0.45

Calls 4

isEmptyMethod · 0.45
sizeMethod · 0.45
compareMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected