Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsignalnames_p.h
Go to the documentation of this file.
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// Qt-Security score:significant
4
5#ifndef QQMLSIGNALANDPROPERTYNAMES_P_H
6#define QQMLSIGNALANDPROPERTYNAMES_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <cstddef>
20#include <optional>
21
22#include <QtQml/private/qtqmlglobal_p.h>
23#include <QtCore/qstringview.h>
24#include <QtCore/qstring.h>
25#include <type_traits>
26
28
30{
31public:
32 static QString propertyNameToChangedSignalName(QStringView property);
33 static QByteArray propertyNameToChangedSignalName(QUtf8StringView property);
34
35 static QString propertyNameToChangedHandlerName(QStringView property);
36
37 static QString signalNameToHandlerName(QAnyStringView signal);
38
39 static std::optional<QString> changedSignalNameToPropertyName(QStringView changeSignal);
40 static std::optional<QByteArray> changedSignalNameToPropertyName(QUtf8StringView changeSignal);
41
42 static std::optional<QString> changedHandlerNameToPropertyName(QStringView handler);
43 static std::optional<QByteArray> changedHandlerNameToPropertyName(QUtf8StringView handler);
44
45 static std::optional<QString> handlerNameToSignalName(QStringView handler);
46 static std::optional<QString> changedHandlerNameToSignalName(QStringView changedHandler);
47
48 static bool isChangedHandlerName(QStringView signalName);
49 static bool isChangedSignalName(QStringView signalName);
50 static bool isHandlerName(QStringView signalName);
51
52 static QString addPrefixToPropertyName(QStringView prefix, QStringView propertyName);
53
54 // ### Qt7: remove this
55 static std::optional<QString> badHandlerNameToSignalName(QStringView handler);
56};
57
58QT_END_NAMESPACE
59
60#endif // QQMLSIGNALANDPROPERTYNAMES_P_H
static QByteArray toUtf8Data(QUtf8StringView view)
static constexpr const QLatin1String Changed("Changed")
static constexpr const QLatin1String On("on")
static std::optional< QChar > firstLetter(QStringView name, qsizetype removePrefix=0, qsizetype removeSuffix=0)
static void changeCaseOfFirstLetter(QString &name, ChangeCase option, qsizetype removePrefix=0, qsizetype removeSuffix=0)
static std::optional< QString > toQStringData(std::optional< QStringView > view)
@ ToLower
@ ToUpper
static std::optional< qsizetype > firstLetterIdx(QStringView name, qsizetype removePrefix=0, qsizetype removeSuffix=0)
static constexpr const qsizetype StrlenOn
static std::optional< QString > handlerNameToSignalNameHelper(QStringView handler)
@ Handler
@ ChangedHandler
static constexpr const qsizetype StrlenChanged
std::optional< View > changedSignalNameToPropertyNameTemplate(View changeSignal)