From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- interfaces/ktexteditor/variableinterface.h | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 interfaces/ktexteditor/variableinterface.h (limited to 'interfaces/ktexteditor/variableinterface.h') diff --git a/interfaces/ktexteditor/variableinterface.h b/interfaces/ktexteditor/variableinterface.h new file mode 100644 index 000000000..84ed6013e --- /dev/null +++ b/interfaces/ktexteditor/variableinterface.h @@ -0,0 +1,72 @@ +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + --- + Copyright (C) 2004, Anders Lund +*/ +#ifndef _KTEXTEDITOR_VARIABLE_INTERFACE_H_ +#define _KTEXTEDITOR_VARIABLE_INTERFACE_H_ + +#include + +class QString; + +namespace KTextEditor { + +/** + * This interface is designed to provide access to "document variables", + * for example variables defined in files like "kate: variable value;" + * or the emacs style "-*- variable: value -*-". + * + * The purpose is to allow KTE plugins to use variables. + * A document implementing this interface should return values for variable + * that it does not otherwise know how to use, since they could be of interrest + * to plugins. A document implementing this interface must emit the variableChanged() + * signal whenever a variable is set that it will return a value for. + * + * @short KTextEditor interface to Document Variables + */ +class KTEXTEDITOR_EXPORT VariableInterface +{ + public: + VariableInterface(); + virtual ~VariableInterface(); + + unsigned int variableInterfaceNumber(); + + /** + * @return the value of the variable @p name, or an empty string if the + * variable is not set or has no value. + */ + virtual QString variable( const QString &name ) const = 0; + + // + // signals!! + // + public: + /** + * Signal: emitted when a variable is set + */ + virtual void variableChanged( const QString &variable, const QString &value ) = 0; + + private: + static unsigned int globalVariableInterfaceNumber; + unsigned int myVariableInterfaceNumber; +}; + + +KTEXTEDITOR_EXPORT VariableInterface *variableInterface( class Document * ); +} // namespace KTextEditor +#endif //_KTEXTEDITOR_VARIABLE_INTERFACE_H_ -- cgit v1.2.1