Dillo
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
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. More...
 

Private Member Functions

bool unhighlight ()
 Unhighlight, and return whether a region was highlighted. More...
 
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. More...
 
bool caseSens
 Whether the last search was case sensitive. More...
 
int * nexttab
 The table used for KMP search. More...
 
Widgetwidget
 The top of the widget tree, in which the search is done. More...
 
CharIteratoriterator
 The position from where the next search will start. More...
 
CharIteratorhlIterator
 The position from where the characters are highlighted. More...
 

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Referenced by createNexttab(), and search0().

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

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

Referenced by search().

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

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

References key, and unhighlight().

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

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

Referenced by createNexttab(), and search0().

FindtextState::Result dw::core::FindtextState::search ( const char *  key,
bool  caseSens,
bool  backwards 
)
bool dw::core::FindtextState::search0 ( bool  backwards,
bool  firstTrial 
)
private
void dw::core::FindtextState::setWidget ( Widget widget)

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

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

Member Data Documentation

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

Whether the last search was case sensitive.

Referenced by search(), and search0().

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

The position from where the characters are highlighted.

NULL, when no text is highlighted.

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

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

The position from where the next search will start.

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

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.

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

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

The table used for KMP search.

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

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

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


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