source: trunk/tools/assistant/lib/fulltextsearch/qquery_p.h

Last change on this file 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: 4.4 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 QQUERY_P_H
19#define QQUERY_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 "qterm_p.h"
33#include "qclucene_global_p.h"
34
35#include <QtCore/QList>
36#include <QtCore/QString>
37#include <QtCore/QSharedDataPointer>
38#include <QtCore/QSharedData>
39
40CL_NS_DEF(search)
41 class Query;
42CL_NS_END
43CL_NS_USE(search)
44
45QT_BEGIN_NAMESPACE
46
47class QCLuceneHits;
48class QCLuceneTermQuery;
49class QCLuceneRangeQuery;
50class QCLuceneQueryParser;
51class QCLucenePrefixQuery;
52class QCLuceneBooleanQuery;
53class QCLucenePhraseQuery;
54
55class QHELP_EXPORT QCLuceneQueryPrivate : public QSharedData
56{
57public:
58 QCLuceneQueryPrivate();
59 QCLuceneQueryPrivate(const QCLuceneQueryPrivate &other);
60
61 ~QCLuceneQueryPrivate();
62
63 Query *query;
64 bool deleteCLuceneQuery;
65
66private:
67 QCLuceneQueryPrivate &operator=(const QCLuceneQueryPrivate &other);
68};
69
70class QHELP_EXPORT QCLuceneQuery
71{
72public:
73 virtual ~QCLuceneQuery();
74
75 void setBoost(qreal boost);
76 qreal getBoost() const;
77 QString getQueryName() const;
78 bool instanceOf(const QString &other) const;
79 QString toString(const QString &field) const;
80 quint32 hashCode() const;
81 QString toString() const;
82 bool equals(const QCLuceneQuery &other) const;
83
84protected:
85 friend class QCLuceneHits;
86 friend class QCLuceneTermQuery;
87 friend class QCLuceneRangeQuery;
88 friend class QCLucenePrefixQuery;
89 friend class QCLuceneQueryParser;
90 friend class QCLuceneBooleanQuery;
91 friend class QCLucenePhraseQuery;
92 QSharedDataPointer<QCLuceneQueryPrivate> d;
93
94private:
95 QCLuceneQuery();
96};
97
98class QHELP_EXPORT QCLucenePrefixQuery : public QCLuceneQuery
99{
100public:
101 QCLucenePrefixQuery(const QCLuceneTerm &prefix);
102 ~QCLucenePrefixQuery();
103
104 static QString getClassName();
105
106 QCLuceneTerm getPrefix() const;
107
108private:
109 QCLuceneTerm prefix;
110};
111
112class QHELP_EXPORT QCLuceneRangeQuery : public QCLuceneQuery
113{
114public:
115 QCLuceneRangeQuery(const QCLuceneTerm &lowerTerm,
116 const QCLuceneTerm &upperTerm, bool inclusive);
117 ~QCLuceneRangeQuery();
118
119 static QString getClassName();
120
121 QCLuceneTerm getLowerTerm() const;
122 QCLuceneTerm getUpperTerm() const;
123
124 bool isInclusive() const;
125 QString getField() const;
126
127private:
128 QCLuceneTerm lowerTerm;
129 QCLuceneTerm upperTerm;
130};
131
132class QHELP_EXPORT QCLuceneTermQuery : public QCLuceneQuery
133{
134public:
135 QCLuceneTermQuery(const QCLuceneTerm &term);
136 ~QCLuceneTermQuery();
137
138 static QString getClassName();
139
140 QCLuceneTerm getTerm() const;
141
142private:
143 QCLuceneTerm term;
144};
145
146class QHELP_EXPORT QCLuceneBooleanQuery : public QCLuceneQuery
147{
148public:
149 QCLuceneBooleanQuery();
150 ~QCLuceneBooleanQuery();
151
152 static QString getClassName();
153
154 quint32 getClauseCount() const;
155 quint32 getMaxClauseCount() const;
156 void setMaxClauseCount(quint32 maxClauseCount);
157
158 void add(QCLuceneQuery *query, bool required, bool prohibited);
159 void add(QCLuceneQuery *query, bool delQuery, bool required, bool prohibited);
160
161private:
162 QList<QCLuceneQuery*> queries;
163};
164
165class QHELP_EXPORT QCLucenePhraseQuery : public QCLuceneQuery
166{
167public:
168 QCLucenePhraseQuery();
169 ~QCLucenePhraseQuery();
170
171 static QString getClassName();
172
173 qint32 getSlop() const;
174 void setSlop(const qint32 slop);
175
176 void addTerm(const QCLuceneTerm &term);
177 void addTerm(const QCLuceneTerm &term, qint32 position);
178
179 QString getFieldName() const;
180 QList<QCLuceneTerm> getTerms() const;
181
182private:
183 QList<QCLuceneTerm> termList;
184};
185
186QT_END_NAMESPACE
187
188#endif // QQUERY_P_H
Note: See TracBrowser for help on using the repository browser.