1 /*
2   FXiTe - The Free eXtensIble Text Editor
3   Copyright (c) 2009 Jeffrey Pohlmeyer <yetanothergeek@gmail.com>
4 
5   This program is free software; you can redistribute it and/or modify it
6   under the terms of the GNU General Public License version 3 as
7   published by the Free Software Foundation.
8 
9   This software is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 
19 
20 class SciDoc;
21 
22 #define MAX_CAPTURES 9
23 
24 
25 class SciSearch {
26 private:
27   FXint begs[MAX_CAPTURES],ends[MAX_CAPTURES];
28   const char*content;
29   SciDoc*sci;
30   FXSelector message;
31   void SelectTarget(bool forward);
32   void EnsureAnchorDirection(bool forward);
33   FXRexError rxerr;
34   bool CheckRegex(const FXRex &rx, bool quiet=false);
35   void NotifyRecorder(const FXString &searchfor, const FXString &replacewith, FXuint opts, FXint mode);
36 public:
SciSearch(SciDoc * scidoc,FXSelector sel)37   SciSearch(SciDoc*scidoc, FXSelector sel) { sci=scidoc; message=sel; }
38   int FindTextNoSel(const FXString &what, FXuint sciflags, long &beg, long &end);
39   bool FindText(const FXString &what, FXuint sciflags, bool forward, bool wrap);
40   void ReplaceSelection(const FXString &replacewith, FXuint opts);
41   long ReplaceAllInDoc(const FXString &searchfor, const FXString &replacewith, FXuint opts);
42   long ReplaceAllInSel(const FXString &searchfor, const FXString &replacewith, FXuint opts);
43 };
44 
45