aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/generatorcontext.cpp
blob: b50c2effb8dcf97183a58a87a9c7820ab1429ecc (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "generatorcontext.h"
#include <abstractmetalang.h>

#include <QtCore/QDebug>

using namespace Qt::StringLiterals;

QString GeneratorContext::wrapperName() const
{
    Q_ASSERT(m_type == WrappedClass);
    return m_wrappername;
}

QString GeneratorContext::effectiveClassName() const
{
    if (m_type == SmartPointer)
        return m_preciseClassType.cppSignature();
    return m_type == WrappedClass ? m_wrappername : m_metaClass->qualifiedCppName();
}

QDebug operator<<(QDebug debug, const GeneratorContext &c)
{
    QDebugStateSaver saver(debug);
    debug.noquote();
    debug.nospace();
    debug << "GeneratorContext(\"" << c.metaClass()->name() << "\" ";
    if (c.useWrapper())
        debug << "[wrapper]";
    else if (c.forSmartPointer())
        debug << "[smart pointer] \"" << c.preciseType().cppSignature() << '"';
    else
        debug << "[class]";
    debug << ')';
    return debug;
}