From 5af6de9e69b86ab94da78b9f889b96517cec47da Mon Sep 17 00:00:00 2001 From: Gil Date: Sat, 5 May 2018 09:00:53 -0700 Subject: Migrate FSTDocumentVersionDictionary to C++ DocumentVersionMap (#1231) --- Firestore/core/src/firebase/firestore/model/document_key.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/model') diff --git a/Firestore/core/src/firebase/firestore/model/document_key.h b/Firestore/core/src/firebase/firestore/model/document_key.h index 6532b2e..f6f4bf1 100644 --- a/Firestore/core/src/firebase/firestore/model/document_key.h +++ b/Firestore/core/src/firebase/firestore/model/document_key.h @@ -59,15 +59,15 @@ class DocumentKey { return [FSTDocumentKey keyWithPath:path()]; } - std::string ToString() const { - return path().CanonicalString(); - } - NSUInteger Hash() const { return util::Hash(ToString()); } #endif + std::string ToString() const { + return path().CanonicalString(); + } + /** * Creates and returns a new document key using '/' to split the string into * segments. @@ -119,6 +119,12 @@ inline bool operator>=(const DocumentKey& lhs, const DocumentKey& rhs) { return lhs.path() >= rhs.path(); } +struct DocumentKeyHash { + size_t operator()(const DocumentKey& key) const { + return util::Hash(key.ToString()); + } +}; + } // namespace model namespace util { -- cgit v1.2.3