25 #ifndef ZBLLOGREADER_H 26 #define ZBLLOGREADER_H 33 #include <QJsonParseError> 110 static void zInit(
int logRecordRoleCount);
135 void openComplete(
bool success, QString errorMsg, QVariantMap contextMap);
167 QVariantMap context);
193 void openFile(
const QString& filePath, QVariantMap contextMap = QVariantMap());
229 bool loadMarkupColumn =
false,
230 QVariantMap contextMap = QVariantMap());
262 bool loadMarkupColumn);
336 const QByteArray& ba,
355 bool truncate =
false);
368 zRowBuffer& logRecords,
369 zSeekBuffer &seekPositions,
406 bool loadMarkupColumn,
440 bool loadMarkupColumn,
565 #endif // ZBLLOGREADER_H void initializeMetadata()
Reads the log file metadata contained in the first record of the log file.
QJsonParseError parseError
void timerEvent(QTimerEvent *event)
Periodically sends notifyFileSize signal.
static QThread * m_readerThread
A single background thread services all ZblLogReader objects.
static QMutex m_lock
Histogram buffer caches bytes of file data for subsequent parsing into log records.
#define ZBL_DECLARE_LOGGED_OBJECT
This class performs log file I/O operations and JSON parsing in a background thread on behalf of a ZL...
void linkMessageText(QVariant linkList)
Sent when loadRecordLinkMessageText has completed.
void move(QObject *viewport, qint64 recordCount, qint64 seekIndex, bool forward, ZblLogSearchParams searchParams, bool loadMarkupColumn)
Moves the viewport forward or backward a specific number of records.
This class allows Zuble log file viewer text search operations to pass parameters between threads...
ZSettings * m_notationFile
a file for storing metadata (bookmarks, notations, identification) about the log file.
QList< qint64 > zSeekBuffer
QString loadRowsBehind(ZLogViewport *viewport, qint64 seekPos, qint64 rowCount, const ZblLogSearchParams *searchParams, bool loadMarkupColumn, qint64 &foundCount, qint64 &storedCount, bool &bof)
Prepends log data records to the data model scanning backward in the file from the specified seek pos...
QString loadRowsAhead(ZLogViewport *viewport, qint64 seekPos, qint64 rowCount, bool truncate, const ZblLogSearchParams *searchParams, bool loadMarkupColumn, qint64 &foundCount, qint64 &storedCount, bool &eof)
Appends log records to the data model scanning foreward in the file from the specified seek position...
bool m_fileActive
true if input file is open and ready for reading, false otherwise.
void openFile(const QString &filePath, QVariantMap contextMap=QVariantMap())
Opens the log file in a concurrent background thread. Sends the openComplete signal when open is comp...
QVariantMap m_metadata
A QVariantMap containing meta information about the log file.
A log viewport encapsulates a ZTableModel containing a contiguous subset of log records from a Zuble ...
static void zInit(int logRecordRoleCount)
Must be called only once before calling newLogReader();.
void storeViewportData(ZDataRow &cellData, ZLogViewport *viewport, bool truncate=false)
Appends data to the back of the viewport's data model.
void parseNextFileRecord(ZLogViewport *viewport, const QByteArray &ba, qint64 seekPos, ZblLogScanner &logScanner, ZDataRow &cellBuffer, ZblLogError &logError)
Picks the next file record off the input stream buffer, parses it and contatenates results to the dat...
void loadViewport(QObject *viewport, qint64 seekPosition, qint64 viewportSize, ZblLogSearchParams searchParams, bool loadMarkupColumn=false, QVariantMap contextMap=QVariantMap())
Loads a viewport's log record data model with the a set of records located by a file seek index...
static ZblLogReader * newLogReader()
creates a new ZblLogReader object and moves it to the shared background log reader thread...
void loadRecordLinkMessageText(QObject *searchmark, QVariant links)
Loads the message text from the log file for the specified ZLogSearch object.
int m_timerID
Timer ID for file size timer. Zero == timer inactive.
static int m_readerCount
Counts instances of ZblLogReader objects.
Wraps the QSettings class and implements a JSON-based backend for storing the settings data...
static qint64 m_defaultPageSize
number of rows in a default page.
void openComplete(bool success, QString errorMsg, QVariantMap contextMap)
Sent when the file open operation started by calling openFile() has completed.
static int m_recordRoleCount
Number of roles in a log record.
Log record scanner/highlighter object encapsulates logic for locating and marking up search text...
QQueue< QByteArray > zRowBuffer
static const int m_updateBatchSize
The number of rows to accumulate before sending a row update to the data model. Batching rows reduces...
A class for passing log file input error information.
void loadRecordsComplete(QObject *viewport, QString errorMsg, QVariantMap contextMap)
DEPRECATED! Don't use!
void loadComplete(QObject *viewport, ZblLogSearchParams searchParams, bool endOfData, QString errorMsg, QVariantMap context)
Sent when loading log records into a viewport by calling ZblLogReader::loadViewport() has completed...
QString formatErrorString
ZblLogReader(QObject *parent=0)
static const qint64 m_maxLineSize
The maximum number of bytes a log record can contain.
ZBL_DECLARE_LOGGED_OBJECT QFile m_inputFile
Input file object from which log records will be read.
QUuid m_uuid
A UUID that uniquely identifies this log file.
int parseAndStoreViewportData(zRowBuffer &logRecords, zSeekBuffer &seekPositions, qint64 rowCount, ZLogViewport *viewport, ZblLogScanner &logScanner)
Parses rows from a row buffer and prepends them to the front of the viewport's data model...
QList< QVariant > ZDataRow
Represents a single row (or column for column headers) of data cell values for a single role...
qint64 m_firstRecordPos
File position of the first log record of the search operation.
void notifyFileSize(qint64 fileSize)
Periodically signals the current log file size.