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

Method writeFields

engine/source/sim/simFieldDictionary.cc:142–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop)
143{
144
145 const AbstractClassRep::FieldList &list = obj->getFieldList();
146 Vector<Entry *> flist(__FILE__, __LINE__);
147
148 for(U32 i = 0; i < HashTableSize; i++)
149 {
150 for(Entry *walk = mHashTable[i];walk; walk = walk->next)
151 {
152 // make sure we haven't written this out yet:
153 U32 i;
154 for(i = 0; i < (U32)list.size(); i++)
155 if(list[i].pFieldname == walk->slotName)
156 break;
157
158 if(i != list.size())
159 continue;
160
161
162 if (!obj->writeField(walk->slotName, walk->value))
163 continue;
164
165 flist.push_back(walk);
166 }
167 }
168
169 // Sort Entries to prevent version control conflicts
170 dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries);
171
172 // Save them out
173 for(Vector<Entry *>::iterator itr = flist.begin(); itr != flist.end(); itr++)
174 {
175 U32 nBufferSize = (dStrlen( (*itr)->value ) * 2) + dStrlen( (*itr)->slotName ) + 16;
176 FrameTemp<char> expandedBuffer( nBufferSize );
177
178 stream.writeTabs(tabStop+1);
179
180 dSprintf(expandedBuffer, nBufferSize, "%s = \"", (*itr)->slotName);
181 expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value);
182 dStrcat(expandedBuffer, "\";\r\n");
183
184 stream.write(dStrlen(expandedBuffer),expandedBuffer);
185 }
186
187}
188void SimFieldDictionary::printFields(SimObject *obj)
189{
190 const AbstractClassRep::FieldList &list = obj->getFieldList();

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected