blob: 6c77a78f85911b17f05b583219335ec1879ebc2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QV4IDENTIFIERHASH_P_H
#define QV4IDENTIFIERHASH_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <qstring.h>
#include <private/qv4global_p.h>
#include <private/qv4propertykey_p.h>
QT_BEGIN_NAMESPACE
namespace QV4 {
struct IdentifierHashEntry;
struct IdentifierHashData;
struct Q_QML_EXPORT IdentifierHash
{
IdentifierHash() = default;
IdentifierHash(ExecutionEngine *engine);
IdentifierHash(const IdentifierHash &other);
~IdentifierHash();
IdentifierHash &operator=(const IdentifierHash &other);
bool isEmpty() const { return !d; }
int count() const;
void detach();
void add(const QString &str, int value);
void add(Heap::String *str, int value);
int value(const QString &str) const;
int value(String *str) const;
QString findId(int value) const;
private:
inline IdentifierHashEntry *addEntry(PropertyKey i);
inline const IdentifierHashEntry *lookup(PropertyKey identifier) const;
inline const IdentifierHashEntry *lookup(const QString &str) const;
inline const IdentifierHashEntry *lookup(String *str) const;
inline const PropertyKey toIdentifier(const QString &str) const;
inline const PropertyKey toIdentifier(Heap::String *str) const;
IdentifierHashData *d = nullptr;
};
} // namespace QV4
QT_END_NAMESPACE
#endif // QV4_IDENTIFIERHASH_P_H
|