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
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 <qstring.h>
19#include <private/qv4global_p.h>
20#include <private/qv4propertykey_p.h>
21
23
24namespace QV4 {
25
28struct Q_QML_EXPORT IdentifierHash
29{
30 IdentifierHash() = default;
35
36 bool isEmpty() const { return !d; }
37
38 int count() const;
39
40 void detach();
41
42 void add(const QString &str, int value);
43 void add(Heap::String *str, int value);
44
45 int value(const QString &str) const;
46 int value(String *str) const;
47 QString findId(int value) const;
48
49private:
52 inline const IdentifierHashEntry *lookup(const QString &str) const;
53 inline const IdentifierHashEntry *lookup(String *str) const;
54 inline const PropertyKey toIdentifier(const QString &str) const;
55 inline const PropertyKey toIdentifier(Heap::String *str) const;
56
57 IdentifierHashData *d = nullptr;
58};
59
60} // namespace QV4
61
62QT_END_NAMESPACE
63
64#endif // QV4_IDENTIFIERHASH_P_H
Definition qjsvalue.h:23