Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef PARSER_H
5#define PARSER_H
6
7#include <qiodevice.h>
8#include <qlist.h>
9#include <qbytearray.h>
10
11struct Function
12{
13 QString className;
14 QString functionName;
15 QString functionParameters;
16};
17
18struct Point
19{
20 QString name;
21 QString parameters;
22};
23
24struct Replace
25{
26 QString in;
27 QString out;
28};
29
36
37struct Parser
38{
39 Parser(const QString &provider)
41 {
42
43 }
44
45 void addIncludeDirs(const QStringList &list)
46 {
47 m_includeDirs.append(list);
48 }
49 QString resolveInclude(const QString &filename);
50 void addIncludesRecursive(const QString &filename, QStringList &includes);
51 QStringList findEnumValues(const QString &name, const QStringList &includes);
52
53 void parseParamReplace(const QString &data, qsizetype offset, const QString &name);
54 void parseInstrument(const QString &data, qsizetype offset);
55 void parsePoint(const QString &data, qsizetype offset);
56 void parsePrefix(const QString &data, qsizetype offset);
57 void parseMetadata(const QString &data, qsizetype offset, const QStringList &includes);
58 int lineNumber(qsizetype offset) const;
59
60 void parse(QIODevice &input, const QString &name);
61 void write(QIODevice &input) const;
62 bool isEmpty() const
63 {
64 return m_functions.isEmpty() && m_points.isEmpty();
65 }
66
67 QList<Function> m_functions;
70 QList<QString> m_prefixes;
71 QList<QString> m_metadata;
74 QString m_provider;
75};
76
77#endif // PARSER_H
QList< QString > m_metadata
Definition parser.h:71
int lineNumber(qsizetype offset) const
Definition parser.cpp:131
void addIncludesRecursive(const QString &filename, QStringList &includes)
Definition parser.cpp:491
void parseParamReplace(const QString &data, qsizetype offset, const QString &name)
Definition parser.cpp:142
void parse(QIODevice &input, const QString &name)
Definition parser.cpp:536
QList< QString > m_includeDirs
Definition parser.h:73
void parseMetadata(const QString &data, qsizetype offset, const QStringList &includes)
Definition parser.cpp:367
bool isEmpty() const
Definition parser.h:62
QList< Replace > m_replaces
Definition parser.h:69
void parsePrefix(const QString &data, qsizetype offset)
Definition parser.cpp:219
Parser(const QString &provider)
Definition parser.h:39
void write(QIODevice &input) const
Definition parser.cpp:592
QList< QString > m_prefixes
Definition parser.h:70
QString m_provider
Definition parser.h:74
QString resolveInclude(const QString &filename)
Definition parser.cpp:478
void addIncludeDirs(const QStringList &list)
Definition parser.h:45
QStringList findEnumValues(const QString &name, const QStringList &includes)
Definition parser.cpp:237
void parseInstrument(const QString &data, qsizetype offset)
Definition parser.cpp:159
QList< Point > m_points
Definition parser.h:68
void parsePoint(const QString &data, qsizetype offset)
Definition parser.cpp:192
QList< Function > m_functions
Definition parser.h:67
QList< LineNumber > m_offsets
Definition parser.h:72
Definition qlist.h:76
QT_FORWARD_DECLARE_CLASS(QTextStream)
void panic(const char *fmt,...)
Definition panic.cpp:10
QString valueStr
Definition parser.cpp:321
QString name
Definition parser.cpp:320
int line
Definition parser.h:34
qsizetype end
Definition parser.h:33
qsizetype begin
Definition parser.h:32
Definition parser.h:19
QString name
Definition parser.h:20
QString parameters
Definition parser.h:21
QString out
Definition parser.h:27
QString in
Definition parser.h:26
static void removeOffsetRange(qsizetype begin, qsizetype end, QList< LineNumber > &offsets)
Definition parser.cpp:10
static void simplifyData(QString &data, QList< LineNumber > &offsets)
Definition parser.cpp:52
static void simplifyData(QString &data)
Definition parser.cpp:81
static QList< EnumNameValue > enumsToValues(const QStringList &values)
Definition parser.cpp:325
static bool findSpaceRange(const QString &data, qsizetype &offset, qsizetype &end)
Definition parser.cpp:37
static QString preprocessMetadata(const QString &in)
Definition parser.cpp:105
#define DEBUGPRINTF2(x)
#define DEBUGPRINTF(x)
#define DEBUG_TRACEPOINTGEN