Dillo
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 
10 namespace dw {
11 namespace core {
12 
14 {
15 public:
16  typedef enum {
19 
25 
28  } Result;
29 
30 private:
37  char *key;
38 
40  bool caseSens;
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 
72 public:
73  FindtextState ();
74  ~FindtextState ();
75 
76  void setWidget (Widget *widget);
77  Result search (const char *key, bool caseSens, bool backwards);
78  void resetSearch ();
79 };
80 
81 } // namespace dw
82 } // namespace core
83 
84 #endif // __DW_FINDTEXT_STATE_H__