aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-13 10:43:54 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-17 13:48:47 +0200
commite6082b18b904569fc946b9f36fc995684463267f (patch)
tree7b2daf30bd228501a8617fd69851cf31367258ca /sources
parentae31d1dc8776a0bd35e80494ca30e9c7d1c644f8 (diff)
shiboken6: Extract class CodeSnip into separate files
Change-Id: Iff46540cdb764d4caa2efad26cc5e28347cef54f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken6/ApiExtractor/CMakeLists.txt1
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/apiextractor.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/codesnip.cpp105
-rw-r--r--sources/shiboken6/ApiExtractor/codesnip.h131
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp67
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.h105
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/typesystem.cpp1
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser_p.h2
-rw-r--r--sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp1
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp1
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.h3
-rw-r--r--sources/shiboken6/generator/shiboken/headergenerator.cpp1
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp1
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.h9
20 files changed, 264 insertions, 172 deletions
diff --git a/sources/shiboken6/ApiExtractor/CMakeLists.txt b/sources/shiboken6/ApiExtractor/CMakeLists.txt
index db3916982..6202087ab 100644
--- a/sources/shiboken6/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken6/ApiExtractor/CMakeLists.txt
@@ -17,6 +17,7 @@ abstractmetafunction.cpp
abstractmetatype.cpp
abstractmetalang.cpp
classdocumentation.cpp
+codesnip.cpp
codesniphelpers.cpp
conditionalstreamreader.cpp
documentation.cpp
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
index df78eb7f8..8e969934c 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
@@ -35,6 +35,7 @@
#include "documentation.h"
#include "exception.h"
#include "messages.h"
+#include "codesnip.h"
#include "modifications.h"
#include "propertyspec.h"
#include "reporthandler.h"
diff --git a/sources/shiboken6/ApiExtractor/apiextractor.cpp b/sources/shiboken6/ApiExtractor/apiextractor.cpp
index 4315b9de8..e31439dfd 100644
--- a/sources/shiboken6/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken6/ApiExtractor/apiextractor.cpp
@@ -35,6 +35,7 @@
#include "abstractmetafield.h"
#include "abstractmetafunction.h"
#include "abstractmetalang.h"
+#include "codesnip.h"
#include "exception.h"
#include "fileout.h"
#include "modifications.h"
diff --git a/sources/shiboken6/ApiExtractor/codesnip.cpp b/sources/shiboken6/ApiExtractor/codesnip.cpp
new file mode 100644
index 000000000..3867fc5bf
--- /dev/null
+++ b/sources/shiboken6/ApiExtractor/codesnip.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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$
+**
+****************************************************************************/
+
+#include "codesnip.h"
+
+#include "qtcompat.h"
+#include "exception.h"
+#include "typedatabase.h"
+
+#include <QtCore/QDebug>
+
+using namespace Qt::StringLiterals;
+
+static inline QString callOperator() { return QStringLiteral("operator()"); }
+
+QString TemplateInstance::expandCode() const
+{
+ TemplateEntry *templateEntry = TypeDatabase::instance()->findTemplate(m_name);
+ if (!templateEntry) {
+ const QString m = u"<insert-template> referring to non-existing template '"_s
+ + m_name + u"'."_s;
+ throw Exception(m);
+ }
+
+ QString code = templateEntry->code();
+ for (auto it = replaceRules.cbegin(), end = replaceRules.cend(); it != end; ++it)
+ code.replace(it.key(), it.value());
+ while (!code.isEmpty() && code.at(code.size() - 1).isSpace())
+ code.chop(1);
+ QString result = u"// TEMPLATE - "_s + m_name + u" - START"_s;
+ if (!code.startsWith(u'\n'))
+ result += u'\n';
+ result += code;
+ result += u"\n// TEMPLATE - "_s + m_name + u" - END\n"_s;
+ return result;
+}
+
+// ---------------------- CodeSnipFragment
+QString CodeSnipFragment::code() const
+{
+ return m_instance ? m_instance->expandCode() : m_code;
+}
+
+// ---------------------- CodeSnipAbstract
+QString CodeSnipAbstract::code() const
+{
+ QString res;
+ for (const CodeSnipFragment &codeFrag : codeList)
+ res.append(codeFrag.code());
+
+ return res;
+}
+
+void CodeSnipAbstract::addCode(const QString &code)
+{
+ codeList.append(CodeSnipFragment(fixSpaces(code)));
+}
+
+void CodeSnipAbstract::purgeEmptyFragments()
+{
+ auto end = std::remove_if(codeList.begin(), codeList.end(),
+ [](const CodeSnipFragment &f) { return f.isEmpty(); });
+ codeList.erase(end, codeList.end());
+}
+
+QRegularExpression CodeSnipAbstract::placeHolderRegex(int index)
+{
+ return QRegularExpression(u'%' + QString::number(index) + QStringLiteral("\\b"));
+}
+
+void purgeEmptyCodeSnips(QList<CodeSnip> *list)
+{
+ for (auto it = list->begin(); it != list->end(); ) {
+ it->purgeEmptyFragments();
+ if (it->isEmpty())
+ it = list->erase(it);
+ else
+ ++it;
+ }
+}
diff --git a/sources/shiboken6/ApiExtractor/codesnip.h b/sources/shiboken6/ApiExtractor/codesnip.h
new file mode 100644
index 000000000..b008d5ba8
--- /dev/null
+++ b/sources/shiboken6/ApiExtractor/codesnip.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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$
+**
+****************************************************************************/
+
+#ifndef CODESNIP_H
+#define CODESNIP_H
+
+#include "codesniphelpers.h"
+#include "typesystem_enums.h"
+
+#include <QtCore/QList>
+#include <QtCore/QHash>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QString>
+
+class TemplateInstance
+{
+public:
+ explicit TemplateInstance(const QString &name) : m_name(name) {}
+
+ void addReplaceRule(const QString &name, const QString &value)
+ {
+ replaceRules[name] = value;
+ }
+
+ QString expandCode() const;
+
+ QString name() const
+ {
+ return m_name;
+ }
+
+private:
+ const QString m_name;
+ QHash<QString, QString> replaceRules;
+};
+
+using TemplateInstancePtr = QSharedPointer<TemplateInstance>;
+
+class CodeSnipFragment
+{
+public:
+ CodeSnipFragment() = default;
+ explicit CodeSnipFragment(const QString &code) : m_code(code) {}
+ explicit CodeSnipFragment(const TemplateInstancePtr &instance) : m_instance(instance) {}
+
+ bool isEmpty() const { return m_code.isEmpty() && m_instance.isNull(); }
+
+ QString code() const;
+
+ TemplateInstancePtr instance() const { return m_instance; }
+
+private:
+ QString m_code;
+ QSharedPointer<TemplateInstance> m_instance;
+};
+
+class CodeSnipAbstract : public CodeSnipHelpers
+{
+public:
+ QString code() const;
+
+ void addCode(const QString &code);
+ void addCode(QStringView code) { addCode(code.toString()); }
+
+ void addTemplateInstance(const TemplateInstancePtr &ti)
+ {
+ codeList.append(CodeSnipFragment(ti));
+ }
+
+ bool isEmpty() const { return codeList.isEmpty(); }
+ void purgeEmptyFragments();
+
+ QList<CodeSnipFragment> codeList;
+
+ static QRegularExpression placeHolderRegex(int index);
+};
+
+class TemplateEntry : public CodeSnipAbstract
+{
+public:
+ explicit TemplateEntry(const QString &name) : m_name(name) {}
+
+ QString name() const
+ {
+ return m_name;
+ }
+
+private:
+ QString m_name;
+};
+
+class CodeSnip : public CodeSnipAbstract
+{
+public:
+ CodeSnip() = default;
+ explicit CodeSnip(TypeSystem::Language lang) : language(lang) {}
+
+ TypeSystem::Language language = TypeSystem::TargetLangCode;
+ TypeSystem::CodeSnipPosition position = TypeSystem::CodeSnipPositionAny;
+};
+
+/// Purge empty fragments and snippets caused by new line characters in
+/// conjunction with <insert-template>.
+void purgeEmptyCodeSnips(QList<CodeSnip> *list);
+
+#endif // CODESNIP_H
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index 61498fb6c..5e5503170 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -28,6 +28,7 @@
#include "modifications.h"
#include "modifications_p.h"
+#include "codesnip.h"
#include "exception.h"
#include "typedatabase.h"
#include "typeparser.h"
@@ -44,72 +45,6 @@ using namespace Qt::StringLiterals;
static inline QString callOperator() { return QStringLiteral("operator()"); }
-QString TemplateInstance::expandCode() const
-{
- TemplateEntry *templateEntry = TypeDatabase::instance()->findTemplate(m_name);
- if (!templateEntry) {
- const QString m = u"<insert-template> referring to non-existing template '"_s
- + m_name + u"'."_s;
- throw Exception(m);
- }
-
- QString code = templateEntry->code();
- for (auto it = replaceRules.cbegin(), end = replaceRules.cend(); it != end; ++it)
- code.replace(it.key(), it.value());
- while (!code.isEmpty() && code.at(code.size() - 1).isSpace())
- code.chop(1);
- QString result = u"// TEMPLATE - "_s + m_name + u" - START"_s;
- if (!code.startsWith(u'\n'))
- result += u'\n';
- result += code;
- result += u"\n// TEMPLATE - "_s + m_name + u" - END\n"_s;
- return result;
-}
-
-// ---------------------- CodeSnipFragment
-QString CodeSnipFragment::code() const
-{
- return m_instance ? m_instance->expandCode() : m_code;
-}
-
-// ---------------------- CodeSnipAbstract
-QString CodeSnipAbstract::code() const
-{
- QString res;
- for (const CodeSnipFragment &codeFrag : codeList)
- res.append(codeFrag.code());
-
- return res;
-}
-
-void CodeSnipAbstract::addCode(const QString &code)
-{
- codeList.append(CodeSnipFragment(fixSpaces(code)));
-}
-
-void CodeSnipAbstract::purgeEmptyFragments()
-{
- auto end = std::remove_if(codeList.begin(), codeList.end(),
- [](const CodeSnipFragment &f) { return f.isEmpty(); });
- codeList.erase(end, codeList.end());
-}
-
-QRegularExpression CodeSnipAbstract::placeHolderRegex(int index)
-{
- return QRegularExpression(u'%' + QString::number(index) + QStringLiteral("\\b"));
-}
-
-void purgeEmptyCodeSnips(QList<CodeSnip> *list)
-{
- for (auto it = list->begin(); it != list->end(); ) {
- it->purgeEmptyFragments();
- if (it->isEmpty())
- it = list->erase(it);
- else
- ++it;
- }
-}
-
// ---------------------- Modification
QString FunctionModification::accessModifierString() const
{
diff --git a/sources/shiboken6/ApiExtractor/modifications.h b/sources/shiboken6/ApiExtractor/modifications.h
index c7e79441b..07101eb6a 100644
--- a/sources/shiboken6/ApiExtractor/modifications.h
+++ b/sources/shiboken6/ApiExtractor/modifications.h
@@ -31,16 +31,14 @@
#include "typesystem_enums.h"
#include "typesystem_typedefs.h"
-#include "codesniphelpers.h"
#include "parser/typeinfo.h"
#include <QtCore/QList>
-#include <QtCore/QRegularExpression>
#include <QtCore/QSharedDataPointer>
-#include <QtCore/QSharedPointer>
#include <QtCore/QString>
class ArgumentModificationData;
+class CodeSnip;
class FunctionModificationData;
class ModificationData;
class FieldModificationData;
@@ -49,28 +47,6 @@ QT_BEGIN_NAMESPACE
class QDebug;
QT_END_NAMESPACE
-class TemplateInstance
-{
-public:
- explicit TemplateInstance(const QString &name) : m_name(name) {}
-
- void addReplaceRule(const QString &name, const QString &value)
- {
- replaceRules[name] = value;
- }
-
- QString expandCode() const;
-
- QString name() const
- {
- return m_name;
- }
-
-private:
- const QString m_name;
- QHash<QString, QString> replaceRules;
-};
-
struct ReferenceCount
{
enum Action { // 0x01 - 0xff
@@ -107,75 +83,6 @@ struct ArgumentOwner
int index = InvalidIndex;
};
-using TemplateInstancePtr = QSharedPointer<TemplateInstance>;
-
-class CodeSnipFragment
-{
-public:
- CodeSnipFragment() = default;
- explicit CodeSnipFragment(const QString &code) : m_code(code) {}
- explicit CodeSnipFragment(const TemplateInstancePtr &instance) : m_instance(instance) {}
-
- bool isEmpty() const { return m_code.isEmpty() && m_instance.isNull(); }
-
- QString code() const;
-
- TemplateInstancePtr instance() const { return m_instance; }
-
-private:
- QString m_code;
- QSharedPointer<TemplateInstance> m_instance;
-};
-
-class CodeSnipAbstract : public CodeSnipHelpers
-{
-public:
- QString code() const;
-
- void addCode(const QString &code);
- void addCode(QStringView code) { addCode(code.toString()); }
-
- void addTemplateInstance(const TemplateInstancePtr &ti)
- {
- codeList.append(CodeSnipFragment(ti));
- }
-
- bool isEmpty() const { return codeList.isEmpty(); }
- void purgeEmptyFragments();
-
- QList<CodeSnipFragment> codeList;
-
- static QRegularExpression placeHolderRegex(int index);
-};
-
-class TemplateEntry : public CodeSnipAbstract
-{
-public:
- explicit TemplateEntry(const QString &name) : m_name(name) {}
-
- QString name() const
- {
- return m_name;
- }
-
-private:
- QString m_name;
-};
-
-class CodeSnip : public CodeSnipAbstract
-{
-public:
- CodeSnip() = default;
- explicit CodeSnip(TypeSystem::Language lang) : language(lang) {}
-
- TypeSystem::Language language = TypeSystem::TargetLangCode;
- TypeSystem::CodeSnipPosition position = TypeSystem::CodeSnipPositionAny;
-};
-
-/// Purge empty fragments and snippets caused by new line characters in
-/// conjunction with <insert-template>.
-void purgeEmptyCodeSnips(QList<CodeSnip> *list);
-
class ArgumentModification
{
public:
@@ -211,8 +118,8 @@ public:
void setNativeOwnership(TypeSystem::Ownership o);
// Different conversion rules
- const CodeSnipList &conversionRules() const;
- CodeSnipList &conversionRules();
+ const QList<CodeSnip> &conversionRules() const;
+ QList<CodeSnip> &conversionRules();
// QObject parent(owner) of this argument
ArgumentOwner owner() const;
@@ -361,10 +268,10 @@ public:
int overloadNumber() const;
void setOverloadNumber(int overloadNumber);
- const CodeSnipList &snips() const;
- CodeSnipList &snips();
+ const QList<CodeSnip> &snips() const;
+ QList<CodeSnip> &snips();
void appendSnip(const CodeSnip &snip);
- void setSnips(const CodeSnipList &snips);
+ void setSnips(const QList<CodeSnip> &snips);
const QList<ArgumentModification> &argument_mods() const;
QList<ArgumentModification> &argument_mods();
diff --git a/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp b/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
index f84f8cf96..bddd3535a 100644
--- a/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
@@ -30,6 +30,7 @@
#include "testutil.h"
#include <abstractmetafunction.h>
#include <abstractmetalang.h>
+#include <codesnip.h>
#include <modifications.h>
#include <modifications_p.h>
#include <complextypeentry.h>
diff --git a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
index e6dbe156d..d003de5e6 100644
--- a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
@@ -29,6 +29,7 @@
#include "testcodeinjection.h"
#include "testutil.h"
#include <abstractmetalang.h>
+#include <codesnip.h>
#include <modifications.h>
#include <textstream.h>
#include <complextypeentry.h>
diff --git a/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp b/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
index 26e06070a..713907649 100644
--- a/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
@@ -30,6 +30,7 @@
#include <QtTest/QTest>
#include "testutil.h"
#include <abstractmetalang.h>
+#include <codesnip.h>
#include <modifications.h>
#include <complextypeentry.h>
#include <typesystemtypeentry.h>
diff --git a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
index e5f6b547d..48e4c60e3 100644
--- a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
@@ -30,6 +30,7 @@
#include "testutil.h"
#include <abstractmetafunction.h>
#include <abstractmetalang.h>
+#include <codesnip.h>
#include <modifications.h>
#include <complextypeentry.h>
#include <primitivetypeentry.h>
diff --git a/sources/shiboken6/ApiExtractor/typesystem.cpp b/sources/shiboken6/ApiExtractor/typesystem.cpp
index 7f11e0f64..a9913e5f0 100644
--- a/sources/shiboken6/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystem.cpp
@@ -28,6 +28,7 @@
#include "typesystem.h"
#include "arraytypeentry.h"
+#include "codesnip.h"
#include "complextypeentry.h"
#include "constantvaluetypeentry.h"
#include "containertypeentry.h"
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index ec59b5e86..a1f6cae9a 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "typesystemparser_p.h"
+#include "codesnip.h"
#include "enumtypeentry.h"
#include "enumvaluetypeentry.h"
#include "arraytypeentry.h"
@@ -45,6 +46,7 @@
#include "typedefentry.h"
#include "typesystemtypeentry.h"
#include "valuetypeentry.h"
+#include "modifications.h"
#include "typedatabase.h"
#include "messages.h"
#include "reporthandler.h"
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser_p.h b/sources/shiboken6/ApiExtractor/typesystemparser_p.h
index 99dcac5cb..95ae88231 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser_p.h
+++ b/sources/shiboken6/ApiExtractor/typesystemparser_p.h
@@ -31,7 +31,7 @@
#include "typesystem.h"
#include "typedatabase.h"
#include "typedatabase_p.h"
-#include "modifications.h"
+#include "codesnip.h"
#include <QtCore/QStack>
#include <QtCore/QHash>
diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
index ed1c0ee12..b467a402a 100644
--- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "qtdocgenerator.h"
+#include "codesnip.h"
#include "exception.h"
#include "apiextractorresult.h"
#include "qtxmltosphinx.h"
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 6a313349e..0773f45ee 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "cppgenerator.h"
+#include "codesnip.h"
#include "headergenerator.h"
#include "apiextractor.h"
#include "apiextractorresult.h"
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.h b/sources/shiboken6/generator/shiboken/cppgenerator.h
index d245d9a17..117df9936 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.h
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.h
@@ -32,6 +32,7 @@
#include "shibokengenerator.h"
#include "abstractmetalang_enums.h"
#include "include.h"
+#include "modifications.h"
#include <QtCore/QFlags>
#include <QtCore/QSharedPointer>
@@ -95,7 +96,7 @@ private:
void writeVirtualMethodNative(TextStream &s, const AbstractMetaFunctionCPtr &func,
int cacheIndex) const;
void writeVirtualMethodCppCall(TextStream &s, const AbstractMetaFunctionCPtr &func,
- const QString &funcName, const CodeSnipList &snips,
+ const QString &funcName, const QList<CodeSnip> &snips,
const AbstractMetaArgument *lastArg, const TypeEntry *retType,
const QString &returnStatement) const;
static QString virtualMethodReturn(TextStream &s, const ApiExtractorResult &api,
diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp
index 063388f4f..c9ad2b28d 100644
--- a/sources/shiboken6/generator/shiboken/headergenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp
@@ -33,6 +33,7 @@
#include <abstractmetafunction.h>
#include <abstractmetalang.h>
#include <abstractmetalang_helpers.h>
+#include <codesnip.h>
#include <modifications.h>
#include <typedatabase.h>
#include <reporthandler.h>
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 948b73f92..73677c669 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -28,6 +28,7 @@
#include "shibokengenerator.h"
#include "apiextractorresult.h"
+#include "codesnip.h"
#include "ctypenames.h"
#include <abstractmetabuilder.h>
#include <abstractmetaenum.h>
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h
index e0add1be9..f95b3aaf4 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.h
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h
@@ -32,7 +32,6 @@
#include <generator.h>
#include "customconversion.h"
-#include "modifications.h"
#include <QtCore/QRegularExpression>
@@ -125,17 +124,17 @@ protected:
/// Write user's custom code snippets at class or module level.
void writeClassCodeSnips(TextStream &s,
- const CodeSnipList &codeSnips,
+ const QList<CodeSnip> &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
const GeneratorContext &context) const;
void writeCodeSnips(TextStream &s,
- const CodeSnipList &codeSnips,
+ const QList<CodeSnip> &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language) const;
/// Write user's custom code snippets at function level.
void writeCodeSnips(TextStream &s,
- const CodeSnipList &codeSnips,
+ const QList<CodeSnip> &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
const AbstractMetaFunctionCPtr &func,
@@ -396,7 +395,7 @@ private:
const AbstractMetaArgument *lastArg);
/// Returns a string with the user's custom code snippets that comply with \p position and \p language.
- static QString getCodeSnippets(const CodeSnipList &codeSnips,
+ static QString getCodeSnippets(const QList<CodeSnip> &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language);