WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Zbl::ZblLogBkSearch Class Reference

Performs log file searches in a background thread. More...

#include <ZblLogBkSearch.h>

Inheritance diagram for Zbl::ZblLogBkSearch:
Inheritance graph
[legend]
Collaboration diagram for Zbl::ZblLogBkSearch:
Collaboration graph
[legend]

Public Slots

void markupViewport (QObject *viewport)
 Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying this object's search criteria. More...
 
void markupViewport (QObject *viewport, ZblLogSearchParams params)
 Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying the specified search criteria. More...
 
void markupViewport (QObject *viewport, ZblLogSearchParams *params)
 Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying the specified search criteria. More...
 
void startSearch ()
 Starts a text search of the log file for log records that satisfiy the search criteria. Search direction can be forward or backward or both. More...
 
void scanForward ()
 Scans a viewport for strings matching the search parameters. More...
 
void onLoadComplete (bool eof, QString errorMsg, QVariantMap context)
 Called when the forward scanning viewport has been loaded and is ready. More...
 
void onMoveComplete (qint64 rowsFound, qint64 rowsStored, bool endOfData, QString errorMsg)
 Called when the backward scanning viewport has been moved and is ready. More...
 

Signals

void searchRowsMatched (ZblLogSearchList rowsFound)
 Sent when log records matching the search criteria have been located. More...
 
void searchRowsScanned (qint64 firstID, qint64 lastID)
 Sent when log records have been scanned for matching text. More...
 
void markupUpdated (ZLogViewport *viewport, ZblLogSearchList rowsFound)
 Sent when a viewport's markeup data (model column 1) has been updated. More...
 

Public Member Functions

 ZblLogBkSearch (qint64 startPosition, ZblLogSearchParams params, ZblLogReader *reader)
 Constructs a ZblLogBkSearch object. More...
 
 ~ZblLogBkSearch ()
 destructor More...
 

Static Public Member Functions

static void zInit ()
 Initializes search engine. Must be called only once before calling newLogSearcher() the first time. More...
 
static ZblLogBkSearchnewLogSearcher ()
 Constructs a ZblLogBkSearch object and moves it to the search thread. More...
 

Protected Attributes

ZBL_DECLARE_LOGGED_OBJECT ZblLogSearchParams m_params
 Search parameters for this search object. More...
 
ZblLogReaderm_reader
 Background log reader object. More...
 
ZLogViewportm_vpUp
 A viewport for scanning the file in the reverse direction. More...
 
ZLogViewportm_vpDown
 A viewport for scanning the file in the forward direction. More...
 
qint64 m_startPosition
 The starting file position of the search;. More...
 
qint64 m_upPosition
 The current file position of the reverse scan;. More...
 
qint64 m_downPosition
 The current file position of the forward scan;. More...
 

Detailed Description

Performs log file searches in a background thread.

Definition at line 23 of file ZblLogBkSearch.h.

Constructor & Destructor Documentation

◆ ZblLogBkSearch()

Zbl::ZblLogBkSearch::ZblLogBkSearch ( qint64  startPosition,
ZblLogSearchParams  params,
ZblLogReader reader 
)
explicit

Constructs a ZblLogBkSearch object.

Parameters
parentoptional parent of the object

Definition at line 17 of file ZblLogBkSearch.cpp.

◆ ~ZblLogBkSearch()

Zbl::ZblLogBkSearch::~ZblLogBkSearch ( )

destructor

Definition at line 38 of file ZblLogBkSearch.cpp.

Member Function Documentation

◆ markupUpdated

void Zbl::ZblLogBkSearch::markupUpdated ( ZLogViewport viewport,
ZblLogSearchList  rowsFound 
)
signal

Sent when a viewport's markeup data (model column 1) has been updated.

Parameters
viewportthe viewport whose data model was updated
rowsFoundA list of links to records in the viewport that matched the search criteria

Referenced by Zbl::ZLogViewport::markupText(), markupViewport(), and Zbl::ZLogViewport::setCurrentSearch().

◆ markupViewport [1/3]

void Zbl::ZblLogBkSearch::markupViewport ( QObject *  viewport)
slot

Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying this object's search criteria.

Previous contents of data model markup column are overwritten.

Parameters
viewportThe log file viewport on which to begin the search.

Definition at line 54 of file ZblLogBkSearch.cpp.

Referenced by markupViewport().

◆ markupViewport [2/3]

void Zbl::ZblLogBkSearch::markupViewport ( QObject *  viewport,
ZblLogSearchParams  params 
)
slot

Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying the specified search criteria.

If the params object is invalid the search parameters for this object are used. Previous contents of data model markup column are overwritten.

Parameters
viewportThe log file viewport on which to begin the search.
paramsA ZblSearchParams object containing search parameters to use for markup

Definition at line 59 of file ZblLogBkSearch.cpp.

◆ markupViewport [3/3]

void Zbl::ZblLogBkSearch::markupViewport ( QObject *  viewport,
ZblLogSearchParams params 
)
slot

Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) of the model, applying the specified search criteria.

If the params object is invalid the search parameters for this object are used. Previous contents of data model markup column are overwritten.

Parameters
viewportThe log file viewport on which to begin the search.
paramsA pointer to a ZblSearchParams object containing search parameters to use for markup

Definition at line 64 of file ZblLogBkSearch.cpp.

◆ newLogSearcher()

ZblLogBkSearch * Zbl::ZblLogBkSearch::newLogSearcher ( )
static

Constructs a ZblLogBkSearch object and moves it to the search thread.

Returns
A new ZblLogBkSearch object or NULL if no object could be constructed.

Definition at line 212 of file ZblLogBkSearch.cpp.

◆ onLoadComplete

void Zbl::ZblLogBkSearch::onLoadComplete ( bool  eof,
QString  errorMsg,
QVariantMap  context 
)
slot

Called when the forward scanning viewport has been loaded and is ready.

Parameters
eoftrue if end of file was reached during load
errorMsgReports any error encountered
contextMapAn opaque QVariantMap object

Definition at line 141 of file ZblLogBkSearch.cpp.

Referenced by ZblLogBkSearch().

◆ onMoveComplete

void Zbl::ZblLogBkSearch::onMoveComplete ( qint64  rowsFound,
qint64  rowsStored,
bool  endOfData,
QString  errorMsg 
)
slot

Called when the backward scanning viewport has been moved and is ready.

Parameters
rowsFoundThe number of rows that were encountered in the file
rowsStoredThe number of rows that were stored in the viewport's data model
endOfDataTrue if end of data was encountered during the move operation
errorMsgA message indicating errors that were encountered. An empty string if no errors were encountered.

Definition at line 183 of file ZblLogBkSearch.cpp.

Referenced by ZblLogBkSearch().

◆ scanForward

void Zbl::ZblLogBkSearch::scanForward ( )
slot

Scans a viewport for strings matching the search parameters.

Definition at line 116 of file ZblLogBkSearch.cpp.

◆ searchRowsMatched

void Zbl::ZblLogBkSearch::searchRowsMatched ( ZblLogSearchList  rowsFound)
signal

Sent when log records matching the search criteria have been located.

Parameters
searchListA list of rows that matched the search parameters.

Referenced by Zbl::ZblLogSearch::ZblLogSearch().

◆ searchRowsScanned

void Zbl::ZblLogBkSearch::searchRowsScanned ( qint64  firstID,
qint64  lastID 
)
signal

Sent when log records have been scanned for matching text.

This allows a progress indicator to be displayed.

Parameters
searchListA list of rows that matched the search parameters.

◆ startSearch

void Zbl::ZblLogBkSearch::startSearch ( )
slot

Starts a text search of the log file for log records that satisfiy the search criteria. Search direction can be forward or backward or both.

Definition at line 93 of file ZblLogBkSearch.cpp.

◆ zInit()

void Zbl::ZblLogBkSearch::zInit ( )
static

Initializes search engine. Must be called only once before calling newLogSearcher() the first time.

Definition at line 45 of file ZblLogBkSearch.cpp.

Referenced by Zbl::ZLogReader::registerType().

Member Data Documentation

◆ m_downPosition

qint64 Zbl::ZblLogBkSearch::m_downPosition
protected

The current file position of the forward scan;.

Definition at line 288 of file ZblLogBkSearch.h.

Referenced by onLoadComplete(), and scanForward().

◆ m_params

ZBL_DECLARE_LOGGED_OBJECT ZblLogSearchParams Zbl::ZblLogBkSearch::m_params
protected

Search parameters for this search object.

Definition at line 254 of file ZblLogBkSearch.h.

Referenced by markupViewport(), onLoadComplete(), and scanForward().

◆ m_reader

ZblLogReader* Zbl::ZblLogBkSearch::m_reader
protected

Background log reader object.

Definition at line 260 of file ZblLogBkSearch.h.

Referenced by scanForward().

◆ m_startPosition

qint64 Zbl::ZblLogBkSearch::m_startPosition
protected

The starting file position of the search;.

Definition at line 276 of file ZblLogBkSearch.h.

◆ m_upPosition

qint64 Zbl::ZblLogBkSearch::m_upPosition
protected

The current file position of the reverse scan;.

Definition at line 282 of file ZblLogBkSearch.h.

Referenced by startSearch().

◆ m_vpDown

ZLogViewport* Zbl::ZblLogBkSearch::m_vpDown
protected

A viewport for scanning the file in the forward direction.

Definition at line 270 of file ZblLogBkSearch.h.

Referenced by onLoadComplete(), and scanForward().

◆ m_vpUp

ZLogViewport* Zbl::ZblLogBkSearch::m_vpUp
protected

A viewport for scanning the file in the reverse direction.

Definition at line 265 of file ZblLogBkSearch.h.


The documentation for this class was generated from the following files: