aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/typedatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/typedatabase.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/typedatabase.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp
index ac76aeda4..427b923d1 100644
--- a/sources/shiboken6/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp
@@ -1004,6 +1004,20 @@ PrimitiveTypeEntry *
return result;
}
+void TypeDatabase::addBuiltInCppStringPrimitiveType(const QString &name,
+ const QString &viewName,
+ const TypeSystemTypeEntry *root,
+ const QString &rootPackage,
+ CustomTypeEntry *targetLang)
+
+{
+ auto *stringType = addBuiltInPrimitiveType(name, root, rootPackage,
+ targetLang);
+ auto *viewType = addBuiltInPrimitiveType(viewName, root, rootPackage,
+ nullptr);
+ viewType->setViewOn(stringType);
+}
+
void TypeDatabase::addBuiltInPrimitiveTypes()
{
auto *root = defaultTypeSystemType();
@@ -1038,6 +1052,23 @@ void TypeDatabase::addBuiltInPrimitiveTypes()
if (!m_entries.contains(t))
addBuiltInPrimitiveType(t, root, rootPackage, pyFloatCustomEntry);
}
+
+ auto *pyUnicodeEntry = findType(u"PyUnicode"_qs);
+ Q_ASSERT(pyUnicodeEntry && pyUnicodeEntry->isCustom());
+ auto *pyUnicodeCustomEntry = static_cast<CustomTypeEntry *>(pyUnicodeEntry);
+
+ const QString stdString = u"std::string"_qs;
+ if (!m_entries.contains(stdString)) {
+ addBuiltInCppStringPrimitiveType(stdString, u"std::string_view"_qs,
+ root, rootPackage,
+ pyUnicodeCustomEntry);
+ }
+ const QString stdWString = u"std::wstring"_qs;
+ if (!m_entries.contains(stdWString)) {
+ addBuiltInCppStringPrimitiveType(stdWString, u"std::wstring_view"_qs,
+ root, rootPackage,
+ pyUnicodeCustomEntry);
+ }
}
QDebug operator<<(QDebug d, const TypeDatabase &db)