From fd9fd271d0dba3935a6f5611a1554f2c59b696af Mon Sep 17 00:00:00 2001 From: zxu Date: Thu, 15 Feb 2018 17:23:08 -0500 Subject: replacing Auth/FSTUser by C++ auth implementation (#804) * replacing Auth/FSTUser by C++ auth implementation * address changes --- Firestore/core/src/firebase/firestore/auth/user.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Firestore/core/src/firebase/firestore/auth') diff --git a/Firestore/core/src/firebase/firestore/auth/user.h b/Firestore/core/src/firebase/firestore/auth/user.h index 58b8b55..cc7b66d 100644 --- a/Firestore/core/src/firebase/firestore/auth/user.h +++ b/Firestore/core/src/firebase/firestore/auth/user.h @@ -17,6 +17,11 @@ #ifndef FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_AUTH_USER_H_ #define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_AUTH_USER_H_ +#if defined(__OBJC__) +#import +#include "Firestore/core/src/firebase/firestore/util/string_apple.h" +#endif // defined(__OBJC__) + #include #include "absl/strings/string_view.h" @@ -38,6 +43,12 @@ class User { /** Construct an authenticated user with the given UID. */ explicit User(const absl::string_view uid); +#if defined(__OBJC__) + explicit User(NSString* uid) + : User(firebase::firestore::util::MakeStringView(uid)) { + } +#endif // defined(__OBJC__) + const std::string& uid() const { return uid_; } @@ -69,6 +80,14 @@ inline bool operator!=(const User& lhs, const User& rhs) { return !(lhs == rhs); } +// Specializations of std::hash is prohibited. We define a hash function to be +// passed through manually. +struct HashUser { + inline int64_t operator()(const User& user) const { + return std::hash{}(user.uid()); + } +}; + } // namespace auth } // namespace firestore } // namespace firebase -- cgit v1.2.3