1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*
Basic History plugin
Copyright (C) 2011-2012 Krzysztof Kral
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "SearchContext.h"
class Searcher : ComparatorInterface
{
private:
SearchContext* context;
int lastFindSelection;
int startFindPos;
int startFindSel;
HCONTACT startFindContact;
bool isFindSelChanged;
bool isFindContactChanged;
bool findBack, matchCase, matchWholeWords, onlyIn, onlyOut, onlyGroup, allUsers, searchForInLG, searchForInMes;
bool CompareStr(std::wstring str, TCHAR *strFind);
bool IsInSel(int sel, TCHAR *strFind);
public:
Searcher();
virtual bool Compare(const bool isMe, const std::wstring& message, TCHAR *strFind);
void Find();
void ChangeFindDirection(bool isBack);
void ClearFind();
void SetContect(SearchContext* _context){
context = _context;
}
void SetMatchCase(bool val){
matchCase = val;
ClearFind();
}
void SetMatchWholeWords(bool val){
matchWholeWords = val;
ClearFind();
}
bool IsMatchCase(){
return matchCase;
}
bool IsMatchWholeWords(){
return matchWholeWords;
}
bool IsFindBack(){
return findBack;
}
void SetOnlyIn(bool val){
onlyIn = val;
if (val && onlyOut)
onlyOut = false;
ClearFind();
}
void SetOnlyOut(bool val){
onlyOut = val;
if (val && onlyIn)
onlyIn = false;
ClearFind();
}
bool IsOnlyIn(){
return onlyIn;
}
bool IsOnlyOut(){
return onlyOut;
}
void SetOnlyGroup(bool val){
onlyGroup = val;
if (onlyGroup)
allUsers = false;
ClearFind();
}
bool IsOnlyGroup(){
return onlyGroup;
}
void SetAllUsers(bool val){
allUsers = val;
if (allUsers)
onlyGroup = false;
ClearFind();
}
bool IsAllUsers(){
return allUsers;
}
void SetSearchForInLG(bool val){
if (searchForInLG != val)
{
searchForInLG = val;
ClearFind();
}
}
void SetSearchForInMes(bool val){
if (searchForInMes != val)
{
searchForInMes = val;
ClearFind();
}
}
bool IsSearchForInLG(){
return searchForInLG;
}
bool IsSearchForInMes(){
return searchForInMes;
}
};
|