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
qv4identifierhash_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 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
#
ifndef
QV4IDENTIFIERHASH_P_H
5
#
define
QV4IDENTIFIERHASH_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
<
private
/
qv4global_p
.
h
>
19
#
include
<
private
/
qv4propertykey_p
.
h
>
20
21
#
include
<
QtCore
/
qstring
.
h
>
22
23
QT_BEGIN_NAMESPACE
24
25
namespace
QV4
{
26
27
struct
IdentifierHashEntry
;
28
struct
IdentifierHashData
;
29
struct
IdentifierHash
30
{
31
IdentifierHash
() =
default
;
32
IdentifierHash(ExecutionEngine *engine);
33
IdentifierHash
(
const
IdentifierHash
&other);
34
IdentifierHash
(
IdentifierHash
&&other)
noexcept
:
d
(
std
::
exchange
(
other
.
d
,
nullptr
)) {}
35
~
IdentifierHash
();
36
IdentifierHash
&
operator
=(
const
IdentifierHash
&other);
37
38
void
swap
(
IdentifierHash
&other)
noexcept
{ qt_ptr_swap(d, other.d); }
39
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP
(
IdentifierHash
)
40
41
bool
isValid
()
const
{
return
d; }
42
int
size
()
const
;
43
44
void
add
(
const
QString &str,
int
value) { addEntry(toIdentifier(str), value); }
45
void
add(Heap::String *str,
int
value) { addEntry(toIdentifier(str), value); }
46
47
int
value
(
const
QString &str)
const
{
return
lookup(toIdentifier(str)); }
48
int
value(Heap::String *str)
const
{
return
lookup(toIdentifier(str)); }
49
50
template
<
typename
String>
51
String
key
(
int
value)
const
{
return
toString<String>(reverseLookup(value)); }
52
53
private
:
54
void
addEntry(PropertyKey i,
int
value);
55
56
int
lookup(PropertyKey identifier)
const
;
57
PropertyKey reverseLookup(
int
value)
const
;
58
59
PropertyKey toIdentifier(
const
QString &str)
const
;
60
PropertyKey toIdentifier(Heap::String *str)
const
;
61
62
template
<
typename
String>
63
String toString(PropertyKey key)
const
;
64
65
IdentifierHashData
*d =
nullptr
;
66
};
67
68
template
<>
Heap
::
String
*
IdentifierHash
::
toString
<
Heap
::
String
*>(
PropertyKey
key
)
const
;
69
template
<>
QString
IdentifierHash
::
toString
<
QString
>(
PropertyKey
key
)
const
;
70
71
}
// namespace QV4
72
73
QT_END_NAMESPACE
74
75
#
endif
// QV4_IDENTIFIERHASH_P_H
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QV4
Definition
qjsvalue.h:24
QV4::IdentifierHashData
Definition
qv4identifierhashdata_p.h:33
QV4::IdentifierHashEntry
Definition
qv4identifierhashdata_p.h:27
QV4::IdentifierHash
Definition
qv4identifierhash_p.h:30
QV4::IdentifierHash::size
int size() const
Definition
qv4identifierhash.cpp:136
QV4::IdentifierHash::~IdentifierHash
~IdentifierHash()
Definition
qv4identifierhash.cpp:120
QV4::IdentifierHash::IdentifierHash
IdentifierHash(IdentifierHash &&other) noexcept
Definition
qv4identifierhash_p.h:34
QV4::IdentifierHash::isValid
bool isValid() const
Definition
qv4identifierhash_p.h:41
QV4::IdentifierHash::IdentifierHash
IdentifierHash(const IdentifierHash &other)
Definition
qv4identifierhash.cpp:113
QV4::IdentifierHash::IdentifierHash
IdentifierHash()=default
QV4::IdentifierHash::key
String key(int value) const
Definition
qv4identifierhash_p.h:51
QV4::IdentifierHash::add
void add(const QString &str, int value)
Definition
qv4identifierhash_p.h:44
QV4::IdentifierHash::value
int value(const QString &str) const
Definition
qv4identifierhash_p.h:47
QV4::IdentifierHash::swap
void swap(IdentifierHash &other) noexcept
Definition
qv4identifierhash_p.h:38
QV4::IdentifierHash::operator=
IdentifierHash & operator=(const IdentifierHash &other)
Definition
qv4identifierhash.cpp:126
QV4::IdentifierTable
Definition
qv4identifiertable_p.h:29
qtdeclarative
src
qml
jsruntime
qv4identifierhash_p.h
Generated on
for Qt by
1.18.0