1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSG_GLSLSYMBOLS_H
5#define QSSG_GLSLSYMBOLS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DGlslParser/private/glsltype_p.h>
19#include <QtQuick3DGlslParser/private/glslsymbol_p.h>
20#include <QVector>
21#include <QString>
22#include <QHash>
23
24QT_BEGIN_NAMESPACE
25
26namespace GLSL {
27
28class Q_QUICK3DGLSLPARSER_EXPORT Argument: public Symbol
29{
30public:
31 Argument(Function *scope);
32
33 const Type *type() const override;
34 void setType(const Type *type);
35
36 Argument *asArgument() override { return this; }
37
38private:
39 const Type *_type;
40};
41
42class Q_QUICK3DGLSLPARSER_EXPORT Variable: public Symbol
43{
44public:
45 Variable(Scope *scope);
46
47 const Type *type() const override;
48 void setType(const Type *type);
49
50 int qualifiers() const { return _qualifiers; }
51 void setQualifiers(int qualifiers) { _qualifiers = qualifiers; }
52
53 Variable *asVariable() override { return this; }
54
55private:
56 const Type *_type;
57 int _qualifiers;
58};
59
60class Q_QUICK3DGLSLPARSER_EXPORT Block: public Scope
61{
62public:
63 Block(Scope *enclosingScope = nullptr);
64
65 QList<Symbol *> members() const override;
66 void add(Symbol *symbol) override;
67
68 Block *asBlock() override { return this; }
69
70 const Type *type() const override;
71 Symbol *find(const QString &name) const override;
72
73private:
74 QHash<QString, Symbol *> _members;
75};
76
77class Q_QUICK3DGLSLPARSER_EXPORT Namespace: public Scope
78{
79public:
80 Namespace();
81 ~Namespace() override;
82
83 void add(Symbol *symbol) override;
84
85 Namespace *asNamespace() override { return this; }
86
87 QList<Symbol *> members() const override;
88 const Type *type() const override;
89 Symbol *find(const QString &name) const override;
90
91private:
92 QHash<QString, Symbol *> _members;
93 QVector<OverloadSet *> _overloadSets;
94};
95
96} // namespace GLSL
97
98QT_END_NAMESPACE
99
100#endif // QSSG_GLSLSYMBOLS_H
101

source code of qtquick3d/src/glslparser/glslsymbols_p.h