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