kate Library API Documentation

KateBuffer Class Reference

The KateBuffer class maintains a collections of lines. More...

#include <katebuffer.h>

Inheritance diagram for KateBuffer:

Inheritance graph
[legend]
Collaboration diagram for KateBuffer:

Collaboration graph
[legend]
List of all members.

Public Slots

bool openFile (const QString &m_file)
bool canEncode ()
bool saveFile (const QString &m_file)
uint count () const
uint countVisible ()
uint lineNumber (uint visibleLine)
uint lineVisibleNumber (uint line)
void lineInfo (KateLineInfo *info, unsigned int line)
KateCodeFoldingTree * foldingTree ()
void setHlUpdate (bool b)
void dumpRegionTree ()
TextLine::Ptr line (uint i)
TextLine::Ptr plainLine (uint i)
QString textLine (uint i, bool withoutTrailingSpaces=false)
void insertLine (uint i, TextLine::Ptr line)
void removeLine (uint i)
void changeLine (uint i)
void clear ()
void setHighlight (Highlight *highlight)
Highlight * highlight ()
void updateHighlighting (uint from, uint to, bool invalidate)
void invalidateHighlighting ()
QString text ()
QString text (uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise=false)
uint length ()
int lineLength (uint line)
void setLineVisible (unsigned int lineNr, bool visible)
bool loadingBorked () const
void setTabWidth (uint w)
uint tabWidth () const

Signals

void linesChanged (int lines)
void codeFoldingUpdated ()
void tagLines (int start, int end)
void loadingFinished ()

Public Member Functions

 KateBuffer (KateDocument *doc)
 ~KateBuffer ()
KateDocument * document () const

Detailed Description

The KateBuffer class maintains a collections of lines.

It allows to maintain state information in a lazy way. It handles swapping out of data using secondary storage.

It is designed to handle large amounts of text-data efficiently with respect to CPU and memory usage.

Author:
Waldo Bastian <bastian@kde.org>

Definition at line 50 of file katebuffer.h.


Constructor & Destructor Documentation

KateBuffer::KateBuffer KateDocument *  doc  ) 
 

Create an empty buffer.

(with one block with one empty line)

Definition at line 215 of file katebuffer.cpp.

References clear(), QObject::connect(), and QPtrList< KateBufBlock >::setAutoDelete().

KateBuffer::~KateBuffer  ) 
 

Goodbye buffer.

Definition at line 245 of file katebuffer.cpp.

References QPtrList< KateBufBlock >::clear().


Member Function Documentation

bool KateBuffer::openFile const QString m_file  )  [slot]
 

Open a file, use the given filename + codec (internal use of qtextstream).

Definition at line 505 of file katebuffer.cpp.

References QPtrList< KateBufBlock >::append(), QPtrList< KateBufBlock >::clear(), clear(), count(), QFile::encodeName(), QPtrList< KateBufBlock >::isEmpty(), kdDebug(), linesChanged(), loadingFinished(), and KIO::stat().

bool KateBuffer::canEncode  )  [slot]
 

Can the current codec handle all chars.

Definition at line 638 of file katebuffer.cpp.

References QTextCodec::canEncode(), endl(), kdDebug(), QTextCodec::name(), and plainLine().

bool KateBuffer::saveFile const QString m_file  )  [slot]
 

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

Definition at line 662 of file katebuffer.cpp.

References QFile::close(), QString::fill(), QFile::open(), plainLine(), QTextStream::setCodec(), QTextStream::setEncoding(), and textLine().

uint KateBuffer::count  )  const [inline, slot]
 

Return the total number of lines in the buffer.

Definition at line 86 of file katebuffer.h.

Referenced by openFile(), and text().

TextLine::Ptr KateBuffer::line uint  i  )  [slot]
 

Return line i.

Definition at line 750 of file katebuffer.cpp.

TextLine::Ptr KateBuffer::plainLine uint  i  )  [slot]
 

Return line i without triggering highlighting.

Definition at line 1168 of file katebuffer.cpp.

Referenced by canEncode(), saveFile(), setLineVisible(), and text().

QString KateBuffer::textLine uint  i,
bool  withoutTrailingSpaces = false
[slot]
 

Return text from line i without triggering highlighting.

Definition at line 1185 of file katebuffer.cpp.

Referenced by saveFile(), and text().

void KateBuffer::insertLine uint  i,
TextLine::Ptr  line
[slot]
 

Insert line in front of line i.

Definition at line 1202 of file katebuffer.cpp.

References QPtrList< KateBufBlock >::findRef().

void KateBuffer::removeLine uint  i  )  [slot]
 

Remove line i.

Definition at line 1235 of file katebuffer.cpp.

References QPtrList< KateBufBlock >::findRef(), and QPtrList< KateBufBlock >::removeRef().

void KateBuffer::changeLine uint  i  )  [slot]
 

Change line i.

Definition at line 1275 of file katebuffer.cpp.

Referenced by setLineVisible().

void KateBuffer::clear  )  [slot]
 

Clear the buffer.

Definition at line 452 of file katebuffer.cpp.

References QPtrList< KateBufBlock >::append(), QPtrList< KateBufBlock >::clear(), QObject::connect(), linesChanged(), and setLineVisible().

Referenced by KateBuffer(), and openFile().

void KateBuffer::setHighlight Highlight *  highlight  )  [slot]
 

Use highlight for highlighting.

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

Definition at line 496 of file katebuffer.cpp.

References invalidateHighlighting().

void KateBuffer::updateHighlighting uint  from,
uint  to,
bool  invalidate
[slot]
 

Update the highlighting.

PRE-condition: All lines prior to from have been highlighted already.

POST-condition: All lines till at least to haven been highlighted.

Definition at line 1023 of file katebuffer.cpp.

void KateBuffer::invalidateHighlighting  )  [slot]
 

Invalidate highlighting of whole buffer.

Definition at line 1094 of file katebuffer.cpp.

Referenced by setHighlight().

QString KateBuffer::text  )  [slot]
 

Get the whole text in the buffer as a string.

Definition at line 1321 of file katebuffer.cpp.

References QString::append(), count(), and textLine().

QString KateBuffer::text uint  startLine,
uint  startCol,
uint  endLine,
uint  endCol,
bool  blockwise = false
[slot]
 

Get the text between the two given positions.

Definition at line 1335 of file katebuffer.cpp.

References QString::append(), count(), plainLine(), and textLine().

void KateBuffer::setLineVisible unsigned int  lineNr,
bool  visible
[slot]
 

change the visibility of a given line

Definition at line 1288 of file katebuffer.cpp.

References changeLine(), endl(), kdDebug(), and plainLine().

Referenced by clear().

bool KateBuffer::loadingBorked  )  const [inline, slot]
 

was the last loading broken because of not enough tmp disk space ? (will be reseted on successful save of the file, user gets warning if he really wants to do it)

Definition at line 192 of file katebuffer.h.

void KateBuffer::linesChanged int  lines  )  [signal]
 

Emitted during loading when the line count changes.

Referenced by clear(), and openFile().

void KateBuffer::codeFoldingUpdated  )  [signal]
 

Emittend if codefolding returned with a changed list.

void KateBuffer::tagLines int  start,
int  end
[signal]
 

Emitted when the highlighting of a certain range has changed.

void KateBuffer::loadingFinished  )  [signal]
 

Loading of the file finished.

Referenced by openFile().


The documentation for this class was generated from the following files:
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 Wed Aug 4 05:29:51 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003