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

Konsole

  • Konsole
  • Filter
Classes | Public Member Functions | Protected Member Functions | List of all members
Konsole::Filter Class Referenceabstract

#include <Filter.h>

Inheritance diagram for Konsole::Filter:
Inheritance graph
[legend]

Classes

class  HotSpot
 

Public Member Functions

 Filter ()
 
virtual ~Filter ()
 
HotSpot * hotSpotAt (int line, int column) const
 
QList< HotSpot * > hotSpots () const
 
QList< HotSpot * > hotSpotsAtLine (int line) const
 
virtual void process ()=0
 
void reset ()
 
void setBuffer (const QString *buffer, const QList< int > *linePositions)
 

Protected Member Functions

void addHotSpot (HotSpot *)
 
const QString * buffer ()
 
void getLineColumn (int position, int &startLine, int &startColumn)
 

Detailed Description

A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list) and marks the areas which match the filter's patterns as 'hotspots'.

Each hotspot has a type identifier associated with it ( such as a link or a highlighted section ), and an action. When the user performs some activity such as a mouse-click in a hotspot area ( the exact action will depend on what is displaying the block of text which the filter is processing ), the hotspot's activate() method should be called. Depending on the type of hotspot this will trigger a suitable response.

For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. Hotspots may have more than one action, in which case the list of actions can be obtained using the actions() method.

Different subclasses of filter will return different types of hotspot. Subclasses must reimplement the process() method to examine a block of text and identify sections of interest. When processing the text they should create instances of Filter::HotSpot subclasses for sections of interest and add them to the filter's list of hotspots using addHotSpot()

Definition at line 55 of file Filter.h.

Constructor & Destructor Documentation

Filter::Filter ( )

Constructs a new filter.

Definition at line 164 of file Filter.cpp.

Filter::~Filter ( )
virtual

Definition at line 170 of file Filter.cpp.

Member Function Documentation

void Filter::addHotSpot ( HotSpot *  spot)
protected

Adds a new hotspot to the list.

Definition at line 223 of file Filter.cpp.

const QString * Filter::buffer ( )
protected

Returns the internal buffer.

Definition at line 216 of file Filter.cpp.

void Filter::getLineColumn ( int  position,
int &  startLine,
int &  startColumn 
)
protected

Converts a character position within buffer() to a line and column.

Definition at line 189 of file Filter.cpp.

Filter::HotSpot * Filter::hotSpotAt ( int  line,
int  column 
) const

Adds a new line of text to the filter and increments the line count.

Returns the hotspot which covers the given line and column, or 0 if no hotspot covers that area

Definition at line 240 of file Filter.cpp.

QList< Filter::HotSpot * > Filter::hotSpots ( ) const

Returns the list of hotspots identified by the filter.

Definition at line 231 of file Filter.cpp.

QList< Filter::HotSpot * > Filter::hotSpotsAtLine ( int  line) const

Returns the list of hotspots identified by the filter which occur on a given line.

Definition at line 235 of file Filter.cpp.

virtual void Konsole::Filter::process ( )
pure virtual

Causes the filter to process the block of text currently in its internal buffer.

Implemented in Konsole::RegExpFilter.

void Filter::reset ( )

Empties the filters internal buffer and resets the line count back to 0.

All hotspots are deleted.

Definition at line 177 of file Filter.cpp.

void Filter::setBuffer ( const QString *  buffer,
const QList< int > *  linePositions 
)

TODO: Document me.

Definition at line 183 of file Filter.cpp.


The documentation for this class was generated from the following files:
  • Filter.h
  • Filter.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Konsole

Skip menu "Konsole"
  • 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