Debian Codegraph @

unikey/pattern.h

raw
1 /*
2 * SPDX-FileCopyrightText: 1998-2002 Pham Kim Long <[email protected]>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 #ifndef __PATTERN_H
7 #define __PATTERN_H
8
9 #if defined(_WIN32)
10 #if defined(UNIKEYHOOK)
11 #define DllInterface __declspec(dllexport)
12 #else
13 #define DllInterface __declspec(dllimport)
14 #endif
15 #else
16 #define DllInterface // not used
17 #endif
18
19 #define MAX_PATTERN_LEN 40
20
21 class DllInterface PatternState {
22 public:
23 char *m_pattern;
24 int m_border[MAX_PATTERN_LEN + 1];
25 int m_pos;
26 int m_found;
27 void init(char *pattern);
28 void reset();
29 int foundAtNextChar(
30 char ch); // get next input char, returns 1 if pattern is found.
31 };
32
33 class DllInterface PatternList {
34 public:
35 PatternState *m_patterns;
36 int m_count;
37 void init(char **patterns, int count);
38 int foundAtNextChar(char ch);
39 void reset();
40
41 PatternList() {
42 m_count = 0;
43 m_patterns = 0;
44 }
45
46 ~PatternList() {
47 if (m_patterns)
48 delete[] m_patterns;
49 }
50 };
51
52 #endif