diff options
author | zxu <zxu@google.com> | 2018-03-14 08:57:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 08:57:31 -0400 |
commit | 9e815620e9f7f43b42e03db4e5118d7ad03ddee7 (patch) | |
tree | 86f362bad99281325fca7ee3ae116b6a0f36d511 /Firestore/Source/Core | |
parent | d4d73ea53ecdf1e8ade3d00921419645dd5d66f7 (diff) |
grand PR to port the remaining paths (FieldPath and ResourcePath). (#865)
* naively remove FSTPath import and source/test files.
* port FieldPath, part I
* port FieldPath, part II
* port ResourcePath, part I
* port ResourcePath, part II
* the grand commit to fix build errors
* use testutil:: helper instead of those from FSTHelpers
* fix test and lint
* use c_str in errmsg directly
* fix
* fix
* make code clean
* fix integration test I missed
* fix to avoid naming collision in preprocessor
* address changes
* address changes
* address changes
* fix: fieldMask are actually shared with different context.
* address changes
* address changes
Diffstat (limited to 'Firestore/Source/Core')
-rw-r--r-- | Firestore/Source/Core/FSTFirestoreClient.mm | 2 | ||||
-rw-r--r-- | Firestore/Source/Core/FSTQuery.mm | 28 | ||||
-rw-r--r-- | Firestore/Source/Core/FSTSyncEngine.mm | 1 |
3 files changed, 11 insertions, 20 deletions
diff --git a/Firestore/Source/Core/FSTFirestoreClient.mm b/Firestore/Source/Core/FSTFirestoreClient.mm index 288cbe2..9f0779a 100644 --- a/Firestore/Source/Core/FSTFirestoreClient.mm +++ b/Firestore/Source/Core/FSTFirestoreClient.mm @@ -205,7 +205,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)userDidChange:(const User &)user { [self.workerDispatchQueue verifyIsCurrentQueue]; - FSTLog(@"User Changed: %@", util::WrapNSStringNoCopy(user.uid())); + FSTLog(@"User Changed: %s", user.uid().c_str()); [self.syncEngine userDidChange:user]; } diff --git a/Firestore/Source/Core/FSTQuery.mm b/Firestore/Source/Core/FSTQuery.mm index c10b94d..43b6356 100644 --- a/Firestore/Source/Core/FSTQuery.mm +++ b/Firestore/Source/Core/FSTQuery.mm @@ -23,7 +23,6 @@ #import "Firestore/Source/Model/FSTDocument.h" #import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Model/FSTFieldValue.h" -#import "Firestore/Source/Model/FSTPath.h" #import "Firestore/Source/Util/FSTAssert.h" #include "Firestore/core/src/firebase/firestore/model/field_path.h" @@ -153,8 +152,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe NSComparisonResult comparison = FSTDocumentKeyComparator(document.key, refValue.value); return [self matchesComparison:comparison]; } else { - return [self - matchesValue:[document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]]; + return [self matchesValue:[document fieldForPath:self.field]]; } } @@ -220,8 +218,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } - (BOOL)matchesDocument:(FSTDocument *)document { - FSTFieldValue *fieldValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *fieldValue = [document fieldForPath:self.field]; return fieldValue != nil && [fieldValue isEqual:[FSTNullValue nullValue]]; } @@ -267,8 +264,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } - (BOOL)matchesDocument:(FSTDocument *)document { - FSTFieldValue *fieldValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *fieldValue = [document fieldForPath:self.field]; return fieldValue != nil && [fieldValue isEqual:[FSTDoubleValue nanValue]]; } @@ -338,10 +334,8 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe if (_field == FieldPath::KeyFieldPath()) { result = FSTDocumentKeyComparator(document1.key, document2.key); } else { - FSTFieldValue *value1 = - [document1 fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; - FSTFieldValue *value2 = - [document2 fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *value1 = [document1 fieldForPath:self.field]; + FSTFieldValue *value2 = [document2 fieldForPath:self.field]; FSTAssert(value1 != nil && value2 != nil, @"Trying to compare documents on fields that don't exist."); result = [value1 compare:value2]; @@ -434,8 +428,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe FSTReferenceValue *refValue = (FSTReferenceValue *)fieldValue; comparison = [refValue.value compare:document.key]; } else { - FSTFieldValue *docValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:sortOrderComponent.field]]; + FSTFieldValue *docValue = [document fieldForPath:sortOrderComponent.field]; FSTAssert(docValue != nil, @"Field should exist since document matched the orderBy already."); comparison = [fieldValue compare:docValue]; } @@ -590,9 +583,9 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } } else { FSTAssert(!inequalityField || *inequalityField == *firstSortOrderField, - @"First orderBy %@ should match inequality field %@.", - util::WrapNSStringNoCopy(firstSortOrderField->CanonicalString()), - util::WrapNSStringNoCopy(inequalityField->CanonicalString())); + @"First orderBy %s should match inequality field %s.", + firstSortOrderField->CanonicalString().c_str(), + inequalityField->CanonicalString().c_str()); __block BOOL foundKeyOrder = NO; @@ -791,8 +784,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe for (FSTSortOrder *orderBy in self.explicitSortOrders) { const FieldPath &fieldPath = orderBy.field; // order by key always matches - if (fieldPath != FieldPath::KeyFieldPath() && - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:fieldPath]] == nil) { + if (fieldPath != FieldPath::KeyFieldPath() && [document fieldForPath:fieldPath] == nil) { return NO; } } diff --git a/Firestore/Source/Core/FSTSyncEngine.mm b/Firestore/Source/Core/FSTSyncEngine.mm index a857f5a..61fac7d 100644 --- a/Firestore/Source/Core/FSTSyncEngine.mm +++ b/Firestore/Source/Core/FSTSyncEngine.mm @@ -36,7 +36,6 @@ #import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Model/FSTDocumentSet.h" #import "Firestore/Source/Model/FSTMutationBatch.h" -#import "Firestore/Source/Model/FSTPath.h" #import "Firestore/Source/Remote/FSTRemoteEvent.h" #import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/Source/Util/FSTDispatchQueue.h" |