| 101 | } |
| 102 | |
| 103 | void Settings::remove(const UTF8 *settingName, bool includeDefaults) |
| 104 | { |
| 105 | // Fetch Dynamic-Field Dictionary. |
| 106 | SimFieldDictionary* pFieldDictionary = getFieldDictionary(); |
| 107 | |
| 108 | // Any Field Dictionary? |
| 109 | if ( pFieldDictionary == NULL ) |
| 110 | { |
| 111 | // No, so we're done. |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | String name; |
| 116 | buildGroupString(name, settingName); |
| 117 | StringTableEntry nameEntry = StringTable->insert(name.c_str()); |
| 118 | StringTableEntry nameEntryDefault = StringTable->insert( String::ToString("%s%s",name.c_str(), "_default") ); |
| 119 | |
| 120 | // Iterate fields. |
| 121 | for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr ) |
| 122 | { |
| 123 | // Fetch Field Entry. |
| 124 | SimFieldDictionary::Entry* fieldEntry = *itr; |
| 125 | |
| 126 | // is this a field of our current group |
| 127 | if ( (String::compare(nameEntry, "") == 0) || |
| 128 | String::compare( nameEntry, fieldEntry->slotName ) == 0 || |
| 129 | (includeDefaults && String::compare( nameEntryDefault, fieldEntry->slotName ) == 0) ) |
| 130 | { |
| 131 | // Yes, so remove it. |
| 132 | pFieldDictionary->setFieldValue( fieldEntry->slotName, "" ); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | void Settings::buildGroupString(String &name, const UTF8 *settingName) |
| 138 | { |
no test coverage detected