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

Method fileInfoString

src/backend/datasources/filters/ROOTFilter.cpp:1496–1539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494// needs to be after ROOTDataHelpers namespace declaration
1495
1496QString ROOTFilter::fileInfoString(const QString& fileName) {
1497 DEBUG(Q_FUNC_INFO);
1498 QString info;
1499
1500 // The file structure is described in root/io/io/src/TFile.cxx
1501 std::ifstream is(fileName.toStdString(), std::ifstream::binary);
1502 std::string root(4, 0);
1503 is.read(const_cast<char*>(root.data()), 4);
1504 if (root != "root") {
1505 DEBUG(Q_FUNC_INFO << ", Not a ROOT file. root = " << root);
1506 return i18n("Not a ROOT file");
1507 }
1508
1509 int version = read<int>(is);
1510
1511 info += i18n("File format version: %1", QString::number(version));
1512 info += QLatin1String("<br>");
1513
1514 is.seekg(20);
1515 int freeBytes = read<int>(is);
1516 int freeRecords = read<int>(is);
1517 int namedBytes = read<int>(is);
1518 char pointerBytes = read<char>(is);
1519 info += i18n("FREE data record size: %1 bytes", QString::number(freeBytes));
1520 info += QLatin1String("<br>");
1521 info += i18n("Number of free data records: %1", QString::number(freeRecords));
1522 info += QLatin1String("<br>");
1523 info += i18n("TNamed size: %1 bytes", QString::number(namedBytes));
1524 info += QLatin1String("<br>");
1525 info += i18n("Size of file pointers: %1 bytes", QString::number(pointerBytes));
1526 info += QLatin1String("<br>");
1527
1528 int compression = read<int>(is);
1529 compression = compression > 0 ? compression : 0;
1530 info += i18n("Compression level and algorithm: %1", QString::number(compression));
1531 info += QLatin1String("<br>");
1532
1533 is.seekg(41);
1534 int infoBytes = read<int>(is);
1535 info += i18n("Size of TStreamerInfo record: %1 bytes", QString::number(infoBytes));
1536 info += QLatin1String("<br>");
1537
1538 return info;
1539}

Callers

nothing calls this directly

Calls 4

toStdStringMethod · 0.80
readMethod · 0.45
dataMethod · 0.45
seekgMethod · 0.45

Tested by

no test coverage detected