summaryrefslogtreecommitdiff
path: root/library/qdawg.h
Unidiff
Diffstat (limited to 'library/qdawg.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qdawg.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qdawg.h b/library/qdawg.h
index ea182f3..e3b1628 100644
--- a/library/qdawg.h
+++ b/library/qdawg.h
@@ -1,70 +1,70 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef QDAWG_H 20#ifndef QDAWG_H
21#define QDAWG_H 21#define QDAWG_H
22 22
23#include <qstringlist.h> 23#include <qstringlist.h>
24 24
25class QIODevice; 25class QIODevice;
26class QDawgPrivate; 26class QDawgPrivate;
27 27
28class QDawg { 28class QDawg {
29public: 29public:
30 QDawg(); 30 QDawg();
31 ~QDawg(); 31 ~QDawg();
32 32
33 bool readFile(const QString&); // may mmap 33 bool readFile(const QString&); // may mmap
34 bool read(QIODevice* dev); 34 bool read(QIODevice* dev);
35 bool write(QIODevice* dev) const; 35 bool write(QIODevice* dev) const;
36 bool createFromWords(QIODevice* dev); 36 bool createFromWords(QIODevice* dev);
37 void createFromWords(const QStringList&); 37 void createFromWords(const QStringList&);
38 QStringList allWords() const; 38 QStringList allWords() const;
39 39
40 bool contains(const QString&) const; 40 bool contains(const QString&) const;
41 int countWords() const; 41 int countWords() const;
42 42
43 // Unicode 0..3FFF; an offset can be used for other ranges 43 // Unicode 0..3FFF; an offset can be used for other ranges
44 static const int nodebits=18; 44 static const int nodebits=18;
45 45
46 class Node { 46 class Node {
47 friend class QDawgPrivate; 47 friend class QDawgPrivate;
48 uint let:(30-nodebits); 48 uint let:(30-nodebits);
49 uint isword:1; 49 uint isword:1;
50 uint islast:1; 50 uint islast:1;
51 int offset:nodebits; 51 int offset:nodebits;
52 Node() { } 52 Node() { }
53 public: 53 public:
54 QChar letter() const { return QChar((ushort)let); } 54 QChar letter() const { return QChar((ushort)let); }
55 bool isWord() const { return isword; } 55 bool isWord() const { return isword; }
56 bool isLast() const { return islast; } 56 bool isLast() const { return islast; }
57 const Node* next() const { return islast ? 0 : this+1; } 57 const Node* next() const { return islast ? 0 : this+1; }
58 const Node* jump() const { return offset ? this+offset : 0; } 58 const Node* jump() const { return offset ? this+offset : 0; }
59 }; 59 };
60 60
61 const Node* root() const; 61 const Node* root() const;
62 62
63 void dump() const; // debug 63 void dump() const; // debug
64 64
65private: 65private:
66 friend class QDawgPrivate; 66 friend class QDawgPrivate;
67 QDawgPrivate* d; 67 QDawgPrivate* d;
68}; 68};
69 69
70#endif 70#endif