Kstars
binfilehelper.cpp
101 // Read the first 124 bytes of the binary file which contains a general text about the binary data.
107 // Find out endianess from reading "KS" 0x4B53 in the binary file which was encoded on a little endian machine
108 // Therefore, in the binary file it is written as 53 4B (little endian as least significant byte is stored first),
109 // and when read on a little endian machine then it results in 0x4B53 (least significant byte is stored first in memory),
110 // whereas a big endian machine would read it as 0x534B (most significant byte is stored first in memory).
182 // We read each 12-byte index entry (ID[4], Offset[4] within file in bytes, nrec[4] # of Records).
189 errorMessage = QStringLiteral("Table truncated before expected! Read i = %1 index entries so far").arg(QString::number(j));
198 errorMessage = QString::asprintf("ID %u is greater than the expected number of expected entries (%u)", ID, indexSize);
204 errorMessage = QString::asprintf("Found ID %u, at the location where ID %u was expected", ID, j);
210 errorMessage = QString::asprintf("Table truncated before expected! Read i = %d index entries so far", j);
219 errorMessage = QString::asprintf("Table truncated before expected! Read i = %d index entries so far", j);
229 errorMessage = QString::asprintf("Expected %u = (%X - %x) / %x records, but found %u, in index entry %u",
This class provides utility functions to handle binary data files in the format prescribed by KStars.
Definition binfilehelper.h:39
static int unsigned_KDE_fseek(FILE *stream, quint32 offset, int whence)
Wrapper around fseek for large offsets.
Definition binfilehelper.cpp:321
static bool testFileExists(const QString &fileName)
Checks if a file exists.
Definition binfilehelper.cpp:57
bool readHeader()
Read the header and index table from the file and fill up the QVector s with the entries.
Definition binfilehelper.cpp:250
FILE * openFile(const QString &fileName)
WARNING: This function may not be compatible in other locales, because it calls QString::toAscii.
Definition binfilehelper.cpp:72
bool isField(const QString &FieldName) const
Check whether a field exists.
Definition binfilehelper.cpp:311
char * data()
AppLocalDataLocation
QString arg(Args &&... args) const const
QString asprintf(const char *cformat,...)
QString number(double n, char format, int precision)
QByteArray toLatin1() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.