KTextEditor

kateindentscript.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2008 Paul Giannaros <[email protected]>
4  Copyright (C) 2009-2018 Dominik Haumann <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KATE_INDENT_SCRIPT_H
23 #define KATE_INDENT_SCRIPT_H
24 
25 #include "katescript.h"
26 #include "kateview.h"
27 
28 class KateIndentScriptHeader
29 {
30 public:
31  KateIndentScriptHeader() = default;
32 
33  inline void setName(const QString &name)
34  {
35  m_name = name;
36  }
37  inline const QString &name() const
38  {
39  return m_name;
40  }
41 
42  inline void setRequiredStyle(const QString &requiredStyle)
43  {
44  m_requiredStyle = requiredStyle;
45  }
46  inline const QString &requiredStyle() const
47  {
48  return m_requiredStyle;
49  }
50 
51  inline void setIndentLanguages(const QStringList &indentLanguages)
52  {
53  m_indentLanguages = indentLanguages;
54  }
55  inline const QStringList &indentLanguages() const
56  {
57  return m_indentLanguages;
58  }
59 
60  inline void setPriority(int priority)
61  {
62  m_priority = priority;
63  }
64  inline int priority() const
65  {
66  return m_priority;
67  }
68 
69  inline void setBaseName(const QString &baseName)
70  {
71  m_baseName = baseName;
72  }
73  inline const QString &baseName() const
74  {
75  return m_baseName;
76  }
77 
78 private:
79  QString m_name;
80 
86  QString m_requiredStyle;
92  QStringList m_indentLanguages;
98  int m_priority = 0;
99 
103  QString m_baseName;
104 };
105 
110 {
111 public:
112  explicit KateIndentScript(const QString &url, const KateIndentScriptHeader &header);
113 
114  const QString &triggerCharacters();
115 
116  const KateIndentScriptHeader &indentHeader() const;
117 
122  QPair<int, int> indent(KTextEditor::ViewPrivate *view, const KTextEditor::Cursor &position, QChar typedCharacter, int indentWidth);
123 
124 private:
125  QString m_triggerCharacters;
126  bool m_triggerCharactersSet = false;
127  KateIndentScriptHeader m_indentHeader;
128 };
129 
130 #endif
KateScript objects represent a script that can be executed and inspected.
Definition: katescript.h:120
The Cursor represents a position in a Document.
Definition: cursor.h:83
QString name(StandardShortcut id)
A specialized class for scripts that are of type ScriptType::Indentation.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 23:10:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.