6 #ifndef QT4SYNTAXHIGHLIGHTER_H_
7 #define QT4SYNTAXHIGHLIGHTER_H_
9 #include <QSyntaxHighlighter>
10 #include <QTextDocument>
11 #include <QTextCharFormat>
14 #include "GNUSyntaxHighlighter.h"
15 #include "Qt4TextFormatter.h"
20 typedef QMap<QString, Qt4TextFormatter *> Qt4TextFormatterMap;
23 typedef QMapIterator<QString, Qt4TextFormatter *> Qt4TextFormatterMapIterator;
69 void init(
const QString &
langFile,
const QString &styleFile =
96 void formatString(
int start,
int count,
const QTextCharFormat & format) {
97 setFormat(start, count, format);
void setFormattingStyle(const QString &styleFile)
Sets the styleFile for highlighting.
Definition: Qt4SyntaxHighlighter.cpp:82
Definition: ColorDialog.cpp:12
QString currentStyleFile
the current style file for highlighting
Definition: Qt4SyntaxHighlighter.h:42
srchilite::FormatterManager * formatterManager
This will be used by subclasses to generate the right table of formatters.
Definition: GNUSyntaxHighlighter.h:55
void highlightBlock(const QString &text)
The implementation of the virtual pure method of QSyntaxHighlighter.
Definition: Qt4SyntaxHighlighter.cpp:172
void init(const QString &langFile, const QString &styleFile="default.style")
Initializes this highlighter with the specified language definition file.
Definition: Qt4SyntaxHighlighter.cpp:63
Qt4TextFormatterMap getQt4TextFormatterMap()
Returns the formatter map of this highlighter.
Definition: Qt4SyntaxHighlighter.cpp:126
QString langFile
the lang file used by this highlighter
Definition: GNUSyntaxHighlighter.h:28
const srchilite::FormatterMap & getFormatterMap() const
Returns the formatter map, i.e., for each language element we have a formatter.
Definition: Qt4SyntaxHighlighter.h:133
void setFormatters(const TextFormatterMap &formatterMap)
Creates formatters (and use them to initialize the formatter manager), by using the passed TextFormat...
Definition: Qt4SyntaxHighlighter.cpp:103
const QString getFormattingStyle() const
Definition: Qt4SyntaxHighlighter.h:112
An implementation of QSyntaxHighlighter using GNU Source-highlight library (by relying on GNUSyntaxHi...
Definition: Qt4SyntaxHighlighter.h:38
An abstract class using GNU Source-highlight library to perform syntax highlighting.
Definition: GNUSyntaxHighlighter.h:26
void formatString(int start, int count, const QTextCharFormat &format)
This function is applied to the syntax highlighter's current text block (i.e.
Definition: Qt4SyntaxHighlighter.h:96
bool initFromFileName(const QString &fileName)
Initializes this highlighter by using the file name for detecting the syntax of the file (e...
Definition: Qt4SyntaxHighlighter.cpp:164