Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
findtext.hh
Go to the documentation of this file.
1#ifndef __DW_FINDTEXT_STATE_H__
2#define __DW_FINDTEXT_STATE_H__
3
4#ifndef __INCLUDED_FROM_DW_CORE_HH__
5# error Do not include this file directly, use "core.hh" instead.
6#endif
7
8#include <ctype.h>
9
10namespace dw {
11namespace core {
12
14{
15public:
16 typedef enum {
19
25
29
30private:
37 char *key;
38
41
43 int *nexttab;
44
51
54
61
62 static const char* rev(const char* _str); /* reverse a C string */
63
64 static int *createNexttab (const char *needle,bool caseSens,bool backwards);
65 bool unhighlight ();
66 bool search0 (bool backwards, bool firstTrial);
67
68 inline static bool charsEqual (char c1, char c2, bool caseSens)
69 { return caseSens ? c1 == c2 : tolower (c1) == tolower (c2) ||
70 (isspace (c1) && isspace (c2)); }
71
72public:
75
76 void setWidget (Widget *widget);
77 Result search (const char *key, bool caseSens, bool backwards);
78 void resetSearch ();
79};
80
81} // namespace core
82} // namespace dw
83
84#endif // __DW_FINDTEXT_STATE_H__
static int * createNexttab(const char *needle, bool caseSens, bool backwards)
Definition findtext.cc:177
CharIterator * hlIterator
The position from where the characters are highlighted.
Definition findtext.hh:60
int * nexttab
The table used for KMP search.
Definition findtext.hh:43
void resetSearch()
This method is called when the user closes the "find text" dialog.
Definition findtext.cc:151
bool search0(bool backwards, bool firstTrial)
Definition findtext.cc:225
@ SUCCESS
The next occurrence of the pattern has been found.
Definition findtext.hh:18
@ NOT_FOUND
The patten does not at all occur in the text.
Definition findtext.hh:27
@ RESTART
There is no further occurrence of the pattern, instead, the first occurrence has been selected.
Definition findtext.hh:24
Result search(const char *key, bool caseSens, bool backwards)
Definition findtext.cc:75
CharIterator * iterator
The position from where the next search will start.
Definition findtext.hh:53
bool unhighlight()
Unhighlight, and return whether a region was highlighted.
Definition findtext.cc:208
static bool charsEqual(char c1, char c2, bool caseSens)
Definition findtext.hh:68
static const char * rev(const char *_str)
Definition findtext.cc:163
char * key
The key used for the last search.
Definition findtext.hh:37
bool caseSens
Whether the last search was case sensitive.
Definition findtext.hh:40
void setWidget(Widget *widget)
Definition findtext.cc:55
Widget * widget
The top of the widget tree, in which the search is done.
Definition findtext.hh:50
The base class of all dillo widgets.
Definition widget.hh:44
Dw is in this namespace, or sub namespaces of this one.