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
|
This object encapsulates search operation parameters, results, and steady state. More...
#include <ZblLogSearch.h>
Public Types | |
enum | searchState { BEGIN = 0, SCANNING, PAUSED, COMPLETE } |
States of a search. More... | |
enum | TextSearchDirection { SearchDirectionNull = 0, SearchDirectionForward = 1, SearchDirectionBackward = 2, SearchDirectionBoth = 3 } |
Specify search direction from initial log file position at start of search. More... | |
![]() | |
enum | bookmarkType { RecordNumber = 0, RecordIndex } |
typedef QList< ZLogBookmark * > | zLogBookmarkList |
![]() | |
enum | MarkType { Invalid = ZblLogMapData::Invalid, Selection = ZblLogMapData::Selection, Searchmap = ZblLogMapData::Searchmap, Bookmark = ZblLogMapData::Bookmark } |
Types of log maps: Invalid, Selection, Search, Bookmark. More... | |
enum | MarkRole { FirstID = ZblLogMapData::FirstID, SeekPosition = ZblLogMapData::SeekPosition, MessageText = ZblLogMapData::MessageText } |
Roles for the log map's data model. More... | |
typedef QList< ZLogMap * > | zLogMapList |
Public Slots | |
void | onSearchRowMatched (qint64 recordID, qint64 seekPosition, QList< int > modelRoles) |
Called when the search engine has found a target record in the log file. More... | |
void | onSearchRowsMatched (ZblLogSearchList rowsFound) |
Called when the search engine has found target records in the log file. More... | |
void | onLinkTextComplete (QVariant linkList) |
Called by ZblLogReader when loadRecordLinkMessageText has completed. More... | |
QList< int > | getRolesFound () const |
Returns the set of roles for which search results were found. More... | |
bool | isSearch (const QString &searchPhrase, int searchType, QList< int > searchRoles) const |
Determines if this object contains results from searching for the specified search phrase and type. More... | |
bool | isNull () |
Determine if this search is null. More... | |
void | addSearchRole (int roleNumber) |
Adds the specified role to the set of roles that will be scanned during a text search. More... | |
void | addSearchRoles (QList< int > rolesToSearch) |
Adds the specified roles to the set of roles that will be scanned during a text search. More... | |
void | setSearchRoles (QList< int > rolesToSearch) |
Replaces the current set of roles to scan during a text search with the specified roles. More... | |
void | clearSearchRoles () |
Removes all roles from the set of search result roles. More... | |
bool | containsSearchRoles (QList< int > searchRoles) const |
Determine if the set of roles to scan when processing this searchmark contains the specified roles. More... | |
bool | equalsSearchRoles (QList< int > searchRoles) const |
Determine if the set of roles to scan when processing this searchmark contains exactly the specified roles. More... | |
QObject * | linkModel () |
Obtain a list model containing an item for each log record represented in the ZLogSearchMark's result set. This is used to display log record links. More... | |
bool | search (int direction, qint64 startPos) |
Scans the log file for text matching the current search criteria. More... | |
void | pause () |
Pause the background search operation. More... | |
void | resume () |
Resume the background search operation. More... | |
void | abort () |
Resume the background search operation. More... | |
![]() | |
QString | getMarkName () const |
void | setMarkName (const QString &name) |
QString | getNote () const |
void | setNote (const QString ¬e) |
![]() | |
void | insertMark (qint64 recordID, qint64 lastRecordID, qint64 seekPosition) |
Creates a new log mark in the database. More... | |
bool | hasMark (qint64 recordID) |
Determine if the log map contains a mark for the specified log record. More... | |
qint64 | findNextMark (qint64 startID, bool forward=true) const |
Search forward or backward for the next mark from a specified starting position. More... | |
bool | removeMark (qint64 recordID, qint64 lastRecordID) |
Removes the specified mark from the log map. More... | |
void | clear () |
Removes all marks from the log map. More... | |
Signals | |
void | invalidate () |
Sent when a request to delete this object requires all references to be released. More... | |
void | notifySearchState (int newValue) |
void | notifySearchForward (bool newValue) |
void | notifySearchBackward (bool newValue) |
void | notifyActive (bool newValue) |
void | notifySaved (bool newValue) |
void | notifyCompletionFileSize (qint64 newValue) |
![]() | |
void | selectionUpdated () |
Sent whenever the ZLogMap state has been changed. More... | |
Public Member Functions | |
ZblLogSearch (const QString &searchPhrase, int searchType, QList< int > searchRoles, ZblLogSearch::TextSearchDirections directions, qint64 startPosition, ZLogReader *reader) | |
QString | getPhrase () const |
int | getSearchType () const |
QList< int > | getSearchRoles () const |
Returns the set of roles in the log file data model that will be scanned by the text search engine when processing this searchmark. More... | |
searchState | getSearchState () const |
bool | getActive () const |
bool | getSaved () const |
qint64 | getCompletionFileSize () const |
bool | getSearchForward () const |
void | setSearchForward (bool forward) |
bool | getSearchBackward () const |
void | setSearchBackward (bool backward) |
TextSearchDirections | getSearchDirections () const |
void | setSearchDirections (ZblLogSearch::TextSearchDirections directions) |
void | addRoleFound (int roleNumber) |
Adds the specified role to the set of roles where search results were found. More... | |
void | addRolesFound (QList< int > rolesFound) |
Adds the specified roles to the set of roles where search results were found. More... | |
void | clearRolesFound () |
Removes all roles from the set of search result roles. More... | |
ZblLogBkSearch * | getSearcher () |
Obtain the background searcher object associated with this search. More... | |
bool | validateReader (ZLogReader *reader) |
Determine if the specified background file reader is connected to this search object. More... | |
ZblLogSearchParams | getSearchParameters () |
Obtain parameters for this search. More... | |
![]() | |
ZLogBookmark (ZLogReader *reader) | |
ZLogBookmark (ZLogReader *reader, const QString &name) | |
![]() | |
ZLogMap (ZLogReader *reader) | |
Constructor. More... | |
MarkType | getMapType () |
returns this log map's mark type More... | |
Q_INVOKABLE QObject * | getReader () const |
Returns the foreground log file reader object for this log map. More... | |
Static Public Member Functions | |
static void | zInit () |
Initializes search engine. Must be called only once before constructing the first ZblLogSearch object. More... | |
static QString | getSearchmarkName (QString searchPhrase, int searchType, QList< int > searchRoles) |
Creates a unique name string for a given set of search parameters. More... | |
static void | dismiss (QObject *search) |
QSharedPointer deleter method called when last strong reference has gone out of scope; sends detach() signal, then calls deleteLater(). More... | |
![]() | |
static void | registerType () |
Registers ZLogMap as a QML type. More... | |
Protected Member Functions | |
virtual int | logMapType () |
Returns log map type. Override of ZLogBookmark::logMapType(). More... | |
void | populateLinkModel (ZblLogReclinkData &linkModel) |
Creates an expanded data model of this ZLogSearch object's log record links in the specified object. More... | |
![]() | |
ZLogReader * | getZReader () const |
Returns the foreground log file reader object for this search. More... | |
Static Protected Member Functions | |
static void | deleteReclinkData (ZblLogReclinkData *data) |
calls deleteLater() method of the specified ZblLogReclinkData object. More... | |
static QString | getSearchRolesName (QList< int > searchRoles) |
Returns a name concatenated from the specified search role list. More... | |
Protected Attributes | |
QString | m_searchPhrase |
The search phrase used to generate these search results. More... | |
textSearchType | m_searchType |
The type of search: case sensitive/insensitive or regular expression. More... | |
QSet< int > | m_rolesSearched |
The log record rolls that are searched. More... | |
QSet< int > | m_rolesFound |
The roles in which a search result was found. More... | |
QWeakPointer< ZblLogReclinkData > | m_linkModel |
A log record link data model that is shared by all ZLogReclinkModel objects created by this ZlogSearchmark object. More... | |
searchState | m_searchState |
Tracks the state of a search operation. More... | |
bool | m_active |
True if search is active, false if inactive. More... | |
bool | m_saved |
True is search is saved, false if unsaved. More... | |
TextSearchDirections | m_searchDirection |
Specifies direction of search from active viewport location. More... | |
qint64 | m_startPosition |
File seek position of the log record from which to start the search operation. More... | |
qint64 | m_endSize |
The file size at the successful conclusion of the search operation. More... | |
ZLogMap | m_searchArea |
Links in this map represent areas of the log file that have already been searched. More... | |
ZblLogBkSearch * | m_searcher |
A background searcher object to service foreground log file search requests. More... | |
![]() | |
QString | m_bookmarkName |
Display name for this bookmark. More... | |
QString | m_note |
Annotation for this bookmark. More... | |
![]() | |
ZBL_DECLARE_LOGGED_OBJECT ZblLogMap | m_map |
Create the m_tag object that presents a Javascript interface to constant integer values. More... | |
ZLogReader * | m_reader |
The log file reader that created this search object. More... | |
Static Protected Attributes | |
static QThread * | m_searcherThread = 0 |
A single background thread services all ZblLogBkSearch objects. More... | |
Additional Inherited Members | |
![]() | |
QString | name |
QString | note |
![]() | |
int | mapType |
This object encapsulates search operation parameters, results, and steady state.
Parameters include start location, direction, data model roles, search phrase, and search type.
Results include a log map of records that satisfy the search criteria. Since ZLogSearch is a ZLogBookmark it can be named and annotated.
Results are stored in a compressed form but can be automatically expanded for display purposes.
This object is explicitly shared through the ZLogSearch wrapper object.
Definition at line 35 of file ZblLogSearch.h.
States of a search.
Enumerator | |
---|---|
BEGIN | |
SCANNING | |
PAUSED | |
COMPLETE |
Definition at line 46 of file ZblLogSearch.h.
Specify search direction from initial log file position at start of search.
Enumerator | |
---|---|
SearchDirectionNull | |
SearchDirectionForward | |
SearchDirectionBackward | |
SearchDirectionBoth |
Definition at line 60 of file ZblLogSearch.h.
|
explicit |
Definition at line 16 of file ZblLogSearch.cpp.
|
slot |
Resume the background search operation.
Definition at line 101 of file ZblLogSearch.cpp.
void Zbl::ZblLogSearch::addRoleFound | ( | int | roleNumber | ) |
Adds the specified role to the set of roles where search results were found.
This data is used to optimize scanning for text matches. Note that adding search roles to a non-empty ZLogSearch object invalidates existing search results.
roleNumber | The role number to add |
Definition at line 235 of file ZblLogSearch.cpp.
void Zbl::ZblLogSearch::addRolesFound | ( | QList< int > | rolesFound | ) |
Adds the specified roles to the set of roles where search results were found.
This data is used to optimize viewport markup operations.
rolesFound | A list of integers representing the role numbers in which search text was found. |
Definition at line 240 of file ZblLogSearch.cpp.
Referenced by onSearchRowMatched().
|
slot |
Adds the specified role to the set of roles that will be scanned during a text search.
This data is used to optimize scanning for text matches.
roleNumber | The role number to add |
Definition at line 257 of file ZblLogSearch.cpp.
|
slot |
Adds the specified roles to the set of roles that will be scanned during a text search.
This data is used to optimize scanning for text matches. Note that adding search roles to a non-empty ZLogSearch object invalidates existing search results.
rolesToSearch | A list of integers representing the role numbers that will be searched. |
Definition at line 267 of file ZblLogSearch.cpp.
void Zbl::ZblLogSearch::clearRolesFound | ( | ) |
Removes all roles from the set of search result roles.
Definition at line 247 of file ZblLogSearch.cpp.
|
slot |
Removes all roles from the set of search result roles.
Definition at line 279 of file ZblLogSearch.cpp.
|
slot |
Determine if the set of roles to scan when processing this searchmark contains the specified roles.
Note this does not determine if the two sets are equal.
Definition at line 291 of file ZblLogSearch.cpp.
|
staticprotected |
calls deleteLater() method of the specified ZblLogReclinkData object.
data | A ZblLogReclinkData object that has no references and will be deleted |
Definition at line 391 of file ZblLogSearch.cpp.
Referenced by linkModel().
|
static |
QSharedPointer deleter method called when last strong reference has gone out of scope; sends detach() signal, then calls deleteLater().
search | Pointer to a ZblLogSearch object |
Definition at line 69 of file ZblLogSearch.cpp.
Referenced by Zbl::ZLogReader::getZSearch().
|
slot |
Determine if the set of roles to scan when processing this searchmark contains exactly the specified roles.
Definition at line 299 of file ZblLogSearch.cpp.
bool Zbl::ZblLogSearch::getActive | ( | ) | const |
Definition at line 215 of file ZblLogSearch.cpp.
qint64 Zbl::ZblLogSearch::getCompletionFileSize | ( | ) | const |
Definition at line 225 of file ZblLogSearch.cpp.
QString Zbl::ZblLogSearch::getPhrase | ( | ) | const |
Definition at line 155 of file ZblLogSearch.cpp.
Referenced by Zbl::ZblLogSearchParams::ZblLogSearchParams().
|
slot |
Returns the set of roles for which search results were found.
Definition at line 252 of file ZblLogSearch.cpp.
bool Zbl::ZblLogSearch::getSaved | ( | ) | const |
Definition at line 220 of file ZblLogSearch.cpp.
bool Zbl::ZblLogSearch::getSearchBackward | ( | ) | const |
Definition at line 186 of file ZblLogSearch.cpp.
ZblLogSearch::TextSearchDirections Zbl::ZblLogSearch::getSearchDirections | ( | ) | const |
Definition at line 202 of file ZblLogSearch.cpp.
Referenced by Zbl::ZblLogSearchParams::ZblLogSearchParams().
ZblLogBkSearch * Zbl::ZblLogSearch::getSearcher | ( | ) |
Obtain the background searcher object associated with this search.
Definition at line 84 of file ZblLogSearch.cpp.
bool Zbl::ZblLogSearch::getSearchForward | ( | ) | const |
Definition at line 171 of file ZblLogSearch.cpp.
|
static |
Creates a unique name string for a given set of search parameters.
searchPhrase | |
searchType | |
searchRoles |
Definition at line 107 of file ZblLogSearch.cpp.
Referenced by Zbl::ZLogReader::getZSearch(), Zbl::ZLogReader::hasSearch(), and ZblLogSearch().
ZblLogSearchParams Zbl::ZblLogSearch::getSearchParameters | ( | ) |
Obtain parameters for this search.
Definition at line 504 of file ZblLogSearch.cpp.
Referenced by search(), and ZblLogSearch().
QList< int > Zbl::ZblLogSearch::getSearchRoles | ( | ) | const |
Returns the set of roles in the log file data model that will be scanned by the text search engine when processing this searchmark.
Only roles in this set will be scanned. Roles not in the set will be ignored.
Definition at line 286 of file ZblLogSearch.cpp.
Referenced by Zbl::ZblLogSearchParams::ZblLogSearchParams().
|
staticprotected |
Returns a name concatenated from the specified search role list.
searchRoles | a list of search roles for the name |
Definition at line 114 of file ZblLogSearch.cpp.
Referenced by getSearchmarkName().
ZblLogSearch::searchState Zbl::ZblLogSearch::getSearchState | ( | ) | const |
Definition at line 165 of file ZblLogSearch.cpp.
int Zbl::ZblLogSearch::getSearchType | ( | ) | const |
Definition at line 160 of file ZblLogSearch.cpp.
Referenced by Zbl::ZblLogSearchParams::ZblLogSearchParams().
|
signal |
Sent when a request to delete this object requires all references to be released.
All strong references to this object (wrapper objects, etc) should be released in response to this signal.
WARNING: Failure to respond to this signal may result in duplicate search objects which will waste resources and potentially cause erratic UI behavior.
Referenced by Zbl::ZLogReader::getSearch().
|
slot |
Determine if this search is null.
A null search by definition matches zero log records.
Definition at line 313 of file ZblLogSearch.cpp.
|
slot |
Determines if this object contains results from searching for the specified search phrase and type.
searchPhrase | |
searchType | |
searchRoles |
Definition at line 306 of file ZblLogSearch.cpp.
|
slot |
Obtain a list model containing an item for each log record represented in the ZLogSearchMark's result set. This is used to display log record links.
The returned ZLogReclinkModel object remains synchronized to the ZLogSearch object that created it. Links may continue to be added to the model as the search operation progresses.
Definition at line 360 of file ZblLogSearch.cpp.
Referenced by onLinkTextComplete().
|
protectedvirtual |
Returns log map type. Override of ZLogBookmark::logMapType().
Reimplemented from Zbl::ZLogBookmark.
Definition at line 230 of file ZblLogSearch.cpp.
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
slot |
Called by ZblLogReader when loadRecordLinkMessageText has completed.
linkList | An encapsulated ZblLogLinkList object containing message text. |
Definition at line 436 of file ZblLogSearch.cpp.
|
slot |
Called when the search engine has found a target record in the log file.
recordID | The record ID number of the log record where search results were found. |
seekPosition | The file seek position of the log record where search results were found. |
modelRoles | A list of role numbers of this log record where search results were found. |
Definition at line 322 of file ZblLogSearch.cpp.
|
slot |
Called when the search engine has found target records in the log file.
rowsFound | A list of rows that matched the search parameters. |
Definition at line 341 of file ZblLogSearch.cpp.
Referenced by ZblLogSearch().
|
slot |
Pause the background search operation.
Definition at line 91 of file ZblLogSearch.cpp.
|
protected |
Creates an expanded data model of this ZLogSearch object's log record links in the specified object.
Previous contents of linkModel will be lost.
linkModel | A ZblLogReclinkData object to receive log record links. |
Definition at line 398 of file ZblLogSearch.cpp.
Referenced by linkModel().
|
slot |
Resume the background search operation.
Definition at line 96 of file ZblLogSearch.cpp.
|
slot |
Scans the log file for text matching the current search criteria.
Search operation is performed in a background thread. The findComplete signal is emitted when the operation has finished.
forward | Direction of search: true = forward, false = backward |
startRow | model row number of the first log record to search |
Definition at line 464 of file ZblLogSearch.cpp.
Referenced by dismiss().
void Zbl::ZblLogSearch::setSearchBackward | ( | bool | backward | ) |
Definition at line 191 of file ZblLogSearch.cpp.
void Zbl::ZblLogSearch::setSearchDirections | ( | ZblLogSearch::TextSearchDirections | directions | ) |
Definition at line 207 of file ZblLogSearch.cpp.
void Zbl::ZblLogSearch::setSearchForward | ( | bool | forward | ) |
Definition at line 176 of file ZblLogSearch.cpp.
|
slot |
Replaces the current set of roles to scan during a text search with the specified roles.
Only log data model roles specified in rolesToSearch will be scanned. All others will be ignored.
This data is used to optimize scanning for text matches. Note that setting search roles invalidates existing search results.
rolesToSearch | A list of integers representing the role numbers that will be searched. |
bool Zbl::ZblLogSearch::validateReader | ( | ZLogReader * | reader | ) |
Determine if the specified background file reader is connected to this search object.
reader | The background reader to check. |
Definition at line 63 of file ZblLogSearch.cpp.
|
static |
Initializes search engine. Must be called only once before constructing the first ZblLogSearch object.
Definition at line 57 of file ZblLogSearch.cpp.
Referenced by Zbl::ZLogReader::registerType().
|
protected |
True if search is active, false if inactive.
A search is active when search opeartions are enabled and results for the search are currently in memory.
Search operations are disabled for inactive searches and search results are not available in memory.
Definition at line 622 of file ZblLogSearch.h.
Referenced by getActive(), and ZblLogSearch().
|
protected |
The file size at the successful conclusion of the search operation.
Minus one indicates no successful conclusion state has yet been achieved.
Definition at line 652 of file ZblLogSearch.h.
Referenced by getCompletionFileSize().
|
protected |
A log record link data model that is shared by all ZLogReclinkModel objects created by this ZlogSearchmark object.
The ZblLogReclinkData object is synchronized with the ZLogSearch object that created it such that changes to the search result set made to the ZLogSearch object will be propagated to the ZblLogReclinkData object.
The shared ZblLogReclinkData object will be destroyed when all referencing ZLogReclinkModel objects are deleted since ZLogReclinkModel holds a QSharedPointer (strong reference) to ZblLogReclinkData.
QWeakPointer won't prevent the ZblLogReclinkData object from being destroyed. Thus must promomte it to a strong pointer and check for object existence before using it.
Definition at line 605 of file ZblLogSearch.h.
Referenced by linkModel(), and onLinkTextComplete().
|
protected |
The roles in which a search result was found.
This data is used to optimize performance of highlighting search text in the log record data model by using trivial rejection of data roles that don't contain search results.
Definition at line 584 of file ZblLogSearch.h.
Referenced by addRoleFound(), addRolesFound(), clearRolesFound(), and getRolesFound().
|
protected |
The log record rolls that are searched.
Only roles in this set will be examined when scanning log file to create this searchmark.
Definition at line 573 of file ZblLogSearch.h.
Referenced by addSearchRole(), addSearchRoles(), clearSearchRoles(), containsSearchRoles(), equalsSearchRoles(), getSearchParameters(), getSearchRoles(), isNull(), isSearch(), and ZblLogSearch().
|
protected |
True is search is saved, false if unsaved.
A search is saved when it has previously been written to persistent storage.
Definition at line 631 of file ZblLogSearch.h.
Referenced by getSaved(), and ZblLogSearch().
|
protected |
Links in this map represent areas of the log file that have already been searched.
Definition at line 658 of file ZblLogSearch.h.
|
protected |
Specifies direction of search from active viewport location.
Definition at line 637 of file ZblLogSearch.h.
Referenced by getSearchBackward(), getSearchDirections(), getSearchForward(), getSearchParameters(), setSearchBackward(), setSearchDirections(), setSearchForward(), and ZblLogSearch().
|
protected |
A background searcher object to service foreground log file search requests.
Definition at line 665 of file ZblLogSearch.h.
Referenced by getSearcher(), search(), and ZblLogSearch().
|
staticprotected |
A single background thread services all ZblLogBkSearch objects.
Definition at line 670 of file ZblLogSearch.h.
Referenced by ZblLogSearch(), and zInit().
|
protected |
The search phrase used to generate these search results.
Definition at line 558 of file ZblLogSearch.h.
Referenced by getPhrase(), getSearchParameters(), getSearchRolesName(), isNull(), and isSearch().
|
protected |
Tracks the state of a search operation.
Definition at line 612 of file ZblLogSearch.h.
Referenced by getSearchState(), and ZblLogSearch().
|
protected |
The type of search: case sensitive/insensitive or regular expression.
Definition at line 564 of file ZblLogSearch.h.
Referenced by getSearchParameters(), getSearchType(), isSearch(), and ZblLogSearch().
|
protected |
File seek position of the log record from which to start the search operation.
Definition at line 644 of file ZblLogSearch.h.
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.