edbee - Qt Editor Library
Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
edbee::TextSearcher Class Reference

The text searcher is a class to remember the current search operation It remembers the current searchTerm that is used for searching The textsearcher component has got several option. Like case sensitivity regular expressions etc. More...

#include <textsearcher.h>

+ Inheritance diagram for edbee::TextSearcher:
+ Collaboration diagram for edbee::TextSearcher:

Public Types

enum  SyntaxType { SyntaxPlainString, SyntaxRegExp }
 

Public Slots

bool findNext (TextEditorWidget *widget)
 Finds the next item based on the given caret position in the selection. More...
 
bool findPrev (TextEditorWidget *widget)
 Finds the previous item based on the given caret position in the selection. More...
 
bool selectNext (TextEditorWidget *widget)
 Selects the next item that matches the given critaria (Adds an extra selection range ) More...
 
bool selectPrev (TextEditorWidget *widget)
 Selects the previous item based on the given caret position in the selection. More...
 
bool selectAll (TextEditorWidget *widget)
 Selects all matches of the current item. More...
 
void selectUnderExpand (TextEditorWidget *widget, bool selectAllTexts)
 A smart selection: when there's no selection the current word is used and selected. The next word will be selected, if all is specified all words are selected. More...
 

Public Member Functions

 TextSearcher (QObject *parent=0)
 
virtual ~TextSearcher ()
 destroys the textsearcher More...
 
QString searchTerm () const
 Returns the current active searchterm. More...
 
void setSearchTerm (const QString &term)
 Sets the current search term. More...
 
SyntaxType syntax () const
 Returns the syntax type of the current search operation. More...
 
void setSyntax (SyntaxType syntax)
 Sets the syntax mode of the searcher syntax the SyntaxType to use (SyntaxPlainString, SyntaxRegExp) More...
 
bool isCaseSensitive () const
 Returns the case sensitivity of the textsearcher. More...
 
void setCaseSensitive (bool sensitive)
 sets the case sensitivity of the search operation More...
 
bool isWrapAroundEnabled () const
 Should the search wrap around the contents of the document. More...
 
void setWrapAround (bool on)
 For changing the wrap around mode of the TextSearcher. More...
 
bool isReverse () const
 Checks the reverse mode. More...
 
void setReverse (bool on)
 Sets the search reverse mode. More...
 
TextRange findNextRange (TextRangeSet *selection)
 Finds the next matching textrange This method does not alter the textrange selection. It only returns the range of the next match. More...
 
bool findNext (TextRangeSet *selection)
 Finds the next item based on the given caret position in the selection. More...
 
bool findPrev (TextRangeSet *selection)
 Finds the previous item based on the given caret position in the selection. More...
 
bool selectNext (TextRangeSet *selection)
 Selects the next item that matches the given critaria (Adds an extra selection range ) More...
 
bool selectPrev (TextRangeSet *selection)
 Selects the previous item based on the given caret position in the selection. More...
 
bool selectAll (TextRangeSet *selection)
 Select all matching items in the document. More...
 

Protected Member Functions

void setDirty ()
 Marks the regexp as dirty (and deletes it) More...
 
RegExpcreateRegExp ()
 Creates a regular expression for the current selected options. More...
 

Detailed Description

The text searcher is a class to remember the current search operation It remembers the current searchTerm that is used for searching The textsearcher component has got several option. Like case sensitivity regular expressions etc.

Member Enumeration Documentation

◆ SyntaxType

Enumerator
SyntaxPlainString 
SyntaxRegExp 

Constructor & Destructor Documentation

◆ TextSearcher()

edbee::TextSearcher::TextSearcher ( QObject *  parent = 0)
explicit

◆ ~TextSearcher()

edbee::TextSearcher::~TextSearcher ( )
virtual

destroys the textsearcher

Member Function Documentation

◆ createRegExp()

RegExp * edbee::TextSearcher::createRegExp ( )
protected

Creates a regular expression for the current selected options.

Returns
the new regular expression

◆ findNext() [1/2]

bool edbee::TextSearcher::findNext ( TextRangeSet selection)

Finds the next item based on the given caret position in the selection.

Parameters
selectionthe selection to use for searching
Returns
true if the next selection has been foudn

◆ findNext [2/2]

bool edbee::TextSearcher::findNext ( TextEditorWidget widget)
slot

Finds the next item based on the given caret position in the selection.

Parameters
widgetthe widget to find the next item

◆ findNextRange()

TextRange edbee::TextSearcher::findNextRange ( TextRangeSet selection)

Finds the next matching textrange This method does not alter the textrange selection. It only returns the range of the next match.

Parameters
selectionthe text-selection to use
Returns
the textRange with the found text. TextRange::isEmpty() can be called to check if nothing has been found

◆ findPrev() [1/2]

bool edbee::TextSearcher::findPrev ( TextRangeSet selection)

Finds the previous item based on the given caret position in the selection.

Parameters
selectionthe selection to use and alter
Returns
true if the previous item has been found false if not found

◆ findPrev [2/2]

bool edbee::TextSearcher::findPrev ( TextEditorWidget widget)
slot

Finds the previous item based on the given caret position in the selection.

Parameters
widgetthe widget to search in

◆ isCaseSensitive()

bool edbee::TextSearcher::isCaseSensitive ( ) const

Returns the case sensitivity of the textsearcher.

◆ isReverse()

bool edbee::TextSearcher::isReverse ( ) const

Checks the reverse mode.

◆ isWrapAroundEnabled()

bool edbee::TextSearcher::isWrapAroundEnabled ( ) const

Should the search wrap around the contents of the document.

◆ searchTerm()

QString edbee::TextSearcher::searchTerm ( ) const

Returns the current active searchterm.

◆ selectAll() [1/2]

bool edbee::TextSearcher::selectAll ( TextRangeSet selection)

Select all matching items in the document.

Parameters
selectionthe selection to search for
Returns
true if one ore more items are selected false if not found

◆ selectAll [2/2]

bool edbee::TextSearcher::selectAll ( TextEditorWidget widget)
slot

Selects all matches of the current item.

Parameters
widgetthe widget to search in
selectionthe selection to change

◆ selectNext() [1/2]

bool edbee::TextSearcher::selectNext ( TextRangeSet selection)

Selects the next item that matches the given critaria (Adds an extra selection range )

Parameters
widgetthe widget to search in
selectionthe selection to use
Returns
true if the next item has been found false if it hasn't been.

◆ selectNext [2/2]

bool edbee::TextSearcher::selectNext ( TextEditorWidget widget)
slot

Selects the next item that matches the given critaria (Adds an extra selection range )

Parameters
widgetthe widget to search in

◆ selectPrev() [1/2]

bool edbee::TextSearcher::selectPrev ( TextRangeSet selection)

Selects the previous item based on the given caret position in the selection.

Parameters
selectionthe selection to use
Returns
true if the selection has been found false if it hasn't been found

◆ selectPrev [2/2]

bool edbee::TextSearcher::selectPrev ( TextEditorWidget widget)
slot

Selects the previous item based on the given caret position in the selection.

Parameters
widgetthe widget to to search in

◆ selectUnderExpand

void edbee::TextSearcher::selectUnderExpand ( TextEditorWidget widget,
bool  selectAllTexts 
)
slot

A smart selection: when there's no selection the current word is used and selected. The next word will be selected, if all is specified all words are selected.

Parameters
widgetthe widget to select
selectAllTextsif true then all occurences are selected

◆ setCaseSensitive()

void edbee::TextSearcher::setCaseSensitive ( bool  sensitive)

sets the case sensitivity of the search operation

◆ setDirty()

void edbee::TextSearcher::setDirty ( )
protected

Marks the regexp as dirty (and deletes it)

◆ setReverse()

void edbee::TextSearcher::setReverse ( bool  on)

Sets the search reverse mode.

◆ setSearchTerm()

void edbee::TextSearcher::setSearchTerm ( const QString &  term)

Sets the current search term.

◆ setSyntax()

void edbee::TextSearcher::setSyntax ( TextSearcher::SyntaxType  syntax)

Sets the syntax mode of the searcher syntax the SyntaxType to use (SyntaxPlainString, SyntaxRegExp)

◆ setWrapAround()

void edbee::TextSearcher::setWrapAround ( bool  on)

For changing the wrap around mode of the TextSearcher.

◆ syntax()

TextSearcher::SyntaxType edbee::TextSearcher::syntax ( ) const

Returns the syntax type of the current search operation.


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