source: trunk/tools/assistant/lib/fulltextsearch/qanalyzer_p.h@ 966

Last change on this file since 966 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 3.9 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
4** All rights reserved.
5**
6** Portion Copyright (C) 2011 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
42CL_NS_DEF(analysis)
43 class Analyzer;
44CL_NS_END
45CL_NS_USE(analysis)
46
47QT_BEGIN_NAMESPACE
48
49class QCLuceneIndexWriter;
50class QCLuceneQueryParser;
51class QCLuceneStopAnalyzer;
52class QCLuceneSimpleAnalyzer;
53class QCLuceneKeywordAnalyzer;
54class QCLuceneStandardAnalyzer;
55class QCLuceneWhitespaceAnalyzer;
56class QCLucenePerFieldAnalyzerWrapper;
57
58class QHELP_EXPORT QCLuceneAnalyzerPrivate : public QSharedData
59{
60public:
61 QCLuceneAnalyzerPrivate();
62 QCLuceneAnalyzerPrivate(const QCLuceneAnalyzerPrivate &other);
63
64 ~QCLuceneAnalyzerPrivate();
65
66 Analyzer *analyzer;
67 bool deleteCLuceneAnalyzer;
68
69private:
70 QCLuceneAnalyzerPrivate &operator=(const QCLuceneAnalyzerPrivate &other);
71};
72
73class QHELP_EXPORT QCLuceneAnalyzer
74{
75public:
76 virtual ~QCLuceneAnalyzer();
77
78 qint32 positionIncrementGap(const QString &fieldName) const;
79 QCLuceneTokenStream tokenStream(const QString &fieldName,
80 const QCLuceneReader &reader) const;
81
82protected:
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
93private:
94 QCLuceneAnalyzer();
95};
96
97class QHELP_EXPORT QCLuceneStandardAnalyzer : public QCLuceneAnalyzer
98{
99public:
100 QCLuceneStandardAnalyzer();
101 QCLuceneStandardAnalyzer(const QStringList &stopWords);
102
103 ~QCLuceneStandardAnalyzer();
104};
105
106class QHELP_EXPORT QCLuceneWhitespaceAnalyzer : public QCLuceneAnalyzer
107{
108public:
109 QCLuceneWhitespaceAnalyzer();
110 ~QCLuceneWhitespaceAnalyzer();
111};
112
113class QHELP_EXPORT QCLuceneSimpleAnalyzer : public QCLuceneAnalyzer
114{
115public:
116 QCLuceneSimpleAnalyzer();
117 ~QCLuceneSimpleAnalyzer();
118};
119
120class QHELP_EXPORT QCLuceneStopAnalyzer : public QCLuceneAnalyzer
121{
122public:
123 QCLuceneStopAnalyzer();
124 QCLuceneStopAnalyzer(const QStringList &stopWords);
125
126 ~QCLuceneStopAnalyzer();
127
128 QStringList englishStopWords() const;
129};
130
131class QHELP_EXPORT QCLuceneKeywordAnalyzer : public QCLuceneAnalyzer
132{
133public:
134 QCLuceneKeywordAnalyzer();
135 ~QCLuceneKeywordAnalyzer();
136};
137
138class QHELP_EXPORT QCLucenePerFieldAnalyzerWrapper : public QCLuceneAnalyzer
139{
140public:
141 QCLucenePerFieldAnalyzerWrapper(QCLuceneAnalyzer *defaultAnalyzer);
142 ~QCLucenePerFieldAnalyzerWrapper();
143
144 void addAnalyzer(const QString &fieldName, QCLuceneAnalyzer *analyzer);
145
146private:
147 QList<QCLuceneAnalyzer*> analyzers;
148};
149
150QT_END_NAMESPACE
151
152#endif // QANALYZER_P_H
Note: See TracBrowser for help on using the repository browser.