• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • document
katebuffer.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
3  Copyright (C) 2002-2004 Christoph Cullmann <cullmann@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef __KATE_BUFFER_H__
21 #define __KATE_BUFFER_H__
22 
23 #include "katetextbuffer.h"
24 
25 #include "katepartprivate_export.h"
26 
27 #include <QtCore/QObject>
28 
29 class KateLineInfo;
30 class KateDocument;
31 class KateHighlighting;
32 
39 class KATEPART_TESTS_EXPORT KateBuffer : public Kate::TextBuffer
40 {
41  Q_OBJECT
42 
43  public:
48  explicit KateBuffer (KateDocument *doc);
49 
53  ~KateBuffer ();
54 
55  public:
59  void editStart ();
60 
64  void editEnd ();
65 
71  inline bool editChanged () const { return editingChangedBuffer (); }
72 
77  inline int editTagStart () const { return editingMinimalLineChanged (); }
78 
83  inline int editTagEnd () const { return editingMaximalLineChanged (); }
84 
89  inline bool editTagFrom () const { return editingChangedNumberOfLines() != 0; }
90 
91  public:
95  void clear();
96 
103  bool openFile (const QString &m_file, bool enforceTextCodec);
104 
109  bool brokenEncoding () const { return m_brokenEncoding; }
110 
115  bool tooLongLinesWrapped () const { return m_tooLongLinesWrapped; }
116 
121  bool canEncode ();
122 
128  bool saveFile (const QString &m_file);
129 
130  public:
138  inline Kate::TextLine plainLine (int lineno)
139  {
140  if (lineno < 0 || lineno >= lines())
141  return Kate::TextLine ();
142 
143  return line (lineno);
144  }
145 
153  void ensureHighlighted(int line, int lookAhead = 64);
154 
158  inline int count() const { return lines(); }
159 
166  void unwrapLines (int from, int to);
167 
172  void unwrapLine (int line);
173 
178  void wrapLine (const KTextEditor::Cursor &position);
179 
180  public:
181  inline int tabWidth () const { return m_tabWidth; }
182 
183  public:
184  void setTabWidth (int w);
185 
192  void setHighlight (int hlMode);
193 
194  KateHighlighting *highlight () { return m_highlight; }
195 
199  void invalidateHighlighting();
200 
207  KTextEditor::Range computeFoldingRangeForStartLine (int startLine);
208 
209  private:
217  void doHighlight (int from, int to, bool invalidate);
218 
219  Q_SIGNALS:
224  void tagLines(int start, int end);
225  void respellCheckBlock(int start, int end);
226 
227  private:
231  KateDocument *const m_doc;
232 
236  bool m_brokenEncoding;
237 
241  bool m_tooLongLinesWrapped;
242 
246  KateHighlighting *m_highlight;
247 
248  // for the scrapty indent sensitive langs
249  int m_tabWidth;
250 
254  int m_lineHighlighted;
255 
259  int m_maxDynamicContexts;
260 };
261 
262 #endif
263 
264 // kate: space-indent on; indent-width 2; replace-tabs on;
Kate::TextBuffer::line
TextLine line(int line) const
Retrieve a text line.
Definition: katetextbuffer.cpp:150
Kate::TextBuffer::editingChangedBuffer
bool editingChangedBuffer() const
Query information from the last editing transaction: was the content of the buffer changed...
Definition: katetextbuffer.h:250
KateBuffer::plainLine
Kate::TextLine plainLine(int lineno)
Return line lineno.
Definition: katebuffer.h:138
katetextbuffer.h
KateBuffer::editTagFrom
bool editTagFrom() const
line inserted/removed?
Definition: katebuffer.h:89
KateBuffer::editChanged
bool editChanged() const
were there changes in the current running editing session?
Definition: katebuffer.h:71
KATEPART_TESTS_EXPORT
#define KATEPART_TESTS_EXPORT
Definition: katepartprivate_export.h:36
Kate::TextBuffer::wrapLine
virtual void wrapLine(const KTextEditor::Cursor &position)
Wrap line at given cursor position.
Definition: katetextbuffer.cpp:218
KateBuffer::count
int count() const
Return the total number of lines in the buffer.
Definition: katebuffer.h:158
Kate::TextBuffer::editingMaximalLineChanged
int editingMaximalLineChanged() const
Get maximal line number changed by last editing transaction.
Definition: katetextbuffer.h:269
Kate::TextBuffer::editingChangedNumberOfLines
bool editingChangedNumberOfLines() const
Query information from the last editing transaction: was the number of lines of the buffer changed...
Definition: katetextbuffer.h:257
KateBuffer::tabWidth
int tabWidth() const
Definition: katebuffer.h:181
QSharedPointer
katepartprivate_export.h
KateBuffer::editTagStart
int editTagStart() const
dirty lines start
Definition: katebuffer.h:77
KateBuffer::brokenEncoding
bool brokenEncoding() const
Did encoding errors occur on load?
Definition: katebuffer.h:109
QString
KateBuffer::editTagEnd
int editTagEnd() const
dirty lines end
Definition: katebuffer.h:83
KateDocument
Definition: katedocument.h:74
Kate::TextBuffer::unwrapLine
virtual void unwrapLine(int line)
Unwrap given line.
Definition: katetextbuffer.cpp:257
Kate::TextBuffer::lines
int lines() const
Lines currently stored in this buffer.
Definition: katetextbuffer.h:189
KateHighlighting
Definition: katehighlight.h:119
KateBuffer::highlight
KateHighlighting * highlight()
Definition: katebuffer.h:194
Kate::TextLine
QSharedPointer< TextLineData > TextLine
The normal world only accesses the text lines with shared pointers.
Definition: katetextline.h:443
Kate::TextBuffer::editingMinimalLineChanged
int editingMinimalLineChanged() const
Get minimal line number changed by last editing transaction.
Definition: katetextbuffer.h:263
Kate::TextBuffer
Class representing a text buffer.
Definition: katetextbuffer.h:48
KateBuffer::tooLongLinesWrapped
bool tooLongLinesWrapped() const
Too long lines wrapped on load?
Definition: katebuffer.h:115
Kate::TextBuffer::clear
virtual void clear()
Clears the buffer, reverts to initial empty state.
Definition: katetextbuffer.cpp:108
KateBuffer
The KateBuffer class maintains a collections of lines.
Definition: katebuffer.h:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal