Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
dw::core::FindtextState Class Reference

#include <findtext.hh>

Public Types

enum  Result { SUCCESS , RESTART , NOT_FOUND }
 

Public Member Functions

 FindtextState ()
 
 ~FindtextState ()
 
void setWidget (Widget *widget)
 
Result search (const char *key, bool caseSens, bool backwards)
 
void resetSearch ()
 This method is called when the user closes the "find text" dialog.
 

Private Member Functions

bool unhighlight ()
 Unhighlight, and return whether a region was highlighted.
 
bool search0 (bool backwards, bool firstTrial)
 

Static Private Member Functions

static const char * rev (const char *_str)
 
static int * createNexttab (const char *needle, bool caseSens, bool backwards)
 
static bool charsEqual (char c1, char c2, bool caseSens)
 

Private Attributes

char * key
 The key used for the last search.
 
bool caseSens
 Whether the last search was case sensitive.
 
int * nexttab
 The table used for KMP search.
 
Widgetwidget
 The top of the widget tree, in which the search is done.
 
CharIteratoriterator
 The position from where the next search will start.
 
CharIteratorhlIterator
 The position from where the characters are highlighted.
 

Detailed Description

Definition at line 13 of file findtext.hh.

Member Enumeration Documentation

◆ Result

Enumerator
SUCCESS 

The next occurrence of the pattern has been found.

RESTART 

There is no further occurrence of the pattern, instead, the first occurrence has been selected.

NOT_FOUND 

The patten does not at all occur in the text.

Definition at line 16 of file findtext.hh.

Constructor & Destructor Documentation

◆ FindtextState()

dw::core::FindtextState::FindtextState ( )

Definition at line 30 of file findtext.cc.

References DBG_OBJ_CREATE, hlIterator, iterator, key, nexttab, and widget.

◆ ~FindtextState()

dw::core::FindtextState::~FindtextState ( )

Definition at line 41 of file findtext.cc.

References DBG_OBJ_DELETE, hlIterator, iterator, key, and nexttab.

Member Function Documentation

◆ charsEqual()

static bool dw::core::FindtextState::charsEqual ( char  c1,
char  c2,
bool  caseSens 
)
inlinestaticprivate

Definition at line 68 of file findtext.hh.

References caseSens.

Referenced by createNexttab(), and search0().

◆ createNexttab()

int * dw::core::FindtextState::createNexttab ( const char *  needle,
bool  caseSens,
bool  backwards 
)
staticprivate

Definition at line 177 of file findtext.cc.

References caseSens, charsEqual(), key, nexttab, and rev().

Referenced by search().

◆ resetSearch()

void dw::core::FindtextState::resetSearch ( )

This method is called when the user closes the "find text" dialog.

Definition at line 151 of file findtext.cc.

References key, and unhighlight().

Referenced by dw::core::Layout::resetSearch().

◆ rev()

const char * dw::core::FindtextState::rev ( const char *  _str)
staticprivate

Definition at line 163 of file findtext.cc.

Referenced by createNexttab(), and search0().

◆ search()

◆ search0()

bool dw::core::FindtextState::search0 ( bool  backwards,
bool  firstTrial 
)
private

◆ setWidget()

void dw::core::FindtextState::setWidget ( Widget widget)

Definition at line 55 of file findtext.cc.

References hlIterator, iterator, key, nexttab, and widget.

Referenced by dw::core::Layout::addWidget(), and dw::core::Layout::removeWidget().

◆ unhighlight()

bool dw::core::FindtextState::unhighlight ( )
private

Unhighlight, and return whether a region was highlighted.

Definition at line 208 of file findtext.cc.

References dw::core::CharIterator::cloneCharIterator(), dw::core::HIGHLIGHT_FINDTEXT, hlIterator, key, dw::core::CharIterator::prev(), and dw::core::CharIterator::unhighlight().

Referenced by resetSearch(), and search().

Member Data Documentation

◆ caseSens

bool dw::core::FindtextState::caseSens
private

Whether the last search was case sensitive.

Definition at line 40 of file findtext.hh.

Referenced by charsEqual(), createNexttab(), search(), and search0().

◆ hlIterator

CharIterator* dw::core::FindtextState::hlIterator
private

The position from where the characters are highlighted.

NULL, when no text is highlighted.

Definition at line 60 of file findtext.hh.

Referenced by FindtextState(), search(), setWidget(), unhighlight(), and ~FindtextState().

◆ iterator

CharIterator* dw::core::FindtextState::iterator
private

The position from where the next search will start.

Definition at line 53 of file findtext.hh.

Referenced by FindtextState(), search(), search0(), setWidget(), and ~FindtextState().

◆ key

char* dw::core::FindtextState::key
private

The key used for the last search.

If dw::core::Findtext::search is called with the same key, the search is continued, otherwise it is restarted.

Definition at line 37 of file findtext.hh.

Referenced by createNexttab(), FindtextState(), resetSearch(), search(), search0(), setWidget(), unhighlight(), and ~FindtextState().

◆ nexttab

int* dw::core::FindtextState::nexttab
private

The table used for KMP search.

Definition at line 43 of file findtext.hh.

Referenced by createNexttab(), FindtextState(), search(), search0(), setWidget(), and ~FindtextState().

◆ widget

Widget* dw::core::FindtextState::widget
private

The top of the widget tree, in which the search is done.

From this, the iterator will be constructed. Set by dw::core::Findtext::widget

Definition at line 50 of file findtext.hh.

Referenced by FindtextState(), search(), and setWidget().


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