00001 /* 00002 This file is part of KWrite 00003 Copyright (c) 2000 Waldo Bastian <bastian@kde.org> 00004 Copyright (c) 2002 Joseph Wenninger <jowenn@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef _KWBUFFER_H_ 00022 #define _KWBUFFER_H_ 00023 00024 #include <qstring.h> 00025 #include <qstringlist.h> 00026 #include <qlist.h> 00027 #include <qobject.h> 00028 #include <qtimer.h> 00029 00030 #include "katetextline.h" 00031 00032 class QTextCodec; 00033 class KWBufBlock; 00044 class KWBuffer : public QObject 00045 { 00046 Q_OBJECT 00047 public: 00051 KWBuffer(); 00052 00057 void insertFile(int line, const QString &file, QTextCodec *codec); 00058 00063 void insertData(int line, const QByteArray &data, QTextCodec *codec); 00064 00068 int count(); 00069 00073 TextLine::Ptr line(int i); 00074 00078 void insertLine(int i, TextLine::Ptr line); 00079 00083 void removeLine(int i); 00084 00088 void changeLine(int i); 00089 00093 void clear(); 00094 00095 signals: 00096 00097 void textChanged(); 00101 void linesChanged(int lines); 00102 void needHighlight(long,long); 00103 00104 protected: 00108 void loadBlock(KWBufBlock *buf); 00109 00113 void parseBlock(KWBufBlock *buf); 00114 00118 void dirtyBlock(KWBufBlock *buf); 00119 00123 KWBufBlock *findBlock(int i); 00124 00128 void loadFilePart(); 00129 00130 protected slots: 00131 void slotLoadFile(); 00132 00133 protected: 00134 TextLine::List m_stringList; 00135 TextLine::List::Iterator m_stringListIt; 00136 int m_stringListCurrent; 00137 int m_lineCount; 00138 void seek(int i); 00139 00140 00141 }; 00142 00143 #endif
1.4.2