| 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 QQUERYPARSER_P_H
|
|---|
| 19 | #define QQUERYPARSER_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 "qanalyzer_p.h"
|
|---|
| 34 | #include "qclucene_global_p.h"
|
|---|
| 35 |
|
|---|
| 36 | #include <QtCore/QString>
|
|---|
| 37 | #include <QtCore/QStringList>
|
|---|
| 38 | #include <QtCore/QSharedDataPointer>
|
|---|
| 39 | #include <QtCore/QSharedData>
|
|---|
| 40 |
|
|---|
| 41 | CL_NS_DEF(queryParser)
|
|---|
| 42 | class QueryParser;
|
|---|
| 43 | CL_NS_END
|
|---|
| 44 | CL_NS_USE(queryParser)
|
|---|
| 45 |
|
|---|
| 46 | QT_BEGIN_NAMESPACE
|
|---|
| 47 |
|
|---|
| 48 | class QCLuceneQuery;
|
|---|
| 49 | class QCLuceneMultiFieldQueryParser;
|
|---|
| 50 |
|
|---|
| 51 | class QHELP_EXPORT QCLuceneQueryParserPrivate : public QSharedData
|
|---|
| 52 | {
|
|---|
| 53 | public:
|
|---|
| 54 | QCLuceneQueryParserPrivate();
|
|---|
| 55 | QCLuceneQueryParserPrivate(const QCLuceneQueryParserPrivate &other);
|
|---|
| 56 |
|
|---|
| 57 | ~QCLuceneQueryParserPrivate();
|
|---|
| 58 |
|
|---|
| 59 | QueryParser *queryParser;
|
|---|
| 60 | bool deleteCLuceneQueryParser;
|
|---|
| 61 |
|
|---|
| 62 | private:
|
|---|
| 63 | QCLuceneQueryParserPrivate &operator=(const QCLuceneQueryParserPrivate &other);
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 | class QHELP_EXPORT QCLuceneQueryParser
|
|---|
| 67 | {
|
|---|
| 68 | public:
|
|---|
| 69 | QCLuceneQueryParser(const QString &field, QCLuceneAnalyzer &analyzer);
|
|---|
| 70 | virtual ~QCLuceneQueryParser();
|
|---|
| 71 |
|
|---|
| 72 | QCLuceneQuery* parse(const QString &query);
|
|---|
| 73 | QCLuceneQuery* parse(QCLuceneReader &reader);
|
|---|
| 74 | static QCLuceneQuery* parse(const QString &query, const QString &field,
|
|---|
| 75 | QCLuceneAnalyzer &analyzer);
|
|---|
| 76 | QCLuceneAnalyzer getAnalyzer();
|
|---|
| 77 | QString getField();
|
|---|
| 78 |
|
|---|
| 79 | protected:
|
|---|
| 80 | friend class QCLuceneMultiFieldQueryParser;
|
|---|
| 81 | QSharedDataPointer<QCLuceneQueryParserPrivate> d;
|
|---|
| 82 |
|
|---|
| 83 | private:
|
|---|
| 84 | QString field;
|
|---|
| 85 | QCLuceneAnalyzer analyzer;
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | class QHELP_EXPORT QCLuceneMultiFieldQueryParser : public QCLuceneQueryParser
|
|---|
| 89 | {
|
|---|
| 90 | public:
|
|---|
| 91 | enum FieldFlags {
|
|---|
| 92 | NORMAL_FIELD = 0,
|
|---|
| 93 | REQUIRED_FIELD = 1,
|
|---|
| 94 | PROHIBITED_FIELD = 2
|
|---|
| 95 | };
|
|---|
| 96 |
|
|---|
| 97 | QCLuceneMultiFieldQueryParser(const QStringList &fieldList,
|
|---|
| 98 | QCLuceneAnalyzer &analyzer);
|
|---|
| 99 | ~QCLuceneMultiFieldQueryParser();
|
|---|
| 100 |
|
|---|
| 101 | static QCLuceneQuery *parse(const QString &query, const QStringList &fieldList,
|
|---|
| 102 | QCLuceneAnalyzer &analyzer);
|
|---|
| 103 | static QCLuceneQuery *parse(const QString &query, const QStringList &fieldList,
|
|---|
| 104 | QList<FieldFlags> flags, QCLuceneAnalyzer &analyzer);
|
|---|
| 105 | };
|
|---|
| 106 |
|
|---|
| 107 | QT_END_NAMESPACE
|
|---|
| 108 |
|
|---|
| 109 | #endif // QQUERYPARSER_P_H
|
|---|