diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-23 15:25:45 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-23 16:19:40 +0000 |
commit | ad6766eee85e124bd7661f78388a8f13a5a1a0b2 (patch) | |
tree | 4d07c0b2688e3a3700ec85708101df78ce658cbe /sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | |
parent | 4917f84cfa8d526e34e3a6d2164ecf2e23eab408 (diff) |
shiboken: Refactor finding of enumerations
- Add helper AbstractMetaEnum::findEnumValue() which
finds unqualified as well as qualified enum values.
- Remove unused function bstractMetaClass::findEnumForValue(QString).
- Remove 2nd parameter from
AbstractMetaClass::findEnumValue(QString, AbstractMetaEnum *).
The comment claimed that it is excluded from the search, but the
condition was the reverse. Just removing it apparently does not do
harm.
Task-number: PYSIDE-487
Change-Id: I32b036045ea335b805fba79df327cc42d787f18c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index b0bbdcc5e..37b82e99f 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -2740,12 +2740,9 @@ int AbstractMetaBuilderPrivate::findOutValueFromString(const QString &stringValu } for (AbstractMetaEnum *metaEnum : qAsConst(m_globalEnums)) { - const AbstractMetaEnumValueList &values = metaEnum->values(); - for (const AbstractMetaEnumValue *ev : values) { - if (ev->name() == stringValue) { - ok = true; - return ev->value(); - } + if (const AbstractMetaEnumValue *ev = metaEnum->findEnumValue(stringValue)) { + ok = true; + return ev->value(); } } |