mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 00:18:06 +03:00
Define code style and format all source file using clang-format-14
except those placed in 3rdparty directories.
This commit is contained in:
@@ -1,53 +1,57 @@
|
||||
#ifndef LRSCRIPTHIGHLIGHTER_H
|
||||
#define LRSCRIPTHIGHLIGHTER_H
|
||||
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QSet>
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
enum ParenthesisType {LeftParenthesis, RightParenthesis, ParenthesisTypeCount};
|
||||
|
||||
#define PARENHEIS_COUNT 3
|
||||
const QChar parenthesisCharacters[ParenthesisTypeCount][PARENHEIS_COUNT] = {
|
||||
{'(', '{', '['},
|
||||
{')', '}', ']'}
|
||||
enum ParenthesisType {
|
||||
LeftParenthesis,
|
||||
RightParenthesis,
|
||||
ParenthesisTypeCount
|
||||
};
|
||||
|
||||
struct ParenthesisInfo
|
||||
{
|
||||
#define PARENHEIS_COUNT 3
|
||||
const QChar parenthesisCharacters[ParenthesisTypeCount][PARENHEIS_COUNT]
|
||||
= { { '(', '{', '[' }, { ')', '}', ']' } };
|
||||
|
||||
struct ParenthesisInfo {
|
||||
char character;
|
||||
int position;
|
||||
};
|
||||
|
||||
class TextBlockData : public QTextBlockUserData
|
||||
{
|
||||
class TextBlockData: public QTextBlockUserData {
|
||||
public:
|
||||
TextBlockData(){}
|
||||
TextBlockData() { }
|
||||
~TextBlockData();
|
||||
QVector<ParenthesisInfo *> parentheses();
|
||||
void insert(ParenthesisInfo *info);
|
||||
QVector<ParenthesisInfo*> parentheses();
|
||||
void insert(ParenthesisInfo* info);
|
||||
|
||||
private:
|
||||
QVector<ParenthesisInfo *> m_parentheses;
|
||||
QVector<ParenthesisInfo*> m_parentheses;
|
||||
};
|
||||
|
||||
class ScriptHighlighter : QSyntaxHighlighter{
|
||||
class ScriptHighlighter: QSyntaxHighlighter {
|
||||
public:
|
||||
ScriptHighlighter(QTextDocument* parent);
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString& text);
|
||||
enum ScriptFormats {
|
||||
NumberFormat, StringFormat, KeywordFormat,
|
||||
CommentFormat, FormatsCount
|
||||
NumberFormat,
|
||||
StringFormat,
|
||||
KeywordFormat,
|
||||
CommentFormat,
|
||||
FormatsCount
|
||||
};
|
||||
QTextCharFormat m_formats[FormatsCount];
|
||||
bool isKeyWord(const QString& word);
|
||||
void createParentheisisInfo(const char& literal, TextBlockData *data, const QString& text);
|
||||
void createParentheisisInfo(const char& literal, TextBlockData* data, const QString& text);
|
||||
|
||||
private:
|
||||
QSet<QString> m_keywords;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRSCRIPTHIGHLIGHTER_H
|
||||
|
||||
Reference in New Issue
Block a user