diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/abstractmetaargument.cpp')
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetaargument.cpp | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp b/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp index 366fc00a1..05cebe10a 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp @@ -1,37 +1,17 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Python. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "abstractmetaargument.h" +#include "abstractmetatype.h" #include "documentation.h" +#include "qtcompat.h" + #include <QtCore/QDebug> #include <QtCore/QSharedData> +using namespace Qt::StringLiterals; + class AbstractMetaArgumentData : public QSharedData { public: @@ -39,11 +19,13 @@ public: QString m_name; AbstractMetaType m_type; + AbstractMetaType m_modifiedType; bool m_hasName = false; Documentation m_doc; QString m_expression; QString m_originalExpression; int m_argumentIndex = 0; + bool m_modifiedRemoved = false; }; AbstractMetaArgument::AbstractMetaArgument() : d(new AbstractMetaArgumentData) @@ -56,9 +38,9 @@ AbstractMetaArgument::AbstractMetaArgument(const AbstractMetaArgument &) = defau AbstractMetaArgument &AbstractMetaArgument::operator=(const AbstractMetaArgument &) = default; -AbstractMetaArgument::AbstractMetaArgument(AbstractMetaArgument &&) = default; +AbstractMetaArgument::AbstractMetaArgument(AbstractMetaArgument &&) noexcept = default; -AbstractMetaArgument &AbstractMetaArgument::operator=(AbstractMetaArgument &&) = default; +AbstractMetaArgument &AbstractMetaArgument::operator=(AbstractMetaArgument &&) noexcept = default; const AbstractMetaType &AbstractMetaArgument::type() const { @@ -68,7 +50,34 @@ const AbstractMetaType &AbstractMetaArgument::type() const void AbstractMetaArgument::setType(const AbstractMetaType &type) { if (d->m_type != type) - d->m_type = type; + d->m_type = d->m_modifiedType = type; +} + +const AbstractMetaType &AbstractMetaArgument::modifiedType() const +{ + return d->m_modifiedType; +} + +bool AbstractMetaArgument::isTypeModified() const +{ + return modifiedType() != type(); +} + +bool AbstractMetaArgument::isModifiedRemoved() const +{ + return d->m_modifiedRemoved; +} + +void AbstractMetaArgument::setModifiedRemoved(bool v) +{ + if (d->m_modifiedRemoved != v) + d->m_modifiedRemoved = v; +} + +void AbstractMetaArgument::setModifiedType(const AbstractMetaType &type) +{ + if (d->m_modifiedType != type) + d->m_modifiedType = type; } QString AbstractMetaArgument::name() const @@ -144,9 +153,9 @@ bool AbstractMetaArgument::hasModifiedDefaultValueExpression() const QString AbstractMetaArgumentData::toString() const { - QString result = m_type.name() + QLatin1Char(' ') + m_name; + QString result = m_type.name() + u' ' + m_name; if (!m_expression.isEmpty()) - result += QLatin1String(" = ") + m_expression; + result += u" = "_s + m_expression; return result; } @@ -182,7 +191,7 @@ QDebug operator<<(QDebug d, const AbstractMetaArgument *aa) d.noquote(); d.nospace(); d << "AbstractMetaArgument("; - if (aa) + if (aa != nullptr) d << aa->toString(); else d << '0'; |