MCPcopy Create free account
hub / github.com/KDE/labplot / readGlobalHeader

Method readGlobalHeader

src/3rdparty/liborigin/OriginAnyParser.cpp:288–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void OriginAnyParser::readGlobalHeader()
289{
290 LOG_PRINT(logfile, "readGlobalHeader()\n")
291 // get global header size
292 unsigned int gh_size = 0, gh_endmark = 0;
293 gh_size = readObjectSize();
294 curpos = file.tellg();
295 LOG_PRINT(logfile, "Global header size: %d [0x%X], starts at %" PRId64 " [0x%" PRIx64 "],",
296 gh_size, gh_size, curpos, curpos)
297
298 // get global header data
299 string gh_data;
300 gh_data = readObjectAsString(gh_size);
301
302 curpos = file.tellg();
303 LOG_PRINT(logfile, " ends at %" PRId64 " [0x%" PRIx64 "]\n", curpos, curpos)
304
305 // when gh_size > 0x1B, a double with fileVersion/100 can be read at gh_data[0x1B:0x23]
306 if (gh_size > 0x1B) {
307 istringstream stmp;
308 stmp.str(gh_data.substr(0x1B));
309 double dFileVersion;
310 GET_DOUBLE(stmp, dFileVersion)
311 if (dFileVersion > 8.5) {
312 fileVersion = (unsigned int)trunc(dFileVersion * 100.);
313 } else {
314 fileVersion = 10 * (unsigned int)trunc(dFileVersion * 10.);
315 }
316 LOG_PRINT(logfile, "Project version as read from header: %.2f (%.6f)\n",
317 fileVersion / 100.0, dFileVersion)
318 }
319
320 // now read a zero size end mark
321 gh_endmark = readObjectSize();
322 if (gh_endmark != 0) {
323 curpos = file.tellg();
324 LOG_PRINT(logfile, "Wrong end of list mark %d at %" PRId64 " [0x%" PRIx64 "]\n", gh_endmark,
325 curpos, curpos)
326 parseError = 5;
327 return;
328 }
329}
330
331bool OriginAnyParser::readDataSetElement()
332{

Callers

nothing calls this directly

Calls 1

tellgMethod · 0.45

Tested by

no test coverage detected