| 140 | } |
| 141 | |
| 142 | void 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 | } |
| 188 | void SimFieldDictionary::printFields(SimObject *obj) |
| 189 | { |
| 190 | const AbstractClassRep::FieldList &list = obj->getFieldList(); |
nothing calls this directly
no test coverage detected