diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-13 10:37:09 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-14 18:55:16 +0000 |
commit | a6dd968379935452462b5785e937c37b3561425f (patch) | |
tree | a5948a790b2a0f765a1b0e10231b0484b7502fd4 /sources/shiboken6/generator/shiboken/shibokengenerator.h | |
parent | d06005c8b0acbb52c0ee74f2ccb8bc64fd482d18 (diff) |
shiboken6: Use std::optional for returning AbstractMetaType
Remove its invalid state.
Remove a few checks that apparently originated from the old
code where AbstractMetaType * = 0 meant void.
Change-Id: Ifc938c011f07f4b5316f708f6cce1e98bcaa8125
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/shibokengenerator.h')
-rw-r--r-- | sources/shiboken6/generator/shiboken/shibokengenerator.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h index 55d8c00db..8384dbfcd 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.h +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h @@ -327,7 +327,12 @@ protected: * \return A custom check if \p type is a custom type, or an empty string if \p metaType * receives an existing type object. */ - QString guessCPythonCheckFunction(const QString &type, AbstractMetaType *metaType); + struct CPythonCheckFunctionResult + { + QString checkFunction; + std::optional<AbstractMetaType> type; + }; + CPythonCheckFunctionResult guessCPythonCheckFunction(const QString &type); QString cpythonIsConvertibleFunction(const TypeEntry *type, bool genericNumberType = false, bool checkExact = false); QString cpythonIsConvertibleFunction(AbstractMetaType metaType, bool genericNumberType = false); QString cpythonIsConvertibleFunction(const AbstractMetaArgument &metaArg, bool genericNumberType = false); @@ -408,8 +413,9 @@ protected: * \return A new AbstractMetaType object that must be deleted by the caller, * or a nullptr pointer in case of failure. */ - AbstractMetaType buildAbstractMetaTypeFromString(QString typeSignature, - QString *errorMessage = nullptr); + std::optional<AbstractMetaType> + buildAbstractMetaTypeFromString(QString typeSignature, + QString *errorMessage = nullptr); /// Creates an AbstractMetaType object from a TypeEntry. AbstractMetaType buildAbstractMetaTypeFromTypeEntry(const TypeEntry *typeEntry); |