|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team. |
|
4 ** All rights reserved. |
|
5 ** |
|
6 ** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
7 ** All rights reserved. |
|
8 ** |
|
9 ** This file may be used under the terms of the GNU Lesser General Public |
|
10 ** License version 2.1 as published by the Free Software Foundation and |
|
11 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
12 ** Please review the following information to ensure the GNU Lesser General |
|
13 ** Public License version 2.1 requirements will be met: |
|
14 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
15 ** |
|
16 ****************************************************************************/ |
|
17 |
|
18 #ifndef QANALYZER_P_H |
|
19 #define QANALYZER_P_H |
|
20 |
|
21 // |
|
22 // W A R N I N G |
|
23 // ------------- |
|
24 // |
|
25 // This file is not part of the Qt API. It exists for the convenience |
|
26 // of the help generator tools. This header file may change from version |
|
27 // to version without notice, or even be removed. |
|
28 // |
|
29 // We mean it. |
|
30 // |
|
31 |
|
32 #include "qreader_p.h" |
|
33 #include "qtokenstream_p.h" |
|
34 #include "qclucene_global_p.h" |
|
35 |
|
36 #include <QtCore/QList> |
|
37 #include <QtCore/QString> |
|
38 #include <QtCore/QStringList> |
|
39 #include <QtCore/QSharedDataPointer> |
|
40 #include <QtCore/QSharedData> |
|
41 |
|
42 CL_NS_DEF(analysis) |
|
43 class Analyzer; |
|
44 CL_NS_END |
|
45 CL_NS_USE(analysis) |
|
46 |
|
47 QT_BEGIN_NAMESPACE |
|
48 |
|
49 class QCLuceneIndexWriter; |
|
50 class QCLuceneQueryParser; |
|
51 class QCLuceneStopAnalyzer; |
|
52 class QCLuceneSimpleAnalyzer; |
|
53 class QCLuceneKeywordAnalyzer; |
|
54 class QCLuceneStandardAnalyzer; |
|
55 class QCLuceneWhitespaceAnalyzer; |
|
56 class QCLucenePerFieldAnalyzerWrapper; |
|
57 |
|
58 class QHELP_EXPORT QCLuceneAnalyzerPrivate : public QSharedData |
|
59 { |
|
60 public: |
|
61 QCLuceneAnalyzerPrivate(); |
|
62 QCLuceneAnalyzerPrivate(const QCLuceneAnalyzerPrivate &other); |
|
63 |
|
64 ~QCLuceneAnalyzerPrivate(); |
|
65 |
|
66 Analyzer *analyzer; |
|
67 bool deleteCLuceneAnalyzer; |
|
68 |
|
69 private: |
|
70 QCLuceneAnalyzerPrivate &operator=(const QCLuceneAnalyzerPrivate &other); |
|
71 }; |
|
72 |
|
73 class QHELP_EXPORT QCLuceneAnalyzer |
|
74 { |
|
75 public: |
|
76 virtual ~QCLuceneAnalyzer(); |
|
77 |
|
78 qint32 positionIncrementGap(const QString &fieldName) const; |
|
79 QCLuceneTokenStream tokenStream(const QString &fieldName, |
|
80 const QCLuceneReader &reader) const; |
|
81 |
|
82 protected: |
|
83 friend class QCLuceneIndexWriter; |
|
84 friend class QCLuceneQueryParser; |
|
85 friend class QCLuceneStopAnalyzer; |
|
86 friend class QCLuceneSimpleAnalyzer; |
|
87 friend class QCLuceneKeywordAnalyzer; |
|
88 friend class QCLuceneStandardAnalyzer; |
|
89 friend class QCLuceneWhitespaceAnalyzer; |
|
90 friend class QCLucenePerFieldAnalyzerWrapper; |
|
91 QSharedDataPointer<QCLuceneAnalyzerPrivate> d; |
|
92 |
|
93 private: |
|
94 QCLuceneAnalyzer(); |
|
95 }; |
|
96 |
|
97 class QHELP_EXPORT QCLuceneStandardAnalyzer : public QCLuceneAnalyzer |
|
98 { |
|
99 public: |
|
100 QCLuceneStandardAnalyzer(); |
|
101 QCLuceneStandardAnalyzer(const QStringList &stopWords); |
|
102 |
|
103 ~QCLuceneStandardAnalyzer(); |
|
104 }; |
|
105 |
|
106 class QHELP_EXPORT QCLuceneWhitespaceAnalyzer : public QCLuceneAnalyzer |
|
107 { |
|
108 public: |
|
109 QCLuceneWhitespaceAnalyzer(); |
|
110 ~QCLuceneWhitespaceAnalyzer(); |
|
111 }; |
|
112 |
|
113 class QHELP_EXPORT QCLuceneSimpleAnalyzer : public QCLuceneAnalyzer |
|
114 { |
|
115 public: |
|
116 QCLuceneSimpleAnalyzer(); |
|
117 ~QCLuceneSimpleAnalyzer(); |
|
118 }; |
|
119 |
|
120 class QHELP_EXPORT QCLuceneStopAnalyzer : public QCLuceneAnalyzer |
|
121 { |
|
122 public: |
|
123 QCLuceneStopAnalyzer(); |
|
124 QCLuceneStopAnalyzer(const QStringList &stopWords); |
|
125 |
|
126 ~QCLuceneStopAnalyzer(); |
|
127 |
|
128 QStringList englishStopWords() const; |
|
129 }; |
|
130 |
|
131 class QHELP_EXPORT QCLuceneKeywordAnalyzer : public QCLuceneAnalyzer |
|
132 { |
|
133 public: |
|
134 QCLuceneKeywordAnalyzer(); |
|
135 ~QCLuceneKeywordAnalyzer(); |
|
136 }; |
|
137 |
|
138 class QHELP_EXPORT QCLucenePerFieldAnalyzerWrapper : public QCLuceneAnalyzer |
|
139 { |
|
140 public: |
|
141 QCLucenePerFieldAnalyzerWrapper(QCLuceneAnalyzer *defaultAnalyzer); |
|
142 ~QCLucenePerFieldAnalyzerWrapper(); |
|
143 |
|
144 void addAnalyzer(const QString &fieldName, QCLuceneAnalyzer *analyzer); |
|
145 |
|
146 private: |
|
147 QList<QCLuceneAnalyzer*> analyzers; |
|
148 }; |
|
149 |
|
150 QT_END_NAMESPACE |
|
151 |
|
152 #endif // QANALYZER_P_H |