From c1d66eec1dbaf9034e03e3efa0403a774c764373 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 1 Oct 2013 16:11:55 +0200 Subject: Cleanup API of Safe Don't have an implicit cast operator to Returned anymore, and return a T* from the operator->() Change-Id: If4165071b986bfc84a157560d94d39c2dcfbc9e1 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4string.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4string.cpp') diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index af573fb471..fd366d26ac 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -135,7 +135,7 @@ ReturnedValue String::get(Managed *m, const StringRef name, bool *hasProperty) Scope scope(v4); ScopedString that(scope, static_cast(m)); - if (name->isEqualTo(v4->id_length)) { + if (name->equals(v4->id_length)) { if (hasProperty) *hasProperty = true; return Primitive::fromInt32(that->_text.length()).asReturnedValue(); @@ -260,6 +260,20 @@ uint String::toUInt(bool *ok) const return UINT_MAX; } +bool String::equals(const StringRef other) const +{ + if (this == other.getPointer()) + return true; + if (hashValue() != other->hashValue()) + return false; + if (identifier && identifier == other->identifier) + return true; + if (subtype >= StringType_UInt && subtype == other->subtype) + return true; + + return toQString() == other->toQString(); +} + void String::makeIdentifierImpl() const { engine()->identifierTable->identifier(this); -- cgit v1.2.3