-rw-r--r-- | noncore/apps/tinykate/libkate/document/katebuffer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.h b/noncore/apps/tinykate/libkate/document/katebuffer.h index 9088498..c8b718e 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.h +++ b/noncore/apps/tinykate/libkate/document/katebuffer.h | |||
@@ -1,143 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KWrite | 2 | This file is part of KWrite |
3 | Copyright (c) 2000 Waldo Bastian <bastian@kde.org> | 3 | Copyright (c) 2000 Waldo Bastian <bastian@kde.org> |
4 | Copyright (c) 2002 Joseph Wenninger <jowenn@kde.org> | 4 | Copyright (c) 2002 Joseph Wenninger <jowenn@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _KWBUFFER_H_ | 21 | #ifndef _KWBUFFER_H_ |
22 | #define _KWBUFFER_H_ | 22 | #define _KWBUFFER_H_ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | #include <qlist.h> | 26 | #include <qlist.h> |
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | #include "katetextline.h" | 30 | #include "katetextline.h" |
31 | 31 | ||
32 | class QTextCodec; | 32 | class QTextCodec; |
33 | 33 | class KWBufBlock; | |
34 | /** | 34 | /** |
35 | * The KWBuffer class maintains a collections of lines. | 35 | * The KWBuffer class maintains a collections of lines. |
36 | * It allows to maintain state information in a lazy way. | 36 | * It allows to maintain state information in a lazy way. |
37 | * It handles swapping out of data using secondary storage. | 37 | * It handles swapping out of data using secondary storage. |
38 | * | 38 | * |
39 | * It is designed to handle large amounts of text-data efficiently | 39 | * It is designed to handle large amounts of text-data efficiently |
40 | * with respect to CPU and memory usage. | 40 | * with respect to CPU and memory usage. |
41 | * | 41 | * |
42 | * @author Waldo Bastian <bastian@kde.org> | 42 | * @author Waldo Bastian <bastian@kde.org> |
43 | */ | 43 | */ |
44 | class KWBuffer : public QObject | 44 | class KWBuffer : public QObject |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | /** | 48 | /** |
49 | * Create an empty buffer. | 49 | * Create an empty buffer. |
50 | */ | 50 | */ |
51 | KWBuffer(); | 51 | KWBuffer(); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Insert a file at line @p line in the buffer. | 54 | * Insert a file at line @p line in the buffer. |
55 | * Using @p codec to decode the file. | 55 | * Using @p codec to decode the file. |
56 | */ | 56 | */ |
57 | void insertFile(int line, const QString &file, QTextCodec *codec); | 57 | void insertFile(int line, const QString &file, QTextCodec *codec); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Insert a block of data at line @p line in the buffer. | 60 | * Insert a block of data at line @p line in the buffer. |
61 | * Using @p codec to decode the file. | 61 | * Using @p codec to decode the file. |
62 | */ | 62 | */ |
63 | void insertData(int line, const QByteArray &data, QTextCodec *codec); | 63 | void insertData(int line, const QByteArray &data, QTextCodec *codec); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Return the total number of lines in the buffer. | 66 | * Return the total number of lines in the buffer. |
67 | */ | 67 | */ |
68 | int count(); | 68 | int count(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Return line @p i | 71 | * Return line @p i |
72 | */ | 72 | */ |
73 | TextLine::Ptr line(int i); | 73 | TextLine::Ptr line(int i); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Insert @p line in front of line @p i | 76 | * Insert @p line in front of line @p i |
77 | */ | 77 | */ |
78 | void insertLine(int i, TextLine::Ptr line); | 78 | void insertLine(int i, TextLine::Ptr line); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Remove line @p i | 81 | * Remove line @p i |
82 | */ | 82 | */ |
83 | void removeLine(int i); | 83 | void removeLine(int i); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Change line @p i | 86 | * Change line @p i |
87 | */ | 87 | */ |
88 | void changeLine(int i); | 88 | void changeLine(int i); |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Clear the buffer. | 91 | * Clear the buffer. |
92 | */ | 92 | */ |
93 | void clear(); | 93 | void clear(); |
94 | 94 | ||
95 | signals: | 95 | signals: |
96 | 96 | ||
97 | void textChanged(); | 97 | void textChanged(); |
98 | /** | 98 | /** |
99 | * Emitted during loading. | 99 | * Emitted during loading. |
100 | */ | 100 | */ |
101 | void linesChanged(int lines); | 101 | void linesChanged(int lines); |
102 | void needHighlight(long,long); | 102 | void needHighlight(long,long); |
103 | 103 | ||
104 | protected: | 104 | protected: |
105 | /** | 105 | /** |
106 | * Make sure @p buf gets loaded. | 106 | * Make sure @p buf gets loaded. |
107 | */ | 107 | */ |
108 | void loadBlock(KWBufBlock *buf); | 108 | void loadBlock(KWBufBlock *buf); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Make sure @p buf gets parsed. | 111 | * Make sure @p buf gets parsed. |
112 | */ | 112 | */ |
113 | void parseBlock(KWBufBlock *buf); | 113 | void parseBlock(KWBufBlock *buf); |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Mark @p buf dirty. | 116 | * Mark @p buf dirty. |
117 | */ | 117 | */ |
118 | void dirtyBlock(KWBufBlock *buf); | 118 | void dirtyBlock(KWBufBlock *buf); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Find the block containing line @p i | 121 | * Find the block containing line @p i |
122 | */ | 122 | */ |
123 | KWBufBlock *findBlock(int i); | 123 | KWBufBlock *findBlock(int i); |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Load a part of the file that is currently loading. | 126 | * Load a part of the file that is currently loading. |
127 | */ | 127 | */ |
128 | void loadFilePart(); | 128 | void loadFilePart(); |
129 | 129 | ||
130 | protected slots: | 130 | protected slots: |
131 | void slotLoadFile(); | 131 | void slotLoadFile(); |
132 | 132 | ||
133 | protected: | 133 | protected: |
134 | TextLine::List m_stringList; | 134 | TextLine::List m_stringList; |
135 | TextLine::List::Iterator m_stringListIt; | 135 | TextLine::List::Iterator m_stringListIt; |
136 | int m_stringListCurrent; | 136 | int m_stringListCurrent; |
137 | int m_lineCount; | 137 | int m_lineCount; |
138 | void seek(int i); | 138 | void seek(int i); |
139 | 139 | ||
140 | 140 | ||
141 | }; | 141 | }; |
142 | 142 | ||
143 | #endif | 143 | #endif |