2022-11-17 08:26:05 +00:00
|
|
|
#ifndef WORDSHIGHTLIGHTER_H
|
|
|
|
#define WORDSHIGHTLIGHTER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSyntaxHighlighter>
|
|
|
|
#include <libParse.h>
|
|
|
|
|
2023-02-26 16:22:44 +00:00
|
|
|
namespace Core {
|
|
|
|
class AppCore;
|
|
|
|
}
|
2022-11-17 08:26:05 +00:00
|
|
|
|
|
|
|
namespace Enhancement {
|
2023-03-01 14:19:13 +00:00
|
|
|
class HighlightFeature
|
2023-02-26 16:22:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-03-01 14:19:13 +00:00
|
|
|
virtual ~HighlightFeature() = default;
|
2023-02-26 16:22:44 +00:00
|
|
|
|
2023-02-28 12:19:45 +00:00
|
|
|
virtual void contexBinding(Core::AppCore *app, Parse::Result::DocCore *core) = 0;
|
|
|
|
virtual void renderRepeat() const = 0;
|
2023-02-26 16:22:44 +00:00
|
|
|
};
|
|
|
|
|
2022-11-17 08:26:05 +00:00
|
|
|
/**
|
|
|
|
* @brief 词语语法高亮
|
|
|
|
*/
|
2023-02-28 12:19:45 +00:00
|
|
|
class KeywordsHighlighter : public QSyntaxHighlighter
|
2022-11-17 08:26:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-02-28 12:19:45 +00:00
|
|
|
KeywordsHighlighter(QObject *parent = nullptr);
|
2023-02-26 16:22:44 +00:00
|
|
|
|
2022-11-17 08:26:05 +00:00
|
|
|
void reset(Parse::Result::DocCore *base);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Parse::Result::DocCore *parse_core;
|
|
|
|
|
|
|
|
// QSyntaxHighlighter interface
|
|
|
|
protected:
|
|
|
|
virtual void highlightBlock(const QString &text) override;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WORDSHIGHTLIGHTER_H
|