MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / write

Method write

Engine/source/util/settings.cpp:200–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200bool Settings::write()
201{
202 // Fetch Dynamic-Field Dictionary.
203 SimFieldDictionary* pFieldDictionary = getFieldDictionary();
204
205 // Any Field Dictionary?
206 if ( pFieldDictionary == NULL )
207 {
208 // No, so we're done.
209 return false;
210 }
211
212/*
213 // Iterate fields.
214 for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr )
215 {
216 // Fetch Field Entry.
217 SimFieldDictionary::Entry* fieldEntry = *itr;
218
219 String check(fieldEntry->slotName);
220 String::SizeType pos = check.find("_default");
221 if(pos != String::NPos)
222 continue;
223
224 // let's build our XML doc
225 document->pushNewElement("dynamicField");
226 document->setAttribute("name", fieldEntry->slotName);
227 document->addText(fieldEntry->value);
228 document->popElement();
229 }
230*/
231 SimXMLDocument *document = new SimXMLDocument();
232 document->registerObject();
233 document->addHeader();
234
235 document->pushNewElement(getName());
236
237 SettingSaveNode *node = new SettingSaveNode();
238 // Iterate fields.
239 for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr )
240 {
241 // Fetch Field Entry.
242 SimFieldDictionary::Entry* fieldEntry = *itr;
243
244 String check(fieldEntry->slotName);
245 if(check.find("_default") != String::NPos || check.find("_type") != String::NPos)
246 continue;
247
248 node->addValue(fieldEntry->slotName, fieldEntry->value);
249 }
250
251 node->buildDocument(document, true);
252 node->clear();
253 delete node;
254
255 bool saved = document->saveFile(mFile);
256 document->deleteObject();
257

Callers 4

settings.cppFile · 0.45
initMethod · 0.45
endFrameMethod · 0.45
newlineMethod · 0.45

Calls 10

pushNewElementMethod · 0.80
buildDocumentMethod · 0.80
saveFileMethod · 0.80
getNameFunction · 0.50
registerObjectMethod · 0.45
addHeaderMethod · 0.45
findMethod · 0.45
addValueMethod · 0.45
clearMethod · 0.45
deleteObjectMethod · 0.45

Tested by

no test coverage detected