1
// This file is part of the KDE libraries
2
// Copyright (C) 2008 Paul Giannaros <paul@giannaros.org>
3
// Copyright (C) 2009 Dominik Haumann <dhaumann kde org>
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Library General Public
7
// License as published by the Free Software Foundation; either
8
// version 2 of the License, or (at your option) version 3.
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Library General Public License for more details.
15
// You should have received a copy of the GNU Library General Public License
16
// along with this library; see the file COPYING.LIB. If not, write to
17
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
// Boston, MA 02110-1301, USA.
20
#ifndef KATE_INDENT_SCRIPT_H
21
#define KATE_INDENT_SCRIPT_H
23
#include "katescript.h"
26
#include <QtCore/QPair>
28
class KateScriptDocument;
30
class KateIndentScriptHeader
33
KateIndentScriptHeader() : m_priority(0)
36
inline void setName(const QString& name)
38
inline const QString& name() const
41
inline void setRequiredStyle(const QString& requiredStyle)
42
{ m_requiredStyle = requiredStyle; }
43
inline const QString& requiredStyle() const
44
{ return m_requiredStyle; }
46
inline void setIndentLanguages(const QStringList& indentLanguages)
47
{ m_indentLanguages = indentLanguages; }
48
inline const QStringList& indentLanguages() const
49
{ return m_indentLanguages; }
51
inline void setPriority(int priority)
52
{ m_priority = priority; }
53
inline int priority() const
54
{ return m_priority; }
56
inline void setBaseName(const QString& baseName)
57
{ m_baseName = baseName; }
58
inline const QString& baseName() const
59
{ return m_baseName; }
62
QString m_name; ///< indenter name, e.g. Python
65
* If this is an indenter, then this specifies the required syntax
66
* highlighting style that must be used for this indenter to work properly.
67
* If this property is empty, the indenter doesn't require a specific style.
69
QString m_requiredStyle;
71
* If this script is an indenter, then the indentLanguages member specifies
72
* which languages this is an indenter for. The values must correspond with
73
* the name of a programming language given in a highlighting file (e.g "TI Basic")
75
QStringList m_indentLanguages;
77
* If this script is an indenter, this value controls the priority it will take
78
* when an indenter for one of the supported languages is requested and multiple
91
* A specialized class for scripts that are of type
92
* KateScriptInformation::IndentationScript
94
class KateIndentScript : public KateScript
97
KateIndentScript(const QString &url, const KateIndentScriptHeader &header);
99
const QString &triggerCharacters();
101
const KateIndentScriptHeader& indentHeader() const;
104
* Returns a pair where the first value is the indent amount, and the second
105
* value is the alignment.
107
QPair<int, int> indent(KateView* view, const KTextEditor::Cursor& position,
108
QChar typedCharacter, int indentWidth);
111
QString m_triggerCharacters;
112
bool m_triggerCharactersSet;
113
KateIndentScriptHeader m_indentHeader;
119
// kate: space-indent on; indent-width 2; replace-tabs on;