kate Library API Documentation

KateNormalIndent Class Reference

Provides Auto-Indent functionality for katepart. More...

#include <kateautoindent.h>

Inheritance diagram for KateNormalIndent:

Inheritance graph
[legend]
Collaboration diagram for KateNormalIndent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KateNormalIndent (KateDocument *doc)
virtual ~KateNormalIndent ()
virtual void updateConfig ()
virtual bool canProcessNewLine () const
virtual void processNewline (KateDocCursor &cur, bool needContinue)
virtual void processChar (QChar)
virtual void processLine (KateDocCursor &)
virtual void processSection (KateDocCursor &, KateDocCursor &)
virtual bool canProcessLine () const
virtual uint modeNumber () const

Protected Member Functions

bool isBalanced (KateDocCursor &begin, const KateDocCursor &end, QChar open, QChar close, uint &pos) const
bool skipBlanks (KateDocCursor &cur, KateDocCursor &max, bool newline) const
uint measureIndent (KateDocCursor &cur) const
QString tabString (uint length) const

Protected Attributes

uint tabWidth
uint indentWidth
uchar commentAttrib
uchar doxyCommentAttrib
uchar regionAttrib
uchar symbolAttrib
uchar alertAttrib
uchar tagAttrib
uchar wordAttrib
uchar keywordAttrib
uchar normalAttrib
uchar extensionAttrib
bool useSpaces
bool mixedIndent
bool keepProfile

Detailed Description

Provides Auto-Indent functionality for katepart.

Definition at line 161 of file kateautoindent.h.


Constructor & Destructor Documentation

KateNormalIndent::KateNormalIndent KateDocument doc  ) 
 

Constructor.

Parameters:
doc parent document

Definition at line 156 of file kateautoindent.cpp.

KateNormalIndent::~KateNormalIndent  )  [virtual]
 

Virtual Destructor for the baseclass.

Definition at line 160 of file kateautoindent.cpp.


Member Function Documentation

void KateNormalIndent::updateConfig  )  [virtual]
 

Update indenter's configuration (indention width, attributes etc.

)

Reimplemented from KateAutoIndent.

Definition at line 164 of file kateautoindent.cpp.

References alertAttrib, QPtrList::at(), commentAttrib, KateDocument::config(), KateDocumentConfig::configFlags(), QPtrList::count(), KateAutoIndent::doc, doxyCommentAttrib, extensionAttrib, QString::find(), KateHighlighting::getKateHlItemDataListCopy(), KateDocument::highlight(), KateDocumentConfig::indentationWidth(), indentWidth, keepProfile, keywordAttrib, mixedIndent, normalAttrib, regionAttrib, symbolAttrib, KateDocumentConfig::tabWidth(), tabWidth, tagAttrib, useSpaces, and wordAttrib.

Referenced by KateVarIndent::processLine().

virtual bool KateNormalIndent::canProcessNewLine  )  const [inline, virtual]
 

does this indenter support processNewLine

Returns:
can you do it?

Reimplemented from KateAutoIndent.

Definition at line 184 of file kateautoindent.h.

void KateNormalIndent::processNewline KateDocCursor cur,
bool  needContinue
[virtual]
 

Called every time a newline character is inserted in the document.

Parameters:
cur The position to start processing. Contains the new cursor position after the indention.
needContinue Used to determine whether to calculate a continue indent or not.

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KatePythonIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 344 of file kateautoindent.cpp.

References KateTextCursor::col(), KateAutoIndent::doc, KateDocument::insertText(), QString::length(), KateTextCursor::line(), KateDocument::plainKateTextLine(), KateTextCursor::setCol(), and KateDocument::text().

Referenced by KateCSmartIndent::processLine(), and KateCSmartIndent::processNewline().

virtual void KateNormalIndent::processChar QChar   )  [inline, virtual]
 

Called every time a character is inserted into the document.

Parameters:
c character inserted

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 198 of file kateautoindent.h.

virtual void KateNormalIndent::processLine KateDocCursor  )  [inline, virtual]
 

Aligns/indents the given line to the proper indent position.

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 203 of file kateautoindent.h.

virtual void KateNormalIndent::processSection KateDocCursor ,
KateDocCursor
[inline, virtual]
 

Processes a section of text, indenting each line in between.

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 208 of file kateautoindent.h.

virtual bool KateNormalIndent::canProcessLine  )  const [inline, virtual]
 

Set to true if an actual implementation of 'processLine' is present.

This is used to prevent a needless Undo action from being created.

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 214 of file kateautoindent.h.

virtual uint KateNormalIndent::modeNumber  )  const [inline, virtual]
 

Mode index of this mode.

Returns:
modeNumber

Reimplemented from KateAutoIndent.

Reimplemented in KateCSmartIndent, KatePythonIndent, KateXmlIndent, KateCSAndSIndent, and KateVarIndent.

Definition at line 220 of file kateautoindent.h.

bool KateNormalIndent::isBalanced KateDocCursor begin,
const KateDocCursor end,
QChar  open,
QChar  close,
uint &  pos
const [protected]
 

Determines if the characters open and close are balanced between begin and end Fills in pos with the column position of first opened character if found.

Parameters:
begin Beginning cursor position.
end Ending cursor position where the processing will stop.
open The open character.
close The closing character which should be matched against open.
pos Contains the position of the first open character in the line.
Returns:
True if open and close have an equal number of occurances between begin and end. False otherwise.

Definition at line 234 of file kateautoindent.cpp.

References KateDocCursor::currentAttrib(), KateDocCursor::currentChar(), KateAutoIndent::doc, QChar::isSpace(), KateTextCursor::line(), measureIndent(), KateDocCursor::moveForward(), KateDocument::plainKateTextLine(), and symbolAttrib.

bool KateNormalIndent::skipBlanks KateDocCursor cur,
KateDocCursor max,
bool  newline
const [protected]
 

Skip all whitespace starting at cur and ending at max.

Spans lines if newline is set. cur is set to the current position afterwards.

Parameters:
cur The current cursor position to start from.
max The furthest cursor position that will be used for processing
newline Whether we are allowed to span multiple lines when skipping blanks
Returns:
True if cur < max after processing. False otherwise.

Definition at line 279 of file kateautoindent.cpp.

References alertAttrib, commentAttrib, KateDocCursor::currentAttrib(), KateDocCursor::currentChar(), doxyCommentAttrib, QChar::isNull(), QChar::isSpace(), KateTextCursor::line(), KateDocCursor::moveForward(), regionAttrib, KateTextCursor::setCol(), tagAttrib, and wordAttrib.

uint KateNormalIndent::measureIndent KateDocCursor cur  )  const [protected]
 

Measures the indention of the current textline marked by cur.

Parameters:
cur The cursor position to measure the indent to.
Returns:
The length of the indention in characters.

Definition at line 315 of file kateautoindent.cpp.

References KateTextCursor::col(), KateAutoIndent::doc, KateTextCursor::line(), mixedIndent, KateDocument::plainKateTextLine(), tabWidth, and useSpaces.

Referenced by isBalanced(), and KateCSmartIndent::processLine().

QString KateNormalIndent::tabString uint  length  )  const [protected]
 

Produces a string with the proper indentation characters for its length.

Parameters:
length The length of the indention in characters.
Returns:
A QString representing length characters (factoring in tabs and spaces)

Definition at line 323 of file kateautoindent.cpp.

References mixedIndent, tabWidth, and useSpaces.

Referenced by KateVarIndent::processLine(), KateCSmartIndent::processLine(), KatePythonIndent::processNewline(), and KateCSmartIndent::processNewline().


Member Data Documentation

uint KateNormalIndent::tabWidth [protected]
 

The number of characters simulated for a tab.

Definition at line 263 of file kateautoindent.h.

Referenced by measureIndent(), KateVarIndent::processLine(), KatePythonIndent::processNewline(), tabString(), and updateConfig().

uint KateNormalIndent::indentWidth [protected]
 

The number of characters used when tabs are replaced by spaces.

Definition at line 264 of file kateautoindent.h.

Referenced by KateCSmartIndent::processLine(), KatePythonIndent::processNewline(), and updateConfig().

bool KateNormalIndent::useSpaces [protected]
 

Should we use spaces or tabs to indent.

Definition at line 278 of file kateautoindent.h.

Referenced by measureIndent(), tabString(), and updateConfig().

bool KateNormalIndent::mixedIndent [protected]
 

Optimize indent by mixing spaces and tabs, ala emacs.

Definition at line 279 of file kateautoindent.h.

Referenced by measureIndent(), tabString(), and updateConfig().

bool KateNormalIndent::keepProfile [protected]
 

Always try to honor the leading whitespace of lines already in the file.

Definition at line 280 of file kateautoindent.h.

Referenced by updateConfig().


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.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Jul 20 14:17:31 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003