diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-02 15:14:35 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-03 15:52:45 +0000 |
commit | 2f7295a288c76b40e74bf9cd1c87c74379bd285c (patch) | |
tree | 8421d80533608b256232f42a6333b13cdb96b859 /sources/shiboken6/ApiExtractor/modifications.cpp | |
parent | 288fadb796ec4e11e99e3752d531ada7edf15d75 (diff) |
shiboken6: Use a QSharedDataPointer for ArgumentModification
For reasons of consistency and header hygiene.
As a drive by, remove unused argument modification replace-value.
Change-Id: I44d0a244c89f2bf10242544111d23e072df3b480
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/modifications.cpp')
-rw-r--r-- | sources/shiboken6/ApiExtractor/modifications.cpp | 210 |
1 files changed, 192 insertions, 18 deletions
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp index e70c7f7d8..eba1437dc 100644 --- a/sources/shiboken6/ApiExtractor/modifications.cpp +++ b/sources/shiboken6/ApiExtractor/modifications.cpp @@ -454,6 +454,182 @@ QDebug operator<<(QDebug d, const CodeSnip &s) return d; } +class ArgumentModificationData : public QSharedData +{ +public: + ArgumentModificationData(int idx = -1) : index(idx), + removedDefaultExpression(false), removed(false), + noNullPointers(false), resetAfterUse(false), array(false) + {} + + QList<ReferenceCount> referenceCounts; + QString modified_type; + QString replacedDefaultExpression; + QHash<TypeSystem::Language, TypeSystem::Ownership> ownerships; + CodeSnipList conversion_rules; + ArgumentOwner owner; + QString renamed_to; + int index = -1; + uint removedDefaultExpression : 1; + uint removed : 1; + uint noNullPointers : 1; + uint resetAfterUse : 1; + uint array : 1; +}; + +ArgumentModification::ArgumentModification() : d(new ArgumentModificationData) +{ +} + +ArgumentModification::ArgumentModification(int idx) : d(new ArgumentModificationData(idx)) +{ +} + +ArgumentModification::ArgumentModification(const ArgumentModification &) = default; +ArgumentModification &ArgumentModification::operator=(const ArgumentModification &) = default; +ArgumentModification::ArgumentModification(ArgumentModification &&) = default; +ArgumentModification &ArgumentModification::operator=(ArgumentModification &&) = default; +ArgumentModification::~ArgumentModification() = default; + +QString ArgumentModification::modifiedType() const +{ + return d->modified_type; +} + +void ArgumentModification::setModifiedType(const QString &value) +{ + if (d->modified_type != value) + d->modified_type = value; +} + +QString ArgumentModification::replacedDefaultExpression() const +{ + return d->replacedDefaultExpression; +} + +void ArgumentModification::setReplacedDefaultExpression(const QString &value) +{ + if (d->replacedDefaultExpression != value) + d->replacedDefaultExpression = value; +} + +const QHash<TypeSystem::Language, TypeSystem::Ownership> &ArgumentModification::ownerships() const +{ + return d->ownerships; +} + +void ArgumentModification::insertOwnership(TypeSystem::Language l, TypeSystem::Ownership o) +{ + d->ownerships.insert(l, o); +} + +const CodeSnipList &ArgumentModification::conversionRules() const +{ + return d->conversion_rules; +} + +CodeSnipList &ArgumentModification::conversionRules() +{ + return d->conversion_rules; +} + +ArgumentOwner ArgumentModification::owner() const +{ + return d->owner; +} + +void ArgumentModification::setOwner(const ArgumentOwner &value) +{ + d->owner = value; +} + +QString ArgumentModification::renamedToName() const +{ + return d->renamed_to; +} + +void ArgumentModification::setRenamedToName(const QString &value) +{ + if (d->renamed_to != value) + d->renamed_to = value; +} + +int ArgumentModification::index() const +{ + return d->index; +} + +void ArgumentModification::setIndex(int value) +{ + if (d->index != value) + d->index = value; +} + +bool ArgumentModification::removedDefaultExpression() const +{ + return d->removedDefaultExpression; +} + +void ArgumentModification::setRemovedDefaultExpression(const uint &value) +{ + if (d->removedDefaultExpression != value) + d->removedDefaultExpression = value; +} + +bool ArgumentModification::isRemoved() const +{ + return d->removed; +} + +void ArgumentModification::setRemoved(bool value) +{ + if (d->removed != value) + d->removed = value; +} + +bool ArgumentModification::noNullPointers() const +{ + return d->noNullPointers; +} + +void ArgumentModification::setNoNullPointers(bool value) +{ + if (d->noNullPointers != value) + d->noNullPointers = value; +} + +bool ArgumentModification::resetAfterUse() const +{ + return d->resetAfterUse; +} + +void ArgumentModification::setResetAfterUse(bool value) +{ + if (d->resetAfterUse != value) + d->resetAfterUse = value; +} + +bool ArgumentModification::isArray() const +{ + return d->array; +} + +void ArgumentModification::setArray(bool value) +{ + if (d->array != value) + d->array = value; +} + +const QList<ReferenceCount> &ArgumentModification::referenceCounts() const +{ + return d->referenceCounts; +} + +void ArgumentModification::addReferenceCount(const ReferenceCount &value) +{ + d->referenceCounts.append(value); +} + class ModificationData : public QSharedData { public: @@ -705,28 +881,26 @@ QDebug operator<<(QDebug d, const ArgumentModification &a) QDebugStateSaver saver(d); d.noquote(); d.nospace(); - d << "ArgumentModification(index=" << a.index; - if (a.removedDefaultExpression) + d << "ArgumentModification(index=" << a.index(); + if (a.removedDefaultExpression()) d << ", removedDefaultExpression"; - if (a.removed) + if (a.isRemoved()) d << ", removed"; - if (a.noNullPointers) + if (a.noNullPointers()) d << ", noNullPointers"; - if (a.array) + if (a.isArray()) d << ", array"; - if (!a.referenceCounts.isEmpty()) - d << ", referenceCounts=" << a.referenceCounts; - if (!a.modified_type.isEmpty()) - d << ", modified_type=\"" << a.modified_type << '"'; - if (!a.replace_value.isEmpty()) - d << ", replace_value=\"" << a.replace_value << '"'; - if (!a.replacedDefaultExpression.isEmpty()) - d << ", replacedDefaultExpression=\"" << a.replacedDefaultExpression << '"'; - if (!a.ownerships.isEmpty()) - d << ", ownerships=" << a.ownerships; - if (!a.renamed_to.isEmpty()) - d << ", renamed_to=\"" << a.renamed_to << '"'; - d << ", owner=" << a.owner << ')'; + if (!a.referenceCounts().isEmpty()) + d << ", referenceCounts=" << a.referenceCounts(); + if (!a.modifiedType().isEmpty()) + d << ", modified_type=\"" << a.modifiedType() << '"'; + if (!a.replacedDefaultExpression().isEmpty()) + d << ", replacedDefaultExpression=\"" << a.replacedDefaultExpression() << '"'; + if (!a.ownerships().isEmpty()) + d << ", ownerships=" << a.ownerships(); + if (!a.renamedToName().isEmpty()) + d << ", renamed_to=\"" << a.renamedToName() << '"'; + d << ", owner=" << a.owner() << ')'; return d; } |