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
|
Log record scanner/highlighter object encapsulates logic for locating and marking up search text. More...
#include <ZblLogScanner.h>
Public Types | |
enum | controlFlags { HighlightSearchText = 1, SendRowsMatchedSignal = 2, SendFindCompleteSignal = 4 } |
Public Member Functions | |
ZblLogScanner () | |
Constructs an invalid scanner/highlighter object. More... | |
ZblLogScanner (const ZblLogSearchParams *searchParams, controlFlags control, bool markupColumn=false) | |
Constructs a log record scanner/highlighter object for the specified input/output parameters. More... | |
QVariantList | markupOrdinalRoleList (QVariantList data) |
Returns a highlighted text string for the specified QVariant objects. More... | |
ZblLogSearchList | scanModelColumnRows (ZTableModel *model, int chunkSize, ZLogViewport *viewport=NULL, qint64 currentRecordID=-1) |
scanModelColumnRows More... | |
ZTableRowList | scanTableColumnRows (ZTableRowList columnRows, ZblLogSearchList &searchList, ZLogViewport *viewport=NULL) |
Scans a log viewport data model for search text. More... | |
QVariant | scanTextValue (QVariant data, bool &searchTextFound) |
Returns a highlighted text string for the specified QVariant object. More... | |
bool | outputHighlightedText () |
Determine if scanner is enabled. More... | |
bool | outputMarkupColumn () |
Determine if scanner will output markup column when scanning log record data models. More... | |
bool | signalRowsMatched () |
Determine if scanner will send rowsMatched signals. More... | |
bool | signalFindComplete () |
Determine if scanner will send rowsMatched signals. More... | |
Protected Member Functions | |
qint64 | getRowSeekPos (QMap< int, QVariant > row) |
qint64 | getRowID (QMap< int, QVariant > row) |
Protected Attributes | |
const ZblLogSearchParams * | m_params |
Search parameters to be used by the text scanning algorithms. More... | |
bool | m_markupColumn |
True if the data model has an optional markup column. More... | |
bool | m_findCompleteSent |
true if fineComplete signal has been sent, false otherwise; More... | |
controlFlags | m_controlFlags |
These flags control the output of the scanner. More... | |
Static Protected Attributes | |
static const QString | m_highlightColor = "blue" |
The color to highlight text that mataches the search parameters. More... | |
Log record scanner/highlighter object encapsulates logic for locating and marking up search text.
This is used by the text search feature to highlight search text in the log view. The scanner can optionally send rowsMatched signals to the search object as it scans.
A list of role numbers determines which cells will be scanned. Only data for these roles will be scanned and highlighted. Data for other roles are not scanned.
The model is assumed to contain raw data to be scanned in column 0. An optional second column of display data can be stored in column 1. The scanner will fill column 1 with exact copies of the roles from column 0 if text highlighting is turned off, and will fill column 1 with highlighted (rich) text if text highlighting is turned on.
Definition at line 34 of file ZblLogScanner.h.
Definition at line 39 of file ZblLogScanner.h.
Zbl::ZblLogScanner::ZblLogScanner | ( | ) |
Constructs an invalid scanner/highlighter object.
Definition at line 12 of file ZblLogScanner.cpp.
Zbl::ZblLogScanner::ZblLogScanner | ( | const ZblLogSearchParams * | searchParams, |
controlFlags | control, | ||
bool | markupColumn = false |
||
) |
Constructs a log record scanner/highlighter object for the specified input/output parameters.
searchParams | Parameters control the text matching algorithm |
control | Determine what operations will be performed |
markupColumn | true to output markup column, false to ignore markup column |
Definition at line 20 of file ZblLogScanner.cpp.
|
protected |
Definition at line 253 of file ZblLogScanner.cpp.
Referenced by scanTableColumnRows(), and signalFindComplete().
|
protected |
Definition at line 258 of file ZblLogScanner.cpp.
Referenced by scanTableColumnRows(), and signalFindComplete().
QVariantList Zbl::ZblLogScanner::markupOrdinalRoleList | ( | QVariantList | data | ) |
Returns a highlighted text string for the specified QVariant objects.
The data list is assumed to provide an input data model cell arranged with "ordinal roles": A sequence of data whose index in the array is the role number of the data for the row. Ordinal role numbers start with zero and increment by one for each successive role number. This data arrangement is compatible with ZTableModel::prependCells() and ZTableModel::appendCells() used by ZLogReader to load viewport data into the model.
The internal m_roles list contains the role numbers for the data that should be highlighted. This method will scan the rows for only the specified roles and return an ordinal role list with only those roles that match the search text converted to highlighted text. Values for roles not in the roles list or that don't contain search text will be returned containing the original input data.
data | An ordinal role data model cell, each index in the list represents an ordinal role value for the cell |
Definition at line 36 of file ZblLogScanner.cpp.
Referenced by Zbl::ZblLogReader::parseNextFileRecord().
|
inline |
Determine if scanner is enabled.
Definition at line 173 of file ZblLogScanner.h.
Referenced by Zbl::ZblLogReader::parseNextFileRecord(), scanTableColumnRows(), and scanTextValue().
|
inline |
Determine if scanner will output markup column when scanning log record data models.
Definition at line 183 of file ZblLogScanner.h.
Referenced by Zbl::ZblLogReader::parseNextFileRecord().
ZblLogSearchList Zbl::ZblLogScanner::scanModelColumnRows | ( | ZTableModel * | model, |
int | chunkSize, | ||
ZLogViewport * | viewport = NULL , |
||
qint64 | currentRecordID = -1 |
||
) |
scanModelColumnRows
model | The log record data model to scan |
chunkSize | The number of rows to scan at a time |
viewport | The viewport to receive signals or NULL to receive no signals. |
Definition at line 65 of file ZblLogScanner.cpp.
Referenced by Zbl::ZblLogBkSearch::markupViewport(), and Zbl::ZblLogBkSearch::onLoadComplete().
ZTableRowList Zbl::ZblLogScanner::scanTableColumnRows | ( | ZTableRowList | columnRows, |
ZblLogSearchList & | searchList, | ||
ZLogViewport * | viewport = NULL |
||
) |
Scans a log viewport data model for search text.
Each cell in the specified zRableRowList will be scanned and only those that match the search text will be (optionally) converted to highlighted text. Cells for roles not in the roles list or that don't contain search text will be returned containing the original input data.
This method is compatible with ZTableModel::getTableColumnRows() and ZTableModel::putTableColumnRows() used by ZblLogBkSearch to scan viewport data models for search text.
A | ZTableRowList object containg the QVariant data to highlight |
A | ZblLogSearchList object will receive links rows that match the search parameters if SendRowsMatchedSignal control bit is set. |
Definition at line 137 of file ZblLogScanner.cpp.
Referenced by scanModelColumnRows().
QVariant Zbl::ZblLogScanner::scanTextValue | ( | QVariant | data, |
bool & | searchTextFound | ||
) |
Returns a highlighted text string for the specified QVariant object.
The method first converts the specified data QVariant into text using QVariant::toString() and then scans the specified text using the encapsulated search parameters to locate search strings and enclose them in rich text tags that cause the text to appear highlighted.
If the data, when converted to text, doesn't contain any instances of the search text the original data value is returned.
data | The QVariant data to highlight |
searchTextFound | Set to true by this method if text matching the search parameters was found, false if not found |
Definition at line 206 of file ZblLogScanner.cpp.
Referenced by markupOrdinalRoleList(), and scanTableColumnRows().
|
inline |
Determine if scanner will send rowsMatched signals.
Definition at line 197 of file ZblLogScanner.h.
Referenced by scanModelColumnRows(), and ZblLogScanner().
|
inline |
Determine if scanner will send rowsMatched signals.
Definition at line 190 of file ZblLogScanner.h.
Referenced by scanModelColumnRows(), and scanTableColumnRows().
|
protected |
These flags control the output of the scanner.
Definition at line 253 of file ZblLogScanner.h.
Referenced by outputHighlightedText(), signalFindComplete(), signalRowsMatched(), and ZblLogScanner().
|
protected |
true if fineComplete signal has been sent, false otherwise;
Definition at line 246 of file ZblLogScanner.h.
Referenced by ZblLogScanner().
|
staticprotected |
The color to highlight text that mataches the search parameters.
Definition at line 214 of file ZblLogScanner.h.
Referenced by scanTextValue().
|
protected |
True if the data model has an optional markup column.
Column 0 holds the raw data from the log file. When a data model is used to hold visual data column 1 holds the display data where markup can occur.
When this flag is true column 1 will receive EITHER:
When this flag is false column 1 will receive nothing. This is true even if text highlighting is turned on.
Definition at line 240 of file ZblLogScanner.h.
Referenced by outputMarkupColumn(), and ZblLogScanner().
|
protected |
Search parameters to be used by the text scanning algorithms.
Definition at line 220 of file ZblLogScanner.h.
Referenced by markupOrdinalRoleList(), scanModelColumnRows(), scanTableColumnRows(), scanTextValue(), and ZblLogScanner().
Zuble documentation copyright © 2019 Bob Dinitto. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Zuble is a derivative work of Qt version 5. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.