Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
glslsymbols.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "glslsymbols_p.h"
5#include "glsltypes_p.h"
6#include <QDebug>
7
9
10using namespace GLSL;
11
13 : Symbol(scope)
14 , _type(nullptr)
15{
16}
17
18const Type *Argument::type() const
19{
20 return _type;
21}
22
24{
25 _type = type;
26}
27
28Block::Block(Scope *enclosingScope)
29 : Scope(enclosingScope)
30{
31}
32
33QList<Symbol *> Block::members() const
34{
35 return _members.values();
36}
37
38void Block::add(Symbol *symbol)
39{
40 _members.insert(symbol->name(), symbol);
41}
42
43const Type *Block::type() const
44{
45 // ### assert?
46 return nullptr;
47}
48
49Symbol *Block::find(const QString &name) const
50{
51 return _members.value(name);
52}
53
55 : Symbol(scope)
56 , _type(nullptr)
57 , _qualifiers(0)
58{
59}
60
61const Type *Variable::type() const
62{
63 return _type;
64}
65
67{
68 _type = type;
69}
70
74
76{
77 qDeleteAll(_overloadSets);
78}
79
80QList<Symbol *> Namespace::members() const
81{
82 return _members.values();
83}
84
86{
87 Symbol *&sym = _members[symbol->name()];
88 if (! sym) {
89 sym = symbol;
90 } else if (Function *fun = symbol->asFunction()) {
91 if (OverloadSet *o = sym->asOverloadSet()) {
92 o->addFunction(fun);
93 } else if (Function *firstFunction = sym->asFunction()) {
94 o = new OverloadSet(this);
95 _overloadSets.append(o);
96 o->setName(symbol->name());
97 o->addFunction(firstFunction);
98 o->addFunction(fun);
99 sym = o;
100 } else {
101 // ### warning? return false?
102 }
103 } else {
104 // ### warning? return false?
105 }
106}
107
108const Type *Namespace::type() const
109{
110 return nullptr;
111}
112
114{
115 return _members.value(name);
116}
117
void setType(const Type *type)
const Type * type() const override
const Type * type() const override
Symbol * find(const QString &name) const override
~Namespace() override
QList< Symbol * > members() const override
void add(Symbol *symbol) override
virtual OverloadSet * asOverloadSet()
virtual Function * asFunction()
QString name() const
const Type * type() const override
void setType(const Type *type)
Variable(Scope *scope)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
qDeleteAll(list.begin(), list.end())
Definition glsl_p.h:22
Combined button and popup list for selecting options.
GLenum type
GLuint name
QObject::connect nullptr
QJSValue fun
[0]
Argument()=default