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

KTextEditor

  • KTextEditor
  • VariableInterface
Public Member Functions | List of all members
KTextEditor::VariableInterface Class Referenceabstract
Document Extension Interfaces

#include <variableinterface.h>

Public Member Functions

 VariableInterface ()
 
virtual ~VariableInterface ()
 
virtual QString variable (const QString &name) const =0
 
virtual void variableChanged (Document *document, const QString &variable, const QString &value)=0
 

Detailed Description

Variable/Modeline extension interface for the Document.

Introduction

The VariableInterface is designed to provide access to so called "document variables" (also called modelines), for example variables defined in files like "kate: variable value;" or the emacs style "-*- variable: value -*-".

The idea is to allow KTextEditor plugins and applications to use document variables. A document implementing this interface should return values for variables that it does not otherwise know how to use, since they could be of interest for plugins. A Document implementing this interface must emit the signal variableChanged() whenever a variable/value pair was set, changed or removed.

Note
Implementations should check the document variables whenever the document was saved or loaded.

Accessing the VariableInterface

The VariableInterface is an extension interface for a Document, i.e. the Document inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:

// doc is of type KTextEditor::Document*
KTextEditor::VariableInterface *iface =
qobject_cast<KTextEditor::VariableInterface*>( doc );
if( iface ) {
// the implementation supports the interface
// do stuff
}
See also
KTextEditor::Document, KTextEditor::Plugin
Author
Anders Lund <ander.nosp@m.s@al.nosp@m.web.d.nosp@m.k>

Definition at line 77 of file variableinterface.h.

Constructor & Destructor Documentation

VariableInterface::VariableInterface ( )

Definition at line 280 of file ktexteditor.cpp.

VariableInterface::~VariableInterface ( )
virtual

Virtual destructor.

Definition at line 284 of file ktexteditor.cpp.

Member Function Documentation

virtual QString KTextEditor::VariableInterface::variable ( const QString &  name) const
pure virtual

Get the value of the variable name.

Returns
the value or an empty string if the variable is not set or has no value.
virtual void KTextEditor::VariableInterface::variableChanged ( Document *  document,
const QString &  variable,
const QString &  value 
)
pure virtual

The document emits this signal whenever the value of the variable changed, this includes when a variable was initially set.

Parameters
documentdocument that emitted the signal
variablevariable that changed
valuenew value for variable
See also
variable()

The documentation for this class was generated from the following files:
  • variableinterface.h
  • ktexteditor.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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