aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4identifier_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-06 13:41:29 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:06 +0000
commitb58711804e9cca641927dbdebe281488e475352b (patch)
treecb7671cb6edc52e5e744a370704ec068c7ab45eb /src/qml/jsruntime/qv4identifier_p.h
parent238b1cb1cb8915995b6dfe4e404f1771c62b3169 (diff)
Use Identifier by value and don't new them anymore
Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4identifier_p.h')
-rw-r--r--src/qml/jsruntime/qv4identifier_p.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h
index f3935950c8..660cc2db05 100644
--- a/src/qml/jsruntime/qv4identifier_p.h
+++ b/src/qml/jsruntime/qv4identifier_p.h
@@ -66,12 +66,19 @@ struct ExecutionEngine;
struct Identifier
{
- uint id;
+ quintptr id;
+
+ static Identifier invalid() { return Identifier{0}; }
+ bool isValid() const { return id != 0; }
+ bool operator !() const { return id == 0; }
+ bool operator ==(const Identifier &other) const { return id == other.id; }
+ bool operator !=(const Identifier &other) const { return id != other.id; }
+ bool operator <(const Identifier &other) const { return id < other.id; }
};
struct IdentifierHashEntry {
- const Identifier *identifier;
+ Identifier identifier;
int value;
};
@@ -116,12 +123,12 @@ struct IdentifierHash
QString findId(int value) const;
protected:
- IdentifierHashEntry *addEntry(const Identifier *i);
- const IdentifierHashEntry *lookup(const Identifier *identifier) const;
+ IdentifierHashEntry *addEntry(Identifier i);
+ const IdentifierHashEntry *lookup(Identifier identifier) const;
const IdentifierHashEntry *lookup(const QString &str) const;
const IdentifierHashEntry *lookup(String *str) const;
- const Identifier *toIdentifier(const QString &str) const;
- const Identifier *toIdentifier(Heap::String *str) const;
+ const Identifier toIdentifier(const QString &str) const;
+ const Identifier toIdentifier(Heap::String *str) const;
};