|
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 #include "qtokenstream_p.h" |
|
19 |
|
20 #include <CLucene.h> |
|
21 #include <CLucene/analysis/AnalysisHeader.h> |
|
22 |
|
23 QT_BEGIN_NAMESPACE |
|
24 |
|
25 QCLuceneTokenStreamPrivate::QCLuceneTokenStreamPrivate() |
|
26 : QSharedData() |
|
27 { |
|
28 tokenStream = 0; |
|
29 deleteCLuceneTokenStream = true; |
|
30 } |
|
31 |
|
32 QCLuceneTokenStreamPrivate::QCLuceneTokenStreamPrivate(const QCLuceneTokenStreamPrivate &other) |
|
33 : QSharedData() |
|
34 { |
|
35 tokenStream = _CL_POINTER(other.tokenStream); |
|
36 deleteCLuceneTokenStream = other.deleteCLuceneTokenStream; |
|
37 } |
|
38 |
|
39 QCLuceneTokenStreamPrivate::~QCLuceneTokenStreamPrivate() |
|
40 { |
|
41 if (deleteCLuceneTokenStream) |
|
42 _CLDECDELETE(tokenStream); |
|
43 } |
|
44 |
|
45 |
|
46 QCLuceneTokenStream::QCLuceneTokenStream() |
|
47 : d(new QCLuceneTokenStreamPrivate()) |
|
48 { |
|
49 // nothing todo |
|
50 } |
|
51 |
|
52 QCLuceneTokenStream::~QCLuceneTokenStream() |
|
53 { |
|
54 // nothing todo |
|
55 } |
|
56 |
|
57 void QCLuceneTokenStream::close() |
|
58 { |
|
59 d->tokenStream->close(); |
|
60 } |
|
61 |
|
62 bool QCLuceneTokenStream::next(QCLuceneToken &token) |
|
63 { |
|
64 return d->tokenStream->next(token.d->token); |
|
65 } |
|
66 |
|
67 QT_END_NAMESPACE |