kate Library API Documentation

katebuffer.h

00001 /* This file is part of the KDE libraries 00002 Copyright (c) 2000 Waldo Bastian <bastian@kde.org> 00003 Copyright (C) 2002, 2003 Christoph Cullmann <cullmann@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 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; // The highest line with correct highlight info 00272 uint m_highlightedRequested; // The highest line that we requested highlight for 00273 00274 uint m_lastInSyncBlock; // last block where the start/end line is in sync with real life 00275 00276 Highlight *m_highlight; 00277 KateDocument *m_doc; 00278 00279 // stuff we need to load a file 00280 KateBufFileLoader *m_loader; 00281 QTimer m_loadTimer; 00282 00283 // ALL blocks 00284 QPtrList<KateBufBlock> m_blocks; 00285 00286 // List of blocks that can be swapped out. 00287 QPtrList<KateBufBlock> m_loadedBlocks; 00288 00289 // List of blocks that can be disposed. 00290 QPtrList<KateBufBlock> m_cleanBlocks; 00291 00292 // List of blocks that are dirty. 00293 QPtrList<KateBufBlock> m_dirtyBlocks; 00294 00295 KVMAllocator *m_vm; 00296 00297 // folding tree 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 // for the scrapty indent sensitive langs 00311 uint m_tabWidth; 00312 }; 00313 00314 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:16:24 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003