MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / determineMapFormat

Function determineMapFormat

radiantcore/map/algorithm/Import.cpp:271–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271MapFormatPtr determineMapFormat(std::istream& stream, const std::string& type)
272{
273 // Get all registered map formats matching the extension
274 auto availableFormats = type.empty() ?
275 GlobalMapFormatManager().getAllMapFormats() :
276 GlobalMapFormatManager().getMapFormatList(type);
277
278 MapFormatPtr format;
279
280 for (const auto& candidate : availableFormats)
281 {
282 // Rewind the stream before passing it to the format for testing
283 // Map format valid, rewind the stream
284 stream.seekg(0, std::ios_base::beg);
285
286 if (candidate->canLoad(stream))
287 {
288 format = candidate;
289 break;
290 }
291 }
292
293 // Rewind the stream when we're done
294 stream.seekg(0, std::ios_base::beg);
295
296 return format;
297}
298
299MapFormatPtr determineMapFormat(std::istream& stream)
300{

Callers 2

loadMapNodeMethod · 0.85
importFromStreamFunction · 0.85

Calls 4

getAllMapFormatsMethod · 0.80
getMapFormatListMethod · 0.80
emptyMethod · 0.45
canLoadMethod · 0.45

Tested by

no test coverage detected