| 1 | // Copyright (C) 2023 The Qt Company Ltd. | 
|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef QQMLSIGNALANDPROPERTYNAMES_P_H | 
|---|
| 5 | #define QQMLSIGNALANDPROPERTYNAMES_P_H | 
|---|
| 6 |  | 
|---|
| 7 | // | 
|---|
| 8 | //  W A R N I N G | 
|---|
| 9 | //  ------------- | 
|---|
| 10 | // | 
|---|
| 11 | // This file is not part of the Qt API.  It exists purely as an | 
|---|
| 12 | // implementation detail.  This header file may change from version to | 
|---|
| 13 | // version without notice, or even be removed. | 
|---|
| 14 | // | 
|---|
| 15 | // We mean it. | 
|---|
| 16 | // | 
|---|
| 17 |  | 
|---|
| 18 | #include <cstddef> | 
|---|
| 19 | #include <optional> | 
|---|
| 20 |  | 
|---|
| 21 | #include <QtQml/private/qtqmlglobal_p.h> | 
|---|
| 22 | #include <QtCore/qstringview.h> | 
|---|
| 23 | #include <QtCore/qstring.h> | 
|---|
| 24 | #include <type_traits> | 
|---|
| 25 |  | 
|---|
| 26 | QT_BEGIN_NAMESPACE | 
|---|
| 27 |  | 
|---|
| 28 | class Q_QML_EXPORT QQmlSignalNames | 
|---|
| 29 | { | 
|---|
| 30 | public: | 
|---|
| 31 | static QString propertyNameToChangedSignalName(QStringView property); | 
|---|
| 32 | static QByteArray propertyNameToChangedSignalName(QUtf8StringView property); | 
|---|
| 33 |  | 
|---|
| 34 | static QString propertyNameToChangedHandlerName(QStringView property); | 
|---|
| 35 |  | 
|---|
| 36 | static QString signalNameToHandlerName(QAnyStringView signal); | 
|---|
| 37 |  | 
|---|
| 38 | static std::optional<QString> changedSignalNameToPropertyName(QStringView changeSignal); | 
|---|
| 39 | static std::optional<QByteArray> changedSignalNameToPropertyName(QUtf8StringView changeSignal); | 
|---|
| 40 |  | 
|---|
| 41 | static std::optional<QString> changedHandlerNameToPropertyName(QStringView handler); | 
|---|
| 42 | static std::optional<QByteArray> changedHandlerNameToPropertyName(QUtf8StringView handler); | 
|---|
| 43 |  | 
|---|
| 44 | static std::optional<QString> handlerNameToSignalName(QStringView handler); | 
|---|
| 45 | static std::optional<QString> changedHandlerNameToSignalName(QStringView changedHandler); | 
|---|
| 46 |  | 
|---|
| 47 | static bool isChangedHandlerName(QStringView signalName); | 
|---|
| 48 | static bool isChangedSignalName(QStringView signalName); | 
|---|
| 49 | static bool isHandlerName(QStringView signalName); | 
|---|
| 50 |  | 
|---|
| 51 | static QString addPrefixToPropertyName(QStringView prefix, QStringView propertyName); | 
|---|
| 52 |  | 
|---|
| 53 | // ### Qt7: remove this | 
|---|
| 54 | static std::optional<QString> badHandlerNameToSignalName(QStringView handler); | 
|---|
| 55 | }; | 
|---|
| 56 |  | 
|---|
| 57 | QT_END_NAMESPACE | 
|---|
| 58 |  | 
|---|
| 59 | #endif // QQMLSIGNALANDPROPERTYNAMES_P_H | 
|---|
| 60 |  | 
|---|