KSyntaxHighlighting

abstracthighlighter.h
1 /*
2  SPDX-FileCopyrightText: 2016 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: MIT
5 */
6 
7 #ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_H
8 #define KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_H
9 
10 #include "ksyntaxhighlighting_export.h"
11 
12 #include <QObject>
13 
14 #include <memory>
15 
16 QT_BEGIN_NAMESPACE
17 class QString;
18 QT_END_NAMESPACE
19 
21 {
22 class AbstractHighlighterPrivate;
23 class Definition;
24 class FoldingRegion;
25 class Format;
26 class State;
27 class Theme;
28 
71 class KSYNTAXHIGHLIGHTING_EXPORT AbstractHighlighter
72 {
73 public:
74  virtual ~AbstractHighlighter();
75 
81  Definition definition() const;
82 
89  virtual void setDefinition(const Definition &def);
90 
97  Theme theme() const;
98 
105  virtual void setTheme(const Theme &theme);
106 
107 protected:
109  AbstractHighlighter(AbstractHighlighterPrivate *dd);
110 
111  // TODO KF6: add an optional void* context argument that is passed through
112  // to the applyX() calls, so highlighters dealing with some form of line object
113  // (such as QSyntaxHighlighter or KTextEditor) can avoid some ugly hacks to have
114  // this context available in their applyX methods
130  State highlightLine(const QString &text, const State &state);
131 
146  virtual void applyFormat(int offset, int length, const Format &format) = 0;
147 
163  virtual void applyFolding(int offset, int length, FoldingRegion region);
164 
165 protected:
166  AbstractHighlighterPrivate *d_ptr;
167 
168 private:
169  Q_DECLARE_PRIVATE(AbstractHighlighter)
170  Q_DISABLE_COPY(AbstractHighlighter)
171 };
172 }
173 
174 QT_BEGIN_NAMESPACE
175 Q_DECLARE_INTERFACE(KSyntaxHighlighting::AbstractHighlighter, "org.kde.SyntaxHighlighting.AbstractHighlighter")
176 QT_END_NAMESPACE
177 
178 #endif // KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_H
Represents a syntax definition.
Definition: definition.h:87
Syntax highlighting engine for Kate syntax definitions.
Abstract base class for highlighters.
Color theme definition used for highlighting.
Definition: theme.h:64
Represents a begin or end of a folding region.
Definition: foldingregion.h:18
Opaque handle to the state of the highlighting engine.
Definition: state.h:25
Describes the format to be used for a specific text fragment.
Definition: format.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Oct 28 2020 23:04:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.