katebuffer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _KATE_BUFFER_H_
00021 #define _KATE_BUFFER_H_
00022
00023 #include "katetextline.h"
00024
00025 #include <qptrlist.h>
00026 #include <qobject.h>
00027 #include <qtimer.h>
00028
00029 class KateCodeFoldingTree;
00030 class KateLineInfo;
00031 class KateBufBlock;
00032 class KateBufFileLoader;
00033 class KateDocument;
00034 class Highlight;
00035
00036 class KVMAllocator;
00037
00038 class QTextCodec;
00039
00050 class KateBuffer : public QObject
00051 {
00052 Q_OBJECT
00053
00054 public:
00058 KateBuffer(KateDocument *doc);
00059
00063 ~KateBuffer();
00064
00065 KateDocument* document() const { return m_doc; }
00066
00067 public slots:
00071 bool openFile (const QString &m_file);
00072
00076 bool canEncode ();
00077
00081 bool saveFile (const QString &m_file);
00082
00086 inline uint count() const
00087 {
00088 return m_lines;
00089 }
00090
00091 uint countVisible ();
00092
00093 uint lineNumber (uint visibleLine);
00094
00095 uint lineVisibleNumber (uint line);
00096
00097 void lineInfo (KateLineInfo *info, unsigned int line);
00098
00099 KateCodeFoldingTree *foldingTree ();
00100
00101 inline void setHlUpdate (bool b)
00102 {
00103 m_hlUpdate = b;
00104 }
00105
00106 void dumpRegionTree ();
00107
00111 TextLine::Ptr line(uint i);
00112
00116 TextLine::Ptr plainLine(uint i);
00117
00121 QString textLine(uint i, bool withoutTrailingSpaces = false);
00122
00126 void insertLine(uint i, TextLine::Ptr line);
00127
00131 void removeLine(uint i);
00132
00136 void changeLine(uint i);
00137
00141 void clear();
00142
00149 void setHighlight (Highlight *highlight);
00150
00151 Highlight *highlight () { return m_highlight; };
00152
00162 void updateHighlighting(uint from, uint to, bool invalidate);
00163
00167 void invalidateHighlighting();
00168
00172 QString text();
00173
00177 QString text(uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise = false);
00178
00179 uint length ();
00180
00181 int lineLength ( uint line );
00182
00186 void setLineVisible (unsigned int lineNr, bool visible);
00187
00192 bool loadingBorked () const
00193 {
00194 return m_loadingBorked;
00195 }
00196
00197 void setTabWidth (uint w);
00198
00199 inline uint tabWidth () const { return m_tabWidth; }
00200
00201 signals:
00205 void linesChanged(int lines);
00206
00210 void codeFoldingUpdated();
00211
00216 void tagLines(int start, int end);
00217
00221 void loadingFinished ();
00222
00223 private:
00227 void loadBlock(KateBufBlock *buf);
00228
00232 void parseBlock(KateBufBlock *buf);
00233
00237 void dirtyBlock(KateBufBlock *buf);
00238
00242 KateBufBlock *findBlock(uint i);
00243
00244 void checkLoadedMax ();
00245 void checkCleanMax ();
00246 void checkDirtyMax ();
00247
00259 bool needHighlight(KateBufBlock *buf, uint from, uint to);
00260
00261 private:
00262 void pleaseHighlight (uint,uint);
00263
00264 private slots:
00265 void pleaseHighlight ();
00266
00267 private:
00268 bool m_hlUpdate;
00269
00270 uint m_lines;
00271 uint m_highlightedTo;
00272 uint m_highlightedRequested;
00273
00274 uint m_lastInSyncBlock;
00275
00276 Highlight *m_highlight;
00277 KateDocument *m_doc;
00278
00279
00280 KateBufFileLoader *m_loader;
00281 QTimer m_loadTimer;
00282
00283
00284 QPtrList<KateBufBlock> m_blocks;
00285
00286
00287 QPtrList<KateBufBlock> m_loadedBlocks;
00288
00289
00290 QPtrList<KateBufBlock> m_cleanBlocks;
00291
00292
00293 QPtrList<KateBufBlock> m_dirtyBlocks;
00294
00295 KVMAllocator *m_vm;
00296
00297
00298 KateCodeFoldingTree *m_regionTree;
00299
00300 QTimer m_highlightTimer;
00301
00302 uint m_highlightedTill;
00303 uint m_highlightedEnd;
00304 uint m_highlightedSteps;
00305
00306 bool m_cacheReadError;
00307 bool m_cacheWriteError;
00308 bool m_loadingBorked;
00309
00310
00311 uint m_tabWidth;
00312 };
00313
00314 #endif
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 21 18:45:17 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003