summaryrefslogtreecommitdiffstats
path: root/interfaces/tdetexteditor/variableinterface.h
blob: 31310a43cb3742a30a5c40d534356d909848d10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 <[email protected]>
*/
#ifndef _KTEXTEDITOR_VARIABLE_INTERFACE_H_
#define _KTEXTEDITOR_VARIABLE_INTERFACE_H_

#include <tdelibs_export.h>

class TQString;

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 TQString variable( const TQString &name ) const = 0;

    //
    // signals!!
    //
  public:
    /**
    * Signal: emitted when a variable is set
    */
    virtual void variableChanged( const TQString &variable, const TQString &value ) = 0;

  private:
    static unsigned int globalVariableInterfaceNumber;
    unsigned int myVariableInterfaceNumber;
};


KTEXTEDITOR_EXPORT VariableInterface *variableInterface( class Document * );
} // namespace KTextEditor
#endif //_KTEXTEDITOR_VARIABLE_INTERFACE_H_