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

Method write

Engine/source/util/settings.cpp:196–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

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

Calls 11

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

Tested by

no test coverage detected