|
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 QTOKEN_P_H |
|
19 #define QTOKEN_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 "qclucene_global_p.h" |
|
33 |
|
34 #include <QtCore/QString> |
|
35 #include <QtCore/QSharedDataPointer> |
|
36 #include <QtCore/QSharedData> |
|
37 |
|
38 CL_NS_DEF(analysis) |
|
39 class Token; |
|
40 CL_NS_END |
|
41 CL_NS_USE(analysis) |
|
42 |
|
43 QT_BEGIN_NAMESPACE |
|
44 |
|
45 class QCLuceneTokenizer; |
|
46 class QCLuceneTokenStream; |
|
47 class QCLuceneStandardTokenizer; |
|
48 |
|
49 class QHELP_EXPORT QCLuceneTokenPrivate : public QSharedData |
|
50 { |
|
51 public: |
|
52 QCLuceneTokenPrivate(); |
|
53 QCLuceneTokenPrivate(const QCLuceneTokenPrivate &other); |
|
54 |
|
55 ~QCLuceneTokenPrivate(); |
|
56 |
|
57 Token *token; |
|
58 bool deleteCLuceneToken; |
|
59 |
|
60 private: |
|
61 QCLuceneTokenPrivate &operator=(const QCLuceneTokenPrivate &other); |
|
62 }; |
|
63 |
|
64 class QHELP_EXPORT QCLuceneToken |
|
65 { |
|
66 public: |
|
67 QCLuceneToken(); |
|
68 QCLuceneToken(const QString &text, qint32 startOffset, |
|
69 qint32 endOffset, const QString &defaultTyp = QLatin1String("word")); |
|
70 |
|
71 virtual ~QCLuceneToken(); |
|
72 |
|
73 void set(const QString &text, qint32 startOffset, |
|
74 qint32 endOffset, const QString &defaultTyp = QLatin1String("word")); |
|
75 |
|
76 quint32 bufferLength() const; |
|
77 void growBuffer(quint32 size); |
|
78 |
|
79 qint32 positionIncrement() const; |
|
80 void setPositionIncrement(qint32 positionIncrement); |
|
81 |
|
82 QString termText() const; |
|
83 void setTermText(const QString &text); |
|
84 |
|
85 quint32 termTextLength() const; |
|
86 void resetTermTextLength() const; |
|
87 |
|
88 qint32 startOffset() const; |
|
89 void setStartOffset(qint32 value); |
|
90 |
|
91 qint32 endOffset() const; |
|
92 void setEndOffset(qint32 value); |
|
93 |
|
94 QString type() const; |
|
95 void setType(const QString &type); |
|
96 |
|
97 QString toString() const; |
|
98 |
|
99 protected: |
|
100 friend class QCLuceneTokenizer; |
|
101 friend class QCLuceneTokenStream; |
|
102 friend class QCLuceneStandardTokenizer; |
|
103 QSharedDataPointer<QCLuceneTokenPrivate> d; |
|
104 |
|
105 private: |
|
106 TCHAR *tokenText; |
|
107 TCHAR *tokenType; |
|
108 }; |
|
109 |
|
110 QT_END_NAMESPACE |
|
111 |
|
112 #endif // QTOKEN_P_H |