| 237 | } |
| 238 | |
| 239 | void 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 | } |
| 286 | void SimFieldDictionary::printFields(SimObject *obj) |
| 287 | { |
| 288 | const AbstractClassRep::FieldList &list = obj->getFieldList(); |
nothing calls this directly
no test coverage detected