#pragma once // QCodeEditor #include // Required for inheritance #include // Qt #include #include class QSyntaxStyle; /** * @brief Class, that describes C++ code * highlighter. */ class QCXXHighlighter : public QStyleSyntaxHighlighter { Q_OBJECT public: /** * @brief Constructor. * @param document Pointer to document. */ explicit QCXXHighlighter(QTextDocument* document=nullptr); protected: void highlightBlock(const QString& text) override; private: QVector m_highlightRules; QRegularExpression m_includePattern; QRegularExpression m_functionPattern; QRegularExpression m_defTypePattern; QRegularExpression m_commentStartPattern; QRegularExpression m_commentEndPattern; };