1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSG_GLSLSYMBOL_H
5#define QSSG_GLSLSYMBOL_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/glsl_p.h>
19#include <QString>
20
21QT_BEGIN_NAMESPACE
22
23namespace GLSL {
24
25class Symbol;
26class Scope;
27
28class Q_QUICK3DGLSLPARSER_EXPORT Symbol
29{
30public:
31 Symbol(Scope *scope = nullptr);
32 virtual ~Symbol();
33
34 Scope *scope() const;
35 void setScope(Scope *scope);
36
37 QString name() const;
38 void setName(const QString &name);
39
40 virtual Scope *asScope() { return nullptr; }
41 virtual Struct *asStruct() { return nullptr; }
42 virtual Function *asFunction() { return nullptr; }
43 virtual Argument *asArgument() { return nullptr; }
44 virtual Block *asBlock() { return nullptr; }
45 virtual Variable *asVariable() { return nullptr; }
46 virtual OverloadSet *asOverloadSet() { return nullptr; }
47 virtual Namespace *asNamespace() { return nullptr; }
48
49 virtual const Type *type() const = 0;
50
51private:
52 Scope *_scope;
53 QString _name;
54};
55
56class Q_QUICK3DGLSLPARSER_EXPORT Scope: public Symbol
57{
58public:
59 Scope(Scope *sscope = nullptr);
60
61 Symbol *lookup(const QString &name) const;
62
63 virtual QList<Symbol *> members() const;
64 virtual void add(Symbol *symbol) = 0;
65 virtual Symbol *find(const QString &name) const = 0;
66
67 Scope *asScope() override { return this; }
68};
69
70} // namespace GLSL
71
72QT_END_NAMESPACE
73
74#endif // QSSG_GLSLSYMBOL_H
75

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