blob: 389734983d3c1d8397b73ee1ca07dba131781a1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PARSER_H
#define PARSER_H
#include <qiodevice.h>
#include <qlist.h>
#include <qbytearray.h>
struct Function
{
QString className;
QString functionName;
QString functionParameters;
};
struct Point
{
QString name;
QString parameters;
};
struct Replace
{
QString in;
QString out;
};
struct LineNumber
{
qsizetype begin;
qsizetype end;
int line;
};
struct Parser
{
Parser(const QString &provider)
: m_provider(provider)
{
}
void addIncludeDirs(const QStringList &list)
{
m_includeDirs.append(list);
}
QString resolveInclude(const QString &filename);
void addIncludesRecursive(const QString &filename, QStringList &includes);
QStringList findEnumValues(const QString &name, const QStringList &includes);
void parseParamReplace(const QString &data, qsizetype offset, const QString &name);
void parseInstrument(const QString &data, qsizetype offset);
void parsePoint(const QString &data, qsizetype offset);
void parsePrefix(const QString &data, qsizetype offset);
void parseMetadata(const QString &data, qsizetype offset, const QStringList &includes);
int lineNumber(qsizetype offset) const;
void parse(QIODevice &input, const QString &name);
void write(QIODevice &input) const;
bool isEmpty() const
{
return m_functions.isEmpty() && m_points.isEmpty();
}
QList<Function> m_functions;
QList<Point> m_points;
QList<Replace> m_replaces;
QList<QString> m_prefixes;
QList<QString> m_metadata;
QList<LineNumber> m_offsets;
QList<QString> m_includeDirs;
QString m_provider;
};
#endif // PARSER_H
|