• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katebuffer.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
00003    Copyright (C) 2002-2004 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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __KATE_BUFFER_H__
00021 #define __KATE_BUFFER_H__
00022 
00023 #include "katetextline.h"
00024 #include "katecodefolding.h"
00025 
00026 #include <QtCore/QObject>
00027 
00028 class KateLineInfo;
00029 class KateDocument;
00030 class KateHighlighting;
00031 
00032 
00039 class KateBuffer : public QObject
00040 {
00041   Q_OBJECT
00042 
00043   public:
00048     explicit KateBuffer (KateDocument *doc);
00049 
00053     ~KateBuffer ();
00054 
00055   public:
00059     void editStart ();
00060 
00064     void editEnd ();
00065 
00071     inline bool editChanged () const { return editChangesDone; }
00072 
00077     inline int editTagStart () const { return editTagLineStart; }
00078 
00083     inline int editTagEnd () const { return editTagLineEnd; }
00084 
00089     inline bool editTagFrom () const { return editTagLineFrom; }
00090 
00091   private:
00095     int editSessionNumber;
00096 
00100     bool editIsRunning;
00101 
00105     int editTagLineStart;
00106 
00110     int editTagLineEnd;
00111 
00115     bool editTagLineFrom;
00116 
00120     bool editChangesDone;
00121 
00122   public:
00126     void clear();
00127 
00133     bool openFile (const QString &m_file);
00134 
00139     bool binary () const { return m_binary; }
00140 
00146     bool brokenUTF8 () const { return m_brokenUTF8; }
00147 
00152     bool canEncode ();
00153 
00159     bool saveFile (const QString &m_file);
00160 
00161   public:
00168     KateTextLine::Ptr line(int line);
00169     
00176     inline KateTextLine::Ptr plainLine(int line)
00177     {
00178       // valid line at all?
00179       if (line < 0 || line >= m_lines.size())
00180         return KateTextLine::Ptr();
00181 
00182       // return requested line
00183       return m_lines[line];
00184     }
00185     
00189     inline int count() const { return m_lines.size(); }
00190     
00194     inline int lines() const { return m_lines.size(); }
00195 
00199     void changeLine(int i);
00200 
00204     void insertLine(int i, KateTextLine::Ptr line);
00205 
00209     void removeLine(int i);
00210   
00211   private:
00212      inline void addIndentBasedFoldingInformation(QVector<int> &foldingList,int linelength,bool addindent,int deindent);
00213      inline void updatePreviousNotEmptyLine(int current_line,bool addindent,int deindent);
00214 
00215   public:
00216     inline int countVisible () { return m_lines.size() - m_regionTree.getHiddenLinesCount(m_lines.size()); }
00217 
00218     inline int lineNumber (int visibleLine) { return m_regionTree.getRealLine (visibleLine); }
00219 
00220     inline int lineVisibleNumber (int line) { return m_regionTree.getVirtualLine (line); }
00221 
00222     inline void lineInfo (KateLineInfo *info, int line) { m_regionTree.getLineInfo(info,line); }
00223 
00224     inline int tabWidth () const { return m_tabWidth; }
00225 
00226   public:
00227     void setTabWidth (int w);
00228 
00235     void setHighlight (int hlMode);
00236 
00237     KateHighlighting *highlight () { return m_highlight; }
00238 
00242     void invalidateHighlighting();
00243 
00244     KateCodeFoldingTree *foldingTree () { return &m_regionTree; }
00245 
00246     void codeFoldingColumnUpdate(int lineNr);
00247 
00248   private:
00259     bool doHighlight (int from, int to, bool invalidate);
00260     bool isEmptyLine(KateTextLine::Ptr textline);
00261     
00262   Q_SIGNALS:
00266     void codeFoldingUpdated();
00267 
00272     void tagLines(int start, int end);
00273 
00274   private:
00278     KateDocument *m_doc;
00279 
00283     QVector<KateTextLine::Ptr> m_lines;
00284 
00288     bool m_binary;
00289 
00293     bool m_brokenUTF8;
00294 
00298   private:
00302     KateHighlighting *m_highlight;
00303 
00307     KateCodeFoldingTree m_regionTree;
00308 
00309     // for the scrapty indent sensitive langs
00310     int m_tabWidth;
00311 
00312     int m_lineHighlightedMax;
00313     int m_lineHighlighted;
00314 
00318     int m_maxDynamicContexts;
00319 };
00320 
00321 #endif
00322 
00323 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal