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

Kate

Signals | Public Member Functions | List of all members
KateBuffer Class Reference

#include <katebuffer.h>

Inheritance diagram for KateBuffer:
Inheritance graph
[legend]

Signals

void respellCheckBlock (int start, int end)
 
void tagLines (int start, int end)
 
- Signals inherited from Kate::TextBuffer
void cleared ()
 
void editingFinished ()
 
void editingStarted ()
 
void lineUnwrapped (int line)
 
void lineWrapped (const KTextEditor::Cursor &position)
 
void loaded (const QString &filename, bool encodingErrors)
 
void saved (const QString &filename)
 
void textInserted (const KTextEditor::Cursor &position, const QString &text)
 
void textRemoved (const KTextEditor::Range &range, const QString &text)
 

Public Member Functions

 KateBuffer (KateDocument *doc)
 
 ~KateBuffer ()
 
bool brokenEncoding () const
 
bool canEncode ()
 
void clear ()
 
KTextEditor::Range computeFoldingRangeForStartLine (int startLine)
 
int count () const
 
bool editChanged () const
 
void editEnd ()
 
void editStart ()
 
int editTagEnd () const
 
bool editTagFrom () const
 
int editTagStart () const
 
void ensureHighlighted (int line, int lookAhead=64)
 
KateHighlighting * highlight ()
 
void invalidateHighlighting ()
 
bool openFile (const QString &m_file, bool enforceTextCodec)
 
Kate::TextLine plainLine (int lineno)
 
bool saveFile (const QString &m_file)
 
void setHighlight (int hlMode)
 
void setTabWidth (int w)
 
int tabWidth () const
 
bool tooLongLinesWrapped () const
 
void unwrapLine (int line)
 
void unwrapLines (int from, int to)
 
void wrapLine (const KTextEditor::Cursor &position)
 
- Public Member Functions inherited from Kate::TextBuffer
 TextBuffer (KateDocument *parent, int blockSize=64)
 
virtual ~TextBuffer ()
 
void debugPrint (const QString &title) const
 
const QByteArray & digest () const
 
KateDocument * document () const
 
bool editingChangedBuffer () const
 
bool editingChangedNumberOfLines () const
 
int editingLastLines () const
 
qint64 editingLastRevision () const
 
int editingMaximalLineChanged () const
 
int editingMinimalLineChanged () const
 
int editingTransactions () const
 
KEncodingProber::ProberType encodingProberType () const
 
EndOfLineMode endOfLineMode () const
 
QTextCodec * fallbackTextCodec () const
 
virtual bool finishEditing ()
 
bool generateByteOrderMark () const
 
TextHistory & history ()
 
virtual void insertText (const KTextEditor::Cursor &position, const QString &text)
 
void invalidateRanges ()
 
TextLine line (int line) const
 
int lines () const
 
virtual bool load (const QString &filename, bool &encodingErrors, bool &tooLongLinesWrapped, bool enforceTextCodec)
 
bool rangePointerValid (TextRange *range) const
 
QList< TextRange * > rangesForLine (int line, KTextEditor::View *view, bool rangesWithAttributeOnly) const
 
virtual void removeText (const KTextEditor::Range &range)
 
qint64 revision () const
 
virtual bool save (const QString &filename)
 
void setDigest (const QByteArray &md5sum)
 
void setEncodingProberType (KEncodingProber::ProberType proberType)
 
void setEndOfLineMode (EndOfLineMode endOfLineMode)
 
void setFallbackTextCodec (QTextCodec *codec)
 
void setGenerateByteOrderMark (bool generateByteOrderMark)
 
void setLineLengthLimit (int lineLengthLimit)
 
void setNewLineAtEof (bool newlineAtEof)
 
void setTextCodec (QTextCodec *codec)
 
virtual bool startEditing ()
 
QString text () const
 
QTextCodec * textCodec () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Additional Inherited Members

- Public Types inherited from Kate::TextBuffer
enum  EndOfLineMode { eolUnknown = -1, eolUnix = 0, eolDos = 1, eolMac = 2 }
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The KateBuffer class maintains a collections of lines.

Author
Waldo Bastian basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g
Christoph Cullmann cullm.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg

Definition at line 39 of file katebuffer.h.

Constructor & Destructor Documentation

KateBuffer::KateBuffer ( KateDocument *  doc)
explicit

Create an empty buffer.

Parameters
docparent document

(with one block with one empty line)

Definition at line 61 of file katebuffer.cpp.

KateBuffer::~KateBuffer ( )

Goodbye buffer.

Cleanup on destruction.

Definition at line 78 of file katebuffer.cpp.

Member Function Documentation

bool KateBuffer::brokenEncoding ( ) const
inline

Did encoding errors occur on load?

Returns
encoding errors occurred on load?

Definition at line 109 of file katebuffer.h.

bool KateBuffer::canEncode ( )

Can the current codec handle all chars.

Returns
chars can be encoded

Definition at line 232 of file katebuffer.cpp.

void KateBuffer::clear ( )
virtual

Clear the buffer.

Reimplemented from Kate::TextBuffer.

Definition at line 148 of file katebuffer.cpp.

KTextEditor::Range KateBuffer::computeFoldingRangeForStartLine ( int  startLine)

For a given line, compute the folding range that starts there to be used to fold e.g.

from the icon border

Parameters
startLinestart line
Returns
folding range starting at the given line or invalid range

ensure valid input

no highlighting, no folding, ATM

first: get the wanted start line highlighted

return if no folding start!

now: decided if indentation based folding or not!

get our start indentation level

search next line with indentation level <= our one

get line

indentation higher than our start line? continue

empty line? continue

else, break

lastLine is always one too much

backtrack all empty lines, we don't want to add them to the fold!

we shall not fold one-liners

be done now

'normal' attribute based folding, aka token based like '{' BLUB '}'

first step: search the first region type, that stays open for the start line

mapping of type to "first" offset of it and current number of not matched openings

walk over all attributes of the line and compute the matchings

folding close?

search for this type, try to decrement counter, perhaps erase element!

folding open?

search for this type, either insert it, with current offset or increment counter!

compute first type with offset

no opening region found, bad, nothing to do

second step: search for matching end region marker!

ensure line is highlighted

search for matching end marker

matching folding close?

end reached? compute resulting range!

special handling of end: if end is at column 0 of a line, move it to end of previous line! fixes folding for stuff like #pragma mark END_OLD_AND_START_NEW_REGION

return computed range

matching folding open?

if we arrive here, the opened range spans to the end of the document!

Definition at line 522 of file katebuffer.cpp.

int KateBuffer::count ( ) const
inline

Return the total number of lines in the buffer.

Definition at line 158 of file katebuffer.h.

bool KateBuffer::editChanged ( ) const
inline

were there changes in the current running editing session?

Returns
changes done?

Definition at line 71 of file katebuffer.h.

void KateBuffer::editEnd ( )

finish some editing action

not finished, do nothing

nothing change, OK

if we arrive here, line changed should be OK

no highlighting, nothing to do

if we don't touch the highlighted area => fine

look one line too far, needed for linecontinue stuff

look one line before, needed nearly 100% only for indentation based folding !

really update highlighting

Definition at line 94 of file katebuffer.cpp.

void KateBuffer::editStart ( )

start some editing action

Definition at line 88 of file katebuffer.cpp.

int KateBuffer::editTagEnd ( ) const
inline

dirty lines end

Returns
end line

Definition at line 83 of file katebuffer.h.

bool KateBuffer::editTagFrom ( ) const
inline

line inserted/removed?

Returns
line inserted/removed?

Definition at line 89 of file katebuffer.h.

int KateBuffer::editTagStart ( ) const
inline

dirty lines start

Returns
start line

Definition at line 77 of file katebuffer.h.

void KateBuffer::ensureHighlighted ( int  line,
int  lookAhead = 64 
)

Update highlighting of given line line, if needed.

If line is already highlighted, this function does nothing. If line is not highlighted, all lines up to line + lookAhead are highlighted.

Parameters
lookAheadalso highlight these following lines

Definition at line 284 of file katebuffer.cpp.

KateHighlighting* KateBuffer::highlight ( )
inline

Definition at line 194 of file katebuffer.h.

void KateBuffer::invalidateHighlighting ( )

Invalidate highlighting of whole buffer.

Definition at line 389 of file katebuffer.cpp.

bool KateBuffer::openFile ( const QString &  m_file,
bool  enforceTextCodec 
)

Open a file, use the given filename.

Parameters
m_filefilename to open
enforceTextCodecenforce to use only the set text codec
Returns
success

allow non-existent files without error, if local file! will allow to do "kate newfile.txt" without error messages but still fail if e.g. you mistype a url and it can't be fetched via fish:// or other strange things in kio happen... just clear() + exit with success!

check if this is a normal file or not, avoids to open char devices or directories! else clear buffer and break out with error

try to load

Definition at line 161 of file katebuffer.cpp.

Kate::TextLine KateBuffer::plainLine ( int  lineno)
inline

Return line lineno.

Highlighting of returned line might be out-dated, which may be sufficient for pure text manipulation functions, like search/replace. If you require highlighting to be up to date, call ensureHighlighted prior to this method.

Definition at line 138 of file katebuffer.h.

void KateBuffer::respellCheckBlock ( int  start,
int  end 
)
signal
bool KateBuffer::saveFile ( const QString &  m_file)

Save the buffer to a file, use the given filename + codec + end of line chars (internal use of qtextstream)

Parameters
m_filefilename to save to
Returns
success

Definition at line 256 of file katebuffer.cpp.

void KateBuffer::setHighlight ( int  hlMode)

Use highlight for highlighting.

highlight may be 0 in which case highlighting will be disabled.

Definition at line 357 of file katebuffer.cpp.

void KateBuffer::setTabWidth ( int  w)

Definition at line 346 of file katebuffer.cpp.

int KateBuffer::tabWidth ( ) const
inline

Definition at line 181 of file katebuffer.h.

void KateBuffer::tagLines ( int  start,
int  end 
)
signal

Emitted when the highlighting of a certain range has changed.

bool KateBuffer::tooLongLinesWrapped ( ) const
inline

Too long lines wrapped on load?

Returns
too long lines wrapped on load?

Definition at line 115 of file katebuffer.h.

void KateBuffer::unwrapLine ( int  line)
virtual

Unwrap given line.

Parameters
lineline to unwrap

Reimplemented from Kate::TextBuffer.

Definition at line 337 of file katebuffer.cpp.

void KateBuffer::unwrapLines ( int  from,
int  to 
)

Unwrap given lines.

Parameters
from- first line of the block
to- last line of the block
lastLine- last line of the document

Definition at line 310 of file katebuffer.cpp.

void KateBuffer::wrapLine ( const KTextEditor::Cursor &  position)
virtual

Wrap line at given cursor position.

Parameters
positionline/column as cursor where to wrap

Reimplemented from Kate::TextBuffer.

Definition at line 301 of file katebuffer.cpp.


The documentation for this class was generated from the following files:
  • katebuffer.h
  • katebuffer.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:57:00 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