Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmljsannotation.cpp
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
// Qt-Security score:significant
4
5
#
include
"qqmljsannotation_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
using
namespace
Qt::StringLiterals;
10
11
bool
QQmlJSAnnotation::isDeprecation()
const
{
return
name == QStringLiteral(
"Deprecated"
); }
12
13
QQQmlJSDeprecation QQmlJSAnnotation::deprecation()
const
{
14
Q_ASSERT(isDeprecation());
15
QQQmlJSDeprecation deprecation;
16
if
(
const
auto
it = bindings.find(u"reason"_s); it != bindings.end()) {
17
if
(
auto
v = get_if<QString>(&it.value()))
18
deprecation.reason = *v;
19
}
20
21
return
deprecation;
22
}
23
24
// hidden friend
25
bool
operator
==(
const
QQmlJSAnnotation &a,
const
QQmlJSAnnotation &b)
noexcept
26
{
27
return
a.name == b.name &&
28
a.bindings == b.bindings;
29
}
30
31
// hidden friend
32
size_t
qHash
(
const
QQmlJSAnnotation &annotation, size_t seed)
noexcept
33
{
34
QtPrivate::QHashCombine combine(seed);
35
seed = combine(seed, annotation.name);
36
37
for
(
auto
it = annotation.bindings.constBegin(); it != annotation.bindings.constEnd(); ++it) {
38
size_t h = combine(seed, it.key());
39
// use + to keep the result independent of the ordering of the keys
40
41
const
auto
&var = it.value();
42
43
if
(var.valueless_by_exception())
44
continue
;
45
46
if
(
auto
v = get_if<
double
>(&var))
47
seed += combine(h, *v);
48
else
if
(
auto
v = get_if<QString>(&var))
49
seed += combine(h, *v);
50
else
51
Q_UNREACHABLE();
52
}
53
54
return
seed;
55
}
56
57
QT_END_NAMESPACE
QByteArray::FromBase64Result::operator==
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition
qbytearray.h:842
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qHash
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
Definition
qsize.h:192
qtdeclarative
src
qmlcompiler
qqmljsannotation.cpp
Generated on
for Qt by
1.18.0