diff options
author | zxu <zxu@google.com> | 2018-03-27 14:33:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 14:33:39 -0400 |
commit | cb8c4b6b1f1ad213a5b3272e2c2e94f755bbabf9 (patch) | |
tree | eb3eeddefb5fca423f59432933721d6d47100aa5 /Firestore/Source/Core/FSTView.mm | |
parent | a335d78a62c213b1ae6465bad28aaedfafd828bc (diff) |
port C++ DocumentKey to the rest of Firestore code (#977)
* port C++ DocumentKey to API's and Core's
* address changes
* address changes
* fix Hash return types
Diffstat (limited to 'Firestore/Source/Core/FSTView.mm')
-rw-r--r-- | Firestore/Source/Core/FSTView.mm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Firestore/Source/Core/FSTView.mm b/Firestore/Source/Core/FSTView.mm index b3cf189..d87951a 100644 --- a/Firestore/Source/Core/FSTView.mm +++ b/Firestore/Source/Core/FSTView.mm @@ -16,15 +16,20 @@ #import "Firestore/Source/Core/FSTView.h" +#include <utility> + #import "Firestore/Source/Core/FSTQuery.h" #import "Firestore/Source/Core/FSTViewSnapshot.h" #import "Firestore/Source/Model/FSTDocument.h" -#import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Model/FSTDocumentSet.h" #import "Firestore/Source/Model/FSTFieldValue.h" #import "Firestore/Source/Remote/FSTRemoteEvent.h" #import "Firestore/Source/Util/FSTAssert.h" +#include "Firestore/core/src/firebase/firestore/model/document_key.h" + +using firebase::firestore::model::DocumentKey; + NS_ASSUME_NONNULL_BEGIN #pragma mark - FSTViewDocumentChanges @@ -61,28 +66,34 @@ NS_ASSUME_NONNULL_BEGIN @interface FSTLimboDocumentChange () -+ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key; ++ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key; - (instancetype)initWithType:(FSTLimboDocumentChangeType)type - key:(FSTDocumentKey *)key NS_DESIGNATED_INITIALIZER; + key:(DocumentKey)key NS_DESIGNATED_INITIALIZER; @end -@implementation FSTLimboDocumentChange +@implementation FSTLimboDocumentChange { + DocumentKey _key; +} -+ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key { - return [[FSTLimboDocumentChange alloc] initWithType:type key:key]; ++ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key { + return [[FSTLimboDocumentChange alloc] initWithType:type key:std::move(key)]; } -- (instancetype)initWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key { +- (instancetype)initWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key { self = [super init]; if (self) { _type = type; - _key = key; + _key = std::move(key); } return self; } +- (const DocumentKey &)key { + return _key; +} + - (BOOL)isEqual:(id)other { if (self == other) { return YES; @@ -357,7 +368,7 @@ static NSComparisonResult FSTCompareDocumentViewChangeTypes(FSTDocumentViewChang #pragma mark - Private methods /** Returns whether the doc for the given key should be in limbo. */ -- (BOOL)shouldBeLimboDocumentKey:(FSTDocumentKey *)key { +- (BOOL)shouldBeLimboDocumentKey:(const DocumentKey &)key { // If the remote end says it's part of this query, it's not in limbo. if ([self.syncedDocuments containsObject:key]) { return NO; |