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

Method writeFields

Engine/source/console/simFieldDictionary.cpp:239–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop)
240{
241 const AbstractClassRep::FieldList &list = obj->getFieldList();
242 Vector<Entry *> flist(__FILE__, __LINE__);
243
244 for(U32 i = 0; i < HashTableSize; i++)
245 {
246 for(Entry *walk = mHashTable[i];walk; walk = walk->next)
247 {
248 // make sure we haven't written this out yet:
249 U32 i;
250 for(i = 0; i < list.size(); i++)
251 if(list[i].pFieldname == walk->slotName)
252 break;
253
254 if(i != list.size())
255 continue;
256
257
258 if (!obj->writeField(walk->slotName, walk->value))
259 continue;
260
261 flist.push_back(walk);
262 }
263 }
264
265 // Sort Entries to prevent version control conflicts
266 dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries);
267
268 // Save them out
269 for(Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
270 {
271 U32 nBufferSize = (dStrlen( (*itr)->value ) * 2) + dStrlen( (*itr)->slotName ) + 16;
272 FrameTemp<char> expandedBuffer( nBufferSize );
273
274 stream.writeTabs(tabStop+1);
275
276 const char *typeName = (*itr)->type && (*itr)->type->getTypeID() != TypeString ? (*itr)->type->getTypeName() : "";
277 dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName);
278 if ( (*itr)->value )
279 expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value);
280 dStrcat(expandedBuffer, "\";\r\n");
281
282 stream.write(dStrlen(expandedBuffer),expandedBuffer);
283 }
284
285}
286void SimFieldDictionary::printFields(SimObject *obj)
287{
288 const AbstractClassRep::FieldList &list = obj->getFieldList();

Callers

nothing calls this directly

Calls 15

dQsortFunction · 0.85
dSprintfFunction · 0.85
expandEscapeFunction · 0.85
dStrcatFunction · 0.85
writeTabsMethod · 0.80
getTypeIDMethod · 0.80
dStrlenFunction · 0.50
sizeMethod · 0.45
writeFieldMethod · 0.45
push_backMethod · 0.45
addressMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected